Is it possible using scriptaculous/prototype to watch out for any happening Ajax activity, and do something like show/hide a spinner gif to indicate to the user that there is activity taking place in the backgound? Regards, Michael ------------------------------------------ Michael Roper - Web Developer WORLDWIDE ONLINE PRINTING AUST/NZ [T 08 9350 2300] [F 08 9451 6048] [E michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] [W http://www.worldwide.com.au] ------------------------------------------
I think I first saw this code on this list, and I think the Ajax.Responders code is fairly new in Prototype: Ajax.Responders.register({ onCreate: function() { if($(''busy'') && Ajax.activeRequestCount>0) Effect.Appear(''busy'',{duration:0.5,queue:''end''}); }, onComplete: function() { if($(''busy'') && Ajax.activeRequestCount==0) Effect.Fade(''busy'',{duration:0.5,queue:''end''}); } }); -----Original Message----- From: Michael Roper [mailto:michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] Sent: Sunday, December 18, 2005 8:47 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Observing Ajax Requests? Is it possible using scriptaculous/prototype to watch out for any happening Ajax activity, and do something like show/hide a spinner gif to indicate to the user that there is activity taking place in the backgound? Regards, Michael ------------------------------------------ Michael Roper - Web Developer WORLDWIDE ONLINE PRINTING AUST/NZ [T 08 9350 2300] [F 08 9451 6048] [E michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] [W http://www.worldwide.com.au] ------------------------------------------ _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Thanks Tom, that''s exactly what I was after! I didn''t think that I would have been the first to want to do this... Regards, Michael On 19/12/2005, at 1:03 PM, Tom Fakes wrote:> > I think I first saw this code on this list, and I think the > Ajax.Responders code is fairly new in Prototype: > > Ajax.Responders.register({ > onCreate: function() { > if($(''busy'') && Ajax.activeRequestCount>0) > Effect.Appear(''busy'',{duration:0.5,queue:''end''}); > }, > onComplete: function() { > if($(''busy'') && Ajax.activeRequestCount==0) > Effect.Fade(''busy'',{duration:0.5,queue:''end''}); > } > }); > > > -----Original Message----- > From: Michael Roper [mailto:michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] > Sent: Sunday, December 18, 2005 8:47 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] Observing Ajax Requests? > > Is it possible using scriptaculous/prototype to watch out for any > happening Ajax activity, and do something like show/hide a spinner gif > to indicate to the user that there is activity taking place in the > backgound? > > Regards, > > Michael > ------------------------------------------ > Michael Roper - Web Developer > WORLDWIDE ONLINE PRINTING AUST/NZ > [T 08 9350 2300] [F 08 9451 6048] > [E michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] > [W http://www.worldwide.com.au] > ------------------------------------------ > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Here''s the article on that: http://mir.aculo.us/articles/2005/11/14/ajax-activity-indicators-with- rails-0-14-3 (a bit rails specific, but can be used elsewhere, too). -Thomas Am 19.12.2005 um 06:20 schrieb Michael Roper:> Thanks Tom, that''s exactly what I was after! > > I didn''t think that I would have been the first to want to do this... > > Regards, > > Michael > > > On 19/12/2005, at 1:03 PM, Tom Fakes wrote: > >> >> I think I first saw this code on this list, and I think the >> Ajax.Responders code is fairly new in Prototype: >> >> Ajax.Responders.register({ >> onCreate: function() { >> if($(''busy'') && Ajax.activeRequestCount>0) >> Effect.Appear(''busy'',{duration:0.5,queue:''end''}); >> }, >> onComplete: function() { >> if($(''busy'') && Ajax.activeRequestCount==0) >> Effect.Fade(''busy'',{duration:0.5,queue:''end''}); >> } >> }); >> >> >> -----Original Message----- >> From: Michael Roper [mailto:michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] >> Sent: Sunday, December 18, 2005 8:47 PM >> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: [Rails-spinoffs] Observing Ajax Requests? >> >> Is it possible using scriptaculous/prototype to watch out for any >> happening Ajax activity, and do something like show/hide a spinner >> gif >> to indicate to the user that there is activity taking place in the >> backgound? >> >> Regards, >> >> Michael >> ------------------------------------------ >> Michael Roper - Web Developer >> WORLDWIDE ONLINE PRINTING AUST/NZ >> [T 08 9350 2300] [F 08 9451 6048] >> [E michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] >> [W http://www.worldwide.com.au] >> ------------------------------------------ >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Oh neat, I hadn''t noticed that either... I''d implemented something similar, as I''m sure many others have, but as my own wrapper around the Ajax.Request and Ajax.Updater calls. The only interaction issue I wanted to raise was that for Ajax.Updater calls it might make sense to be able to get the name of the div to the responder. For example, when I have some link that fires an ajax call to update an area of the screen, I put a slightly transparent overlay on top of that div while the request is happening (like the In-Place-Editor does). That seemed to me to be an enhancement on the notification to the user - as it shows exactly what area of content is being changed during the process (an Effect.Highlight afterwards didn''t seem to cover the cases I needed it too). Anyway, it looks like the responder callback doesn''t handle that (since it''s at a lower level): responder[callback].apply(responder, [request, transport, json]); Thoughts? Rahul -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Thomas Fuchs Sent: Monday, December 19, 2005 4:05 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] Observing Ajax Requests? Here''s the article on that: http://mir.aculo.us/articles/2005/11/14/ajax-activity-indicators-with- rails-0-14-3 (a bit rails specific, but can be used elsewhere, too). -Thomas Am 19.12.2005 um 06:20 schrieb Michael Roper:> Thanks Tom, that''s exactly what I was after! > > I didn''t think that I would have been the first to want to do this... > > Regards, > > Michael > > > On 19/12/2005, at 1:03 PM, Tom Fakes wrote: > >> >> I think I first saw this code on this list, and I think the >> Ajax.Responders code is fairly new in Prototype: >> >> Ajax.Responders.register({ >> onCreate: function() { >> if($(''busy'') && Ajax.activeRequestCount>0) >> Effect.Appear(''busy'',{duration:0.5,queue:''end''}); >> }, >> onComplete: function() { >> if($(''busy'') && Ajax.activeRequestCount==0) >> Effect.Fade(''busy'',{duration:0.5,queue:''end''}); >> } >> }); >> >> >> -----Original Message----- >> From: Michael Roper [mailto:michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] >> Sent: Sunday, December 18, 2005 8:47 PM >> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> Subject: [Rails-spinoffs] Observing Ajax Requests? >> >> Is it possible using scriptaculous/prototype to watch out for any >> happening Ajax activity, and do something like show/hide a spinner >> gif >> to indicate to the user that there is activity taking place in the >> backgound? >> >> Regards, >> >> Michael >> ------------------------------------------ >> Michael Roper - Web Developer >> WORLDWIDE ONLINE PRINTING AUST/NZ >> [T 08 9350 2300] [F 08 9451 6048] >> [E michael.roper-QvusXRzN0vkJY7gZg3T8ig@public.gmane.org] >> [W http://www.worldwide.com.au] >> ------------------------------------------ >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs