[Proto-Scripty] why does this not work?

2009-11-14 Thread patrick

Can anyone explain this to me?   It appears to be a scope issue where
my_a no longer is set to the instantiated class 'a' once it gets
executed in class 'b's initialize method...  How is the best way to
get around this?

thanks.

-patrick

document.observe(dom:loaded, function() {
  var test = new a;
});

var a = (function() {

var a = Class.create({

initialize: function() {
new b(this.to_execute)
},

do_something: function() {
console.log('it has been done!');
},

future_func: function() {
var my_a = this;
my_a.do_something();
}
});


return a;

})();


var b = (function() {

var b = Class.create({

initialize: function(func) {
func();
}
});

return b;

})();

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Observing multipart/form-data oncomplete

2009-11-14 Thread Stucture_Ulf

Hi and thanks for answering. I will manage to arrange my script
according to these tow alternatives, I'll try both methods. All the
best and regards!

On Nov 13, 2:18 pm, Eric lefauv...@gmail.com wrote:
 Hi,

 You may try to observe the iframe's onload since after a form
 submission, the server is supposed to return a page.
 Of course, remember that this event will also be fired on the iframe's
 initial loading so you'll have a little extra plumbing to do.

 Another possibility would be for the server to return something like:
 Event.fire(parent.document,form:complete);
 and to observe this event on your document, but it may not be that
 simple to send event to/from iframe (I never tried).

 Good luck,
 Eric

 On Nov 12, 1:37 pm, Stucture_Ulf maximilian.moulet...@gmail.com
 wrote:

  I'm using document['formID'].submit() to submit a multipart/form-data
  form for multiple files upload. I want to observe the upload process
  and fire additional events once the file/files has been uploaded. I'm
  using a iframe for the upload form and looking for a way to observe
  the onComplete state of the submitted form. I'm not using the
  Ajax.Request since I'm uploading files through a iframe...feels like
  there's a simple and basic solution I've missed. Help appreciated
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] beforeunload event help

2009-11-14 Thread BillSaysThis

  document.observe('dom:loaded', function() {
Event.observe(window, 'beforeunload', function(evt) {
  if( !( $F('verifiedURL') ) ) {
var r= confirm(You have not tested your medallion, a step
required for activation. You can return later by clicking the Manage
button for this site.\n\nDo you still wish to leave?);
if(!r) {
  Event.stop(evt);
}
  }
});
  });

Having two problems with this code:

1. Ignores the value of $F('verifiedURL') and never shows the confirm
dialog

2. If I comment out the if($F('verifiedURL')) test on Firefox a
Confirm dialog is shown twice if I click Cancel, once with my message
and then again with a generic message (but only once if click OK)--in
both cases the browser takes the right action in the end.

On Safari the dialog is only shown once but unloads the page no matter
which answer is clicked.

Generic message shown is:

Are you sure you want to navigate away from this page?

Press OK to continue, or Cancel to stay on the current page.

Using the Prototype lib shipped with Rails 2.3.4 on OS X 10.5.x.

Thanks,
Bill

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] DragDrop: Cannot Drop

2009-11-14 Thread omarius

Hey there,

my DragDrop Problem seems to be so simple, that no one has it. It
just doesnt work, meaning, i can drag but i cant drop.

Thats my code:


div style=width:634px; height:410px; overflow:hidden;

div id=formation style=width:310px; height:410px;
overflow:visible; float:left; 
Drop here Buddy!
/div

