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

2010-12-23 Thread Neaox
Like this?: function filterHandler(evt){this.fire('check:filter');} $('filter').observe('keyup', filterHandler).observe('click',filterHandler).observe('focus', filterHandler).observe('blur', filterHandler); See Observe Documentation: http://www.prototypejs.org/api/event/observe As the

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',

[Proto-Scripty] Re: Behavioral of select option

2010-12-23 Thread Neaox
Hi I think the error might be to do with this section of code: ...).down('input.previous')... this is calling for the first input with a class name of 'previous' within the element with the id of 'paging', what I'm assuming you were trying to do was get the element that comes before the first

[Proto-Scripty] Re: PeriodicalExecuter counter

2010-12-23 Thread Neaox
Hi, Below is a patch to PeriodicalExecuter that should do what your asking, I have Prototype 1.7.min and this patch is untested: var PeriodicalExecuter=Class.create({initialize:function(callback,frequency)

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

[Proto-Scripty] Re: Behavioral of select option

2010-12-23 Thread ColinFine
On Dec 22, 9:57 pm, kstubs kst...@gmail.com wrote: I have a select option, in HTML It is empty like this: select id=myselect name=selectoroption//select After page load I make ajax request and finish loading the selector with additional option(s). So I might have: select id=myselect

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

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

2010-12-23 Thread T.J. Crowder
@Richard: Maybe something like ... ['keyup', 'click', 'focus', 'blur'].each(function(eventName){  $('filter').observe(eventName, function(evt){   this.fire('check:filter');  }); }); That creates four identical functions (one for each event). Not necessarily a problem, but... @Walter:

[Proto-Scripty] Re: Observe form submit which button clicked?

2010-12-23 Thread T.J. Crowder
It can be even simpler than Walter's version, and I'm not aware of any issues with `click` not bubbling: $('theForm').observe('click', function(event) { // Find out if it was a submit button that was clicked var button = event.findElement('input[type=submit]'); if (button) {

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

2010-12-23 Thread Walter Lee Davis
As usual, taking it to the space elevator! Thanks so much! Walter On Dec 23, 2010, at 10:21 AM, T.J. Crowder wrote: @Richard: Maybe something like ... ['keyup', 'click', 'focus', 'blur'].each(function(eventName){ $('filter').observe(eventName, function(evt){ this.fire('check:filter');

[Proto-Scripty] element.getStyle('border') does not work

2010-12-23 Thread marbrun
Hello guys I am using the latest version of JS Prototype, 1.7. I have never asked a question about JS Prototype online because I always figured it out somehow or just found another solution. But that's not true this time. In CSS, the border is set on an element like this: #element {

Re: [Proto-Scripty] element.getStyle('border') does not work

2010-12-23 Thread Jane Hunter
reorder the border attributes so they are type, size, color and see if that solves your problem. On Thu, Dec 23, 2010 at 11:53 AM, marbrun marb...@me.com wrote: Hello guys I am using the latest version of JS Prototype, 1.7. I have never asked a question about JS Prototype online because I

[Proto-Scripty] Re: element.getStyle('border') does not work

2010-12-23 Thread marbrun
I tried that already. Also tried just with getStyle('border-width') but that gives nothing either. Other styles like background-color are returned well. On 23 dec, 18:02, Jane Hunter jane...@gmail.com wrote: reorder the border attributes so they are type, size, color and see if that solves your

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

2010-12-23 Thread Richard Quadling
@TJ Yeah. I sort of noticed that. I like the observeAll mechanism. Very reusable. In PHP, I could ... if (!!fn || fn = function(){...}) { fn(); } sort of thing. Basically assign a value to a variable and evaluate the assignment. For closures, this is always true. Could this be done in JS?

Re: [Proto-Scripty] element.getStyle('border') does not work

2010-12-23 Thread Walter Lee Davis
I just tried this with 1.6 and can report the following: * It works if you define the style inline (in the div's style tag). * It works if you set the attribute using Prototype Element.setStyle * It works for any simple attribute that does not have a composite- shortcut form, like width, no

[Proto-Scripty] Re: element.getStyle('border') does not work

2010-12-23 Thread marbrun
Great test! Strange thing are these results: $('test').measure('border'); - undefined $('test').measure('border-box-width') - 210 $('test').measure('width') - 200 #test { width:200px; border:solid 5px #00; } So even with the new measure and getLayout methods in JS Prototype 1.7 you would

[Proto-Scripty] Re: element.getStyle('border') does not work

2010-12-23 Thread T.J. Crowder
It doesn't seem to be a Prototype-specific thing. `getComputedStyle` is just not giving back that information: http://jsbin.com/uyifa4 Except on Opera. It works on Opera. V. weird. FWIW, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On

[Proto-Scripty] Re: element.getStyle('border') does not work

2010-12-23 Thread T.J. Crowder
Doh! Not all that weird, I'd forgotten that `border-size` is a shorthand property! Works with full names: http://jsbin.com/uyifa4/2 Nice one, Walter! -- T.J. On Dec 23, 5:45 pm, T.J. Crowder t...@crowdersoftware.com wrote: It doesn't seem to be a Prototype-specific thing. `getComputedStyle`

[Proto-Scripty] Re: Class.create() and Object.clone() and methods

2010-12-23 Thread thomas.boer...@googlemail.com
HI! Great! Thanks! Thomas -- 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

[Proto-Scripty] Dilemma: singleton or ordinal object?

2010-12-23 Thread buda
Usually we have some fields in a form like date-field. I have a dilemma: in such languages as C# I would create singleton and use one class per many date-fields to display calendar. I dont know is it possible (how to create singleton class and how create ordinary class with static methods and

[Proto-Scripty] Re: Behavioral of select option

2010-12-23 Thread kstubs
Chris, the selector is valid, I have an input with a class=previous within a form container id=paging Colin, after the select option list is dynamically constructed I set the first item in the list like this: pagePageSelector.options.selectedIndex = (currentpage - 1); I've stepped through the

[Proto-Scripty] Re: Observe form submit which button clicked?

2010-12-23 Thread kstubs
T.J., Duhh! Thanks for pointing out the obvious. I was stuck on observing submit. Now, I've tested your page in Chrome and FF, but doesn't seem to be working, instead I am taken straight to Google. -- You received this message because you are subscribed to the Google Groups Prototype