Re: [Proto-Scripty] Is there a way to DRY this up?

2010-12-23 Thread Richard Quadling
On 22 December 2010 18:16, Walter Lee Davis wa...@wdstudio.com wrote:
 I have a quick filter for hiding list items until only matches show. I want
 to cover all the various ways that a user might interact with the search
 field, so I write this lovely:

        $('filter').observe('keyup', function(evt){
                this.fire('check:filter');
        });
        $('filter').observe('click', function(evt){
                this.fire('check:filter');
        });
        $('filter').observe('focus', function(evt){
                this.fire('check:filter');
        });
        $('filter').observe('blur', function(evt){
                this.fire('check:filter');
        });

 Is there any way to write this more clearly, as in with fewer lines of code?

 I'm using 1.6.latest, haven't tried the new 1.7 goodies yet. Would that
 help?

 Walter

 --
 You received this message because you are subscribed to the Google Groups
 Prototype  script.aculo.us group.
 To post to this group, send email to
 prototype-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.



Maybe something like ...

['keyup', 'click', 'focus', 'blur'].each(function(eventName){
 $('filter').observe(eventName, function(evt){
  this.fire('check:filter');
 });
});


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Is there a way to DRY this up?

2010-12-23 Thread Christopher Dyson
Good Idea! :D

Dunno why I didn't think of that, I used something like that the other day,
Doh..

Chris

On 23 December 2010 23:02, Richard Quadling rquadl...@gmail.com wrote:

 On 22 December 2010 18:16, Walter Lee Davis wa...@wdstudio.com wrote:
  I have a quick filter for hiding list items until only matches show. I
 want
  to cover all the various ways that a user might interact with the search
  field, so I write this lovely:
 
 $('filter').observe('keyup', function(evt){
 this.fire('check:filter');
 });
 $('filter').observe('click', function(evt){
 this.fire('check:filter');
 });
 $('filter').observe('focus', function(evt){
 this.fire('check:filter');
 });
 $('filter').observe('blur', function(evt){
 this.fire('check:filter');
 });
 
  Is there any way to write this more clearly, as in with fewer lines of
 code?
 
  I'm using 1.6.latest, haven't tried the new 1.7 goodies yet. Would that
  help?
 
  Walter
 
  --
  You received this message because you are subscribed to the Google Groups
  Prototype  script.aculo.us group.
  To post to this group, send email to
  prototype-scriptacul...@googlegroups.com.
  To unsubscribe from this group, send email to
  prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group at
  http://groups.google.com/group/prototype-scriptaculous?hl=en.
 
 

 Maybe something like ...

 ['keyup', 'click', 'focus', 'blur'].each(function(eventName){
  $('filter').observe(eventName, function(evt){
  this.fire('check:filter');
  });
 });


 --
 Richard Quadling
 Twitter : EE : Zend
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

 --
 You received this message because you are subscribed to the Google Groups
 Prototype  script.aculo.us group.
 To post to this group, send email to
 prototype-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Is there a way to DRY this up?

2010-12-23 Thread Walter Lee Davis

Excellent suggestions. Thanks, all!

Walter

On Dec 23, 2010, at 5:42 AM, Christopher Dyson wrote:


Good Idea! :D

Dunno why I didn't think of that, I used something like that the  
other day, Doh..


Chris

On 23 December 2010 23:02, Richard Quadling rquadl...@gmail.com  
wrote:
On 22 December 2010 18:16, Walter Lee Davis wa...@wdstudio.com  
wrote:
 I have a quick filter for hiding list items until only matches  
show. I want
 to cover all the various ways that a user might interact with the  
search

 field, so I write this lovely:

$('filter').observe('keyup', function(evt){
this.fire('check:filter');
});
$('filter').observe('click', function(evt){
this.fire('check:filter');
});
$('filter').observe('focus', function(evt){
this.fire('check:filter');
});
$('filter').observe('blur', function(evt){
this.fire('check:filter');
});

 Is there any way to write this more clearly, as in with fewer  
lines of code?


 I'm using 1.6.latest, haven't tried the new 1.7 goodies yet. Would  
that

 help?

 Walter

 --
 You received this message because you are subscribed to the Google  
Groups

 Prototype  script.aculo.us group.
 To post to this group, send email to
 prototype-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.



Maybe something like ...

['keyup', 'click', 'focus', 'blur'].each(function(eventName){
 $('filter').observe(eventName, function(evt){
 this.fire('check:filter');
 });
});


--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
You received this message because you are subscribed to the Google  
Groups Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com 
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en 
.




--
You received this message because you are subscribed to the Google  
Groups Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com 
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en 
.


--
You received this message because you are subscribed to the Google Groups Prototype 
 script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Is there a way to DRY this up?

2010-12-22 Thread Walter Lee Davis
I have a quick filter for hiding list items until only matches show. I  
want to cover all the various ways that a user might interact with the  
search field, so I write this lovely:


$('filter').observe('keyup', function(evt){
this.fire('check:filter');
});
$('filter').observe('click', function(evt){
this.fire('check:filter');
});
$('filter').observe('focus', function(evt){
this.fire('check:filter');
});
$('filter').observe('blur', function(evt){
this.fire('check:filter');
});

Is there any way to write this more clearly, as in with fewer lines of  
code?


I'm using 1.6.latest, haven't tried the new 1.7 goodies yet. Would  
that help?


Walter

--
You received this message because you are subscribed to the Google Groups Prototype 
 script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.