div style=width:310px; height:410px; background-image:url('/images/
screen/trans_light2.png'); overflow:visible; margin-left:13px;
float:left;

?php foreach($units as $u){ ?
 div id=unit_?=$u-id()? style=float:left; width:
36px; height:36px  /div
   ? } ?

/div

/div

script

Droppables.add('formation',[{
onDrop: function() {alert('Dropped on me.'); },
Hoverclass: 'fff'}
]);

?php foreach($units as $u){ ?

new Draggable(unit_?=$u-id()?,{ghosting:true,revert:'failure'});

? } ?

/script

=== Neither the alert is displayed ondrop nor the hoverclass gets
activated.

WHY?

Thx2All

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Excluding Multiple Items With a Selector

2009-11-14 Thread naugiedoggie

Hello,

I want to bind event listeners to links on a page that go off the
site.  I know the hostname(s)  of the site itself, of course, but not
the names of the sites of the outbound clicks.  Therein lies the rub
-- I have to exclude more than one possible name.

I can't find any documentation that explains how to negate multiple
selectors.  Something like $$('a:not(a[href*=dom1],a[href*=dom2])')
does not work, nor various similar structures I tested.

I would appreciate pointers as to how to do this.  This case is not
the only one in which I will have to be able to do this.

The summary is that I want to be able to exclude the known and be left
with a set comprised of the unknown.

Thanks.

mp

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: why does this not work?

2009-11-14 Thread T.J. Crowder

Hi,

There are a couple of problems there, not least that I don't see
anywhere that a's `to_execute` property is set, so as far as I can see
b would get an undefined value. Did you mean `do_something`?

But I suspect that's a copy-and-paste error. The basic problem is that
you're passing a function without any context. Functions are just
functions, the `this` value does not follow them around as it (seems
to) in some other languages. In JavaScript, `this` is set purely by
how you *call* a function. There are several ways to deal with that,
including Prototype's Function#bind[1].

I wrote up a full description of this issue[2] in my blog a while
back.

[1] http://api.prototypejs.org/language/function.html#bind-instance_method
[2] http://blog.niftysnippets.org/2008/03/mythical-methods.html

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Nov 14, 8:06 am, patrick patrick99...@gmail.com wrote:
 Can anyone explain this to me?   It appears to be a scope issue where
 my_a no longer is set to the instantiated class 'a' once it gets
 executed in class 'b's initialize method...  How is the best way to
 get around this?

 thanks.

 -patrick

 document.observe(dom:loaded, function() {
   var test = new a;

 });

 var a = (function() {

         var a = Class.create({

                 initialize: function() {
                         new b(this.to_execute)
                 },

                 do_something: function() {
                         console.log('it has been done!');
                 },

                 future_func: function() {
                         var my_a = this;
                         my_a.do_something();
                 }
         });

         return a;

 })();

 var b = (function() {

         var b = Class.create({

                 initialize: function(func) {
                         func();
                 }
         });

         return b;



 })();
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: beforeunload event help

2009-11-14 Thread Alex McAuley

The reason that it doubles up on firefox is because you call it twice ..

to fix...


if(!confirm('')) {
Event.stop(evt);
}

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: BillSaysThis bstgro...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Friday, November 13, 2009 6:27 PM
Subject: [Proto-Scripty] beforeunload event help



  document.observe('dom:loaded', function() {
Event.observe(window, 'beforeunload', function(evt) {
  if( !( $F('verifiedURL') ) ) {
var r= confirm(You have not tested your medallion, a step
 required for activation. You can return later by clicking the Manage
 button for this site.\n\nDo you still wish to leave?);
if(!r) {
  Event.stop(evt);
}
  }
});
  });

 Having two problems with this code:

 1. Ignores the value of $F('verifiedURL') and never shows the confirm
 dialog

 2. If I comment out the if($F('verifiedURL')) test on Firefox a
 Confirm dialog is shown twice if I click Cancel, once with my message
 and then again with a generic message (but only once if click OK)--in
 both cases the browser takes the right action in the end.

 On Safari the dialog is only shown once but unloads the page no matter
 which answer is clicked.

 Generic message shown is:

 Are you sure you want to navigate away from this page?

 Press OK to continue, or Cancel to stay on the current page.

 Using the Prototype lib shipped with Rails 2.3.4 on OS X 10.5.x.

 Thanks,
 Bill

 
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype.jExtension

2009-11-14 Thread joe t.

Which methods you propose for the library are entirely up to you. The
development team will make the ultimate decision if they want to
include them or make efficiency modifications. i was just offering a
tweak to #compact to make it work as described. :)

Good luck!
-joe t.


On Nov 13, 12:19 pm, jacoz jacopo.nu...@gmail.com wrote:
 Hi Joe T.,
 well, I've followed your suggests and so (I remember you the 
 linkhttp://tr.im/EBEP):
 - updated Array#compact
 - updated Element#ajaxRequest
 - added Element#ajaxUpdate

 So now you have an empty function when using #ajaxRequest, and the
 update function when using #ajaxUpdate!
 Is that good, according to you?

 Which methods would you suggest me to propose?

 Thank you so much!
 Jacopo.

 On Nov 13, 4:49 pm, joe t. thooke...@gmail.com wrote:

  i agree with a lot of Eric's points so far. There are some
  interesting, and possibly useful utility methods in this, but there
  are others that would needlessly bloat an already fairly bloated
  library (don't get me wrong, i still love it). The thing i would point
  out for #ajaxRequest is similar to Eric's point: by embedding an
  onSuccess call, you force the user to either replace it with their own
  callback, or pass an empty function just to make it not do the default
  element update. It's usually better practice to minimize the amount of
  required options and let the user include more as they need them. i
  actually don't do element updates from Ajax request as a frequent
  practice, so this modification would harm my code overhead.

  Also, as a minor clarification: in #compact, the strict argument
  name should be changed to aggressive. (    ) is not strictly an
  empty string. It's just 100% white space. Seems like nitpicking, but
  with other mentions of helping novice coders understand more about JS
  libraries, consistent semantics are a huge part of that.

  Eric's right about using tests outside loops, but there are a couple
  issue with the proposed correction:
  1. From the original, value.strip() is wrong, because #strip() doesn't
  exist for non-string values.

  2. Several values are false-ish, so they get removed from the results
  even without the aggressive argument. If the intent of this #compact
  method is to only remove null/undefined in lazy mode, Prototype.K
  won't work. Returning  to the select() comparison ends up false, so
   gets dropped.

  Suggested:
  compact(aggressive){
    return this.select(aggressive === true ?
      function(v){return v != null  v.toString().strip() != ''} :
      function(v){return v !== null  v !== undefined}
    )

  }

  The adjustment ensures that the intent of only stripping null and
  undefined remains intact, since so many values can evaluate to false-
  ish (, 0, [], etc). And mentioning zero, what if there's desire to
  be super-aggressive and remove those, or also remove actual boolean
  falses? :)
  -joe t.

  On Nov 13, 8:07 am, Eric lefauv...@gmail.com wrote:

   Hi Jacopo,

   On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote:

Hi Eric,
thanks for your suggests!
Well, now I answer all of your questions ;)
- I named Element.ajaxRequest() in that way because by default it
updates the element, but you can change the onSuccess function!

   OK, but if you don't change the element in the onSuccess, there is no
   point using this method instead of Ajax.Request.

- I've written String#len and String#getType because some newbies may
not knows that attributes ;)

   Well, you must not forget that every single byte you add to the
   library will be loaded by every single page using the library.
   Peoples are already complaining because prototype is big, so if we
   start to add useless things, it will be worst.
   Moreover, newbies should better learn about length and the DOM
   attributes instead of some exotic name not portable (and slower)
   methods

- I've re-written Array#compact: now the control is not recursive

   It wasn't recursive, it was slow :o)

   But still, return value != null is the same than return value (at
   least when passed to Enumerable.select) and it is exactly what
   Prototype.K function does.

(thanks)

Here is the code:http://tr.im/EBEPtheArray#comapctstartsat at
line 128

Which methods do you suggest me to propose??

   Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your
   change to Array.compact sounds like useful features to me.

   Eric

Thanks,
Jacopo.

On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote:

 Hi,

 This has some nice ideas like Element.ajaxRequest() (which I would
 have called Element.ajaxUpdate() since it is what it does :o) ), but
 also some features I fail to see any utility to.
 I.E., what's the point to use 'string'.len() instead of
 'string'.length?
 Same thing for $('someElement').getType() instead of $
 ('someElement').nodeName

 Also, try to limit the impact on 

[Proto-Scripty] Re: loop effects?

2009-11-14 Thread Hugo Nieto

