I''ve been using Mootools and I''d like to transition away from
it and
use Prototype. I don''t know if it''s just me, but I
can''t find all the
equivalents for it in Prototype. Am I missing something?
Here''s the script:
<script>
options = $$("#options input");
options.each(function(el){el.addEvent(''click'',function()
{if(this.getProperty(''checked''))$(''main'').checked
= false;})});
$(''main'').addEvent(''click'',function()
{if(this.getProperty(''checked''))options.each(function(el){el.checked
false;})});
</script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Just change addEvent to observe and getProperty to readAttribute
(though in this case you can use invoke in favor of each as well as
directly access .checked property of an element)
var options = $$(''#options input'');
options.invoke(''observe'', ''click'',
function(){
if (this.checked) {
$(''main'').checked = false;
}
})
$(''main'').observe(''click'', function() {
if (this.checked) {
options.each(function(el){ el.checked = false; })
}
})
P.S. this is assuming you use 1.6 version (to have "this" normalized
in a callback)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
ibaj-ee4meeAH724@public.gmane.org
2007-Nov-04 06:47 UTC
Re: Help transitioning from Mootools
That''s almost perfect. I am using 1.6, but I''m using it with
ModalBox,
which is why I''m having to transition. The problem with this is the
functions.
Because evalScripts is true, the AJAX updater can''t correctly process
this and the page isn''t displayed.
The example they give is:
coolFunc = function() {
// Amazing stuff!
}
You can see what I''m talking about at
http://code.google.com/p/modalbox/wiki/DefiningJavaScript
I know it''s not as simple as replacing the comma with the = sign, but
right now I feel like an idiot.
On Nov 3, 11:42 pm, kangax
<kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Just change addEvent to observe and getProperty to readAttribute
> (though in this case you can use invoke in favor of each as well as
> directly access .checked property of an element)
>
> var options = $$(''#options input'');
> options.invoke(''observe'', ''click'',
function(){
> if (this.checked) {
> $(''main'').checked = false;
> }})
>
> $(''main'').observe(''click'', function() {
> if (this.checked) {
> options.each(function(el){ el.checked = false; })
> }
>
> })
>
> P.S. this is assuming you use 1.6 version (to have "this"
normalized
> in a callback)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
ibaj-ee4meeAH724@public.gmane.org
2007-Nov-05 04:45 UTC
Re: Help transitioning from Mootools
Fixed and working inside ModalBox. Thanks to kangax and Ankur!
<script>
var options = $$(''.other'');
options.invoke(''observe'', ''click'',
function(){
if (this.checked) {
$(''main'').checked = false;
}
});
$(''main'').observe(''click'', function(){
if (this.checked) {
options.each(function(el){ el.checked = false; });
}
});
</script>
On Nov 4, 12:47 am, "i...-ee4meeAH724@public.gmane.org"
<ajone...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> That''s almost perfect. I am using 1.6, but I''m using it
with ModalBox,
> which is why I''m having to transition. The problem with this is
the
> functions.
>
> Because evalScripts is true, the AJAX updater can''t correctly
process
> this and the page isn''t displayed.
>
> The example they give is:
>
> coolFunc = function() {
> // Amazing stuff!
>
> }
>
> You can see what I''m talking about
athttp://code.google.com/p/modalbox/wiki/DefiningJavaScript
>
> I know it''s not as simple as replacing the comma with the = sign,
but
> right now I feel like an idiot.
>
> On Nov 3, 11:42 pm, kangax
<kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Just change addEvent to observe and getProperty to readAttribute
> > (though in this case you can use invoke in favor of each as well as
> > directly access .checked property of an element)
>
> > var options = $$(''#options input'');
> > options.invoke(''observe'', ''click'',
function(){
> > if (this.checked) {
> > $(''main'').checked = false;
> > }})
>
> > $(''main'').observe(''click'',
function() {
> > if (this.checked) {
> > options.each(function(el){ el.checked = false; })
> > }
>
> > })
>
> > P.S. this is assuming you use 1.6 version (to have "this"
normalized
> > in a callback)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---