Hi, i think its a good one, and if u just wanna put a simple effect
that works fine.

On Nov 14, 1:36 am, patrick patrick99...@gmail.com wrote:
 hi,

 Is the best way to loop an effect to just do:

 setInterval(function() {

   new Effect.pulsate('my_div', {duration: 1})

 }, 1000);

 ?

 -patrick

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: why does this not work?

2009-11-14 Thread patrick

 I don't see anywhere that a's `to_execute` property is set,

ah yeah, that was a typo..  That should have been

initialize: function() {
new b(this.future_func)
},

Thanks for the links..  doing new b(this.future_func.bind(this))
worked perfect!

-patrick



On Nov 14, 6:56 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 There are a couple of problems there, not least that I don't see
 anywhere that a's `to_execute` property is set, so as far as I can see
 b would get an undefined value. Did you mean `do_something`?

 But I suspect that's a copy-and-paste error. The basic problem is that
 you're passing a function without any context. Functions are just
 functions, the `this` value does not follow them around as it (seems
 to) in some other languages. In JavaScript, `this` is set purely by
 how you *call* a function. There are several ways to deal with that,
 including Prototype's Function#bind[1].

 I wrote up a full description of this issue[2] in my blog a while
 back.

 [1]http://api.prototypejs.org/language/function.html#bind-instance_method
 [2]http://blog.niftysnippets.org/2008/03/mythical-methods.html

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Nov 14, 8:06 am, patrick patrick99...@gmail.com wrote:

  Can anyone explain this to me?   It appears to be a scope issue where
  my_a no longer is set to the instantiated class 'a' once it gets
  executed in class 'b's initialize method...  How is the best way to
  get around this?

  thanks.

  -patrick

  document.observe(dom:loaded, function() {
    var test = new a;

  });

  var a = (function() {

          var a = Class.create({

                  initialize: function() {
                          new b(this.to_execute)
                  },

                  do_something: function() {
                          console.log('it has been done!');
                  },

                  future_func: function() {
                          var my_a = this;
                          my_a.do_something();
                  }
          });

          return a;

  })();

  var b = (function() {

          var b = Class.create({

                  initialize: function(func) {
                          func();
                  }
          });

          return b;

  })();


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] scriptaculous animation loop position is buggy

2009-11-14 Thread patrick

I've always noticed that occasionally when doing effects, the browser
flickers or does funky stuff..  Yesterday I started writing my own
visual effect using scriptaculous' engine, and I have been having a
lot of problems.

Basically what I am finding is that the animation loop's position
variable is not a smooth transition from 0.0 to 1.0, and this has been
the source of all my frustrations.  See, what I am trying to do is
cycle through an array of colors, transitioning from one to the next,
and I was hoping I could just multiply the position variable by the
number of colors in the array and then whenever a whole number is hit,
it would change to the next color

This will not work..  Neither will simply doing a color check to see
if the current color has reached it's color destination..  And it all
comes back to the position variable being weird...

I am doing basically new_pos = position - Math.floor(position), so
that I can detect when the new_pos = 1, then it should change to the
new color..  However...  If you look at my log when trying to change
from ['#ff', '#00ff00', '#ff', '#00']

(position) ---(new_pos)
...etc...
0.8762930095412139 - 0.8762930095412139
0.9245239398860153 - 0.9245239398860153
0.9734630272614679 - 0.9734630272614679
1.0237947520904933 - 0.02379475209049331
changing current_color to: #00ff00
changing dest_color to: #ff
1.1224026769972542 - 0.12240267699725416
changing current_color to: #ff
changing dest_color to: #00
1.2081348640123648 - 0.2081348640123648
1.2513958157578204 - 0.25139581575782044
1.3042107116699224 - 0.3042107116699224
1.3572737826319323 - 0.3572737826319323
etc...


Everything was perfect from red to green, and then from green to blue,
it got one frame in, and then the position variable jumped up to
something over 1, and it skipped to the next color.

If I run the code again, it will not do the same thing though it will
be inconsistent in some other way.

... can anyone shed some light on this problem, and how I can fix
it???

Here is my code...

new Effect('blah', {sequence: ['#ff', '#00ff00', '#ff',
'#00'], duration: 3 })

Effect.Glow = Class.create();
Object.extend(Object.extend(Effect.Glow.prototype,
Effect.Base.prototype), {
initialize: function(element) {
this.element = $(element);

if (!this.element) {
throw(Effect._elementDoesNotExistError);
}

var options = Object.extend({'css': 'color'}, 
arguments[1] || {});

this.start(options);
},

setup: function() {
// Prevent executing on elements not in the layout flow
if (this.element.getStyle('display') == 'none') {
this.cancel();
return;
}

// glow params to_glow can be either string or array of 
css styles
this.to_glow = (typeof(this.options.css) == 'string') ?
[ this.options.css.camelize() ] : this.options.css.map(function(e)
{ return e.camelize() });

// store the original style values before changing 
them...
this.original_style = Object.clone(this.element.style);

this.multiple = this.options.sequence.length - 1;
this.sequence_index = 0;
this.setBaseDelta();
},

setBaseDelta: function() {
this.frame_target = (this.totalFrames /
this.options.sequence.length) * (this.sequence_index + 1);
console.log('changing current_olor to: ' + 
this.options.sequence
[this.sequence_index]);
this.color = 
this.options.sequence[this.sequence_index].parseColor
();
this.dest_color = 
this.options.sequence[this.sequence_index +=
1].parseColor();
console.log('changing dest_color to: ' + 
this.options.sequence
[this.sequence_index]);

this._base = $R(0,2).map(function(i){
return 
parseInt(this.color.parseColor().slice(i*2+1, i*2+3), 16);
}.bind(this));

this._delta = $R(0,2).map(function(i){
return parseInt(this.dest_color.slice(i*2+1, 
i*2+3), 16) -
this._base[i];
}.bind(this));
},

update: function(position) {

var new_pos = (position * this.multiple);

if (this.sequence_index  this.multiple  new_pos = 
1) {
this.setBaseDelta();
}
console.log(new_pos + ' - ' + (parseInt(new_pos)));
   

[Proto-Scripty] Re: scriptaculous animation loop position is buggy

2009-11-14 Thread patrick

Well, I seem to have found a work around..  Instead of multiplying the
position by the number of colors, I divide the duration by the number
of colors, and then on the finish callback, I restart the effect, so
that it's always just doing an effect from one color to the other.  It
seems to work fine this way.

-patrick

On Nov 14, 11:39 am, patrick patrick99...@gmail.com wrote:
 I've always noticed that occasionally when doing effects, the browser
 flickers or does funky stuff..  Yesterday I started writing my own
 visual effect using scriptaculous' engine, and I have been having a
 lot of problems.

 Basically what I am finding is that the animation loop's position
 variable is not a smooth transition from 0.0 to 1.0, and this has been
 the source of all my frustrations.  See, what I am trying to do is
 cycle through an array of colors, transitioning from one to the next,
 and I was hoping I could just multiply the position variable by the
 number of colors in the array and then whenever a whole number is hit,
 it would change to the next color

 This will not work..  Neither will simply doing a color check to see
 if the current color has reached it's color destination..  And it all
 comes back to the position variable being weird...

 I am doing basically new_pos = position - Math.floor(position), so
 that I can detect when the new_pos = 1, then it should change to the
 new color..  However...  If you look at my log when trying to change
 from ['#ff', '#00ff00', '#ff', '#00']

 (position) ---(new_pos)
 ...etc...
 0.8762930095412139 - 0.8762930095412139
 0.9245239398860153 - 0.9245239398860153
 0.9734630272614679 - 0.9734630272614679
 1.0237947520904933 - 0.02379475209049331
 changing current_color to: #00ff00
 changing dest_color to: #ff
 1.1224026769972542 - 0.12240267699725416
 changing current_color to: #ff
 changing dest_color to: #00
 1.2081348640123648 - 0.2081348640123648
 1.2513958157578204 - 0.25139581575782044
 1.3042107116699224 - 0.3042107116699224
 1.3572737826319323 - 0.3572737826319323
 etc...

 Everything was perfect from red to green, and then from green to blue,
 it got one frame in, and then the position variable jumped up to
 something over 1, and it skipped to the next color.

 If I run the code again, it will not do the same thing though it will
 be inconsistent in some other way.

 ... can anyone shed some light on this problem, and how I can fix
 it???

 Here is my code...

 new Effect('blah', {sequence: ['#ff', '#00ff00', '#ff',
 '#00'], duration: 3 })

         Effect.Glow = Class.create();
         Object.extend(Object.extend(Effect.Glow.prototype,
         Effect.Base.prototype), {
                 initialize: function(element) {
                         this.element = $(element);

                         if (!this.element) {
                                 throw(Effect._elementDoesNotExistError);
                         }

                         var options = Object.extend({'css': 'color'}, 
 arguments[1] || {});

                         this.start(options);
                 },

                 setup: function() {
                         // Prevent executing on elements not in the layout 
 flow
                     if (this.element.getStyle('display') == 'none') {
                                 this.cancel();
                                 return;
                         }

                         // glow params to_glow can be either string or array 
 of css styles
                         this.to_glow = (typeof(this.options.css) == 'string') 
 ?
 [ this.options.css.camelize() ] : this.options.css.map(function(e)
 { return e.camelize() });

                         // store the original style values before changing 
 them...
                         this.original_style = 
 Object.clone(this.element.style);

                         this.multiple = this.options.sequence.length - 1;
                         this.sequence_index = 0;
                         this.setBaseDelta();
                 },

                 setBaseDelta: function() {
                         this.frame_target = (this.totalFrames /
 this.options.sequence.length) * (this.sequence_index + 1);
                         console.log('changing current_olor to: ' + 
 this.options.sequence
 [this.sequence_index]);
                         this.color = 
 this.options.sequence[this.sequence_index].parseColor
 ();
                         this.dest_color = 
 this.options.sequence[this.sequence_index +=
 1].parseColor();
                         console.log('changing dest_color to: ' + 
 this.options.sequence
 [this.sequence_index]);

                         this._base = $R(0,2).map(function(i){
                                 return 
 parseInt(this.color.parseColor().slice(i*2+1, i*2+3), 16);
                         }.bind(this));

                         this._delta = $R(0,2).map(function(i){
                                 return 

[Proto-Scripty] Re: loop effects?

2009-11-14 Thread Alex McAuley

All the effects have an afterFinish property - so you could just 
functionise the effect and call itself again after finish ..
Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Hugo Nieto hugofabian...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Saturday, November 14, 2009 3:59 PM
Subject: [Proto-Scripty] Re: loop effects?



Hi, i think its a good one, and if u just wanna put a simple effect
that works fine.

On Nov 14, 1:36 am, patrick patrick99...@gmail.com wrote:
 hi,

 Is the best way to loop an effect to just do:

 setInterval(function() {

 new Effect.pulsate('my_div', {duration: 1})

 }, 1000);

 ?

 -patrick




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---