Re: [jQuery] Best practices for reattaching behaviours to dynamically loaded content?

2007-03-05 Thread Nicolas Hoizey
I keep all my behaviours in separate functions. For instance if I had a fancy table widget I'd have a function called initTable() that contained the behaviour code. I'd call it initially upon page load, then call it again when necessary if content has been updated via ajax. [...]

Re: [jQuery] Safari Crashing

2007-03-05 Thread Nicolas Hoizey
It's a tricky line to balance. We either get to replace 1.1.2 and cause some possible confusion with Safari issues (for users who upgraded very quickly) or push out 1.1.3 and cause more confusion having two releases occur in just a couple hours. Where would be the confusion if the changelog

Re: [jQuery] Running a function when something changes...

2007-03-01 Thread Nicolas Hoizey
Untested, but reading the code I assume this would work: $(#something).ajaxSuccess(fn); function fn(r, s) { $(this).unbind(ajaxSuccess); // do what you want, then rebind $(this).ajaxSuccess(fn); } It seems unbind doesn't work on ajaxSuccess or ajaxStop... Still didn't find how to

[jQuery] Running a function when something changes...

2007-02-23 Thread Nicolas Hoizey
In a page that gets modified by ajax calls, I would like to run my own function after each change. My function does ajax calls, so if I use the ajaxSuccess binding, it goes recursively and crash... Any idea? -Nicolas -- Nicolas Brush HOIZEY Clever Age : http://www.clever-age.com/

Re: [jQuery] Running a function when something changes...

2007-02-23 Thread Nicolas Hoizey
You can use ajaxSuccess but go ahead and take advantage of the settings object. Something like: $().ajaxSuccess(function(e, xhr, settings) { if (settings.myTag) return; // do your extra work and call ajax $.ajax({ myTag: 1, url: blah.php, type: 'post'

Re: [jQuery] Running a function when something changes...

2007-02-23 Thread Nicolas Hoizey
$().ready(function(){ $().ajaxStart($.blockUI).ajaxStop($.unblockUI); }); Maybe ajaxStop is better than ajaxSuccess for my needs, but I don't need to block the UI. -Nicolas -- Nicolas Brush HOIZEY Clever Age : http://www.clever-age.com/ Gastero Prod : http://www.gasteroprod.com/ Photos

Re: [jQuery] Running a function when something changes...

2007-02-23 Thread Nicolas Hoizey
Untested, but reading the code I assume this would work: $(#something).ajaxSuccess(fn); function fn(r, s) { $(this).unbind(ajaxSuccess); // do what you want, then rebind $(this).ajaxSuccess(fn); } It seems unbind doesn't work on ajaxSuccess or ajaxStop... -Nicolas -- Nicolas

Re: [jQuery] How to customize already existing events?

2007-02-20 Thread Nicolas Hoizey
var select = $('[EMAIL PROTECTED] myselect]'); var cachedOnChange = select[0].onchange; I get the onchange in a function, great! select[0].onchange = null; What is the difference between this and unbind('change') or removeAttr ('onchange')? I just found that althrough it works like you

Re: [jQuery] How to customize already existing events?

2007-02-20 Thread Nicolas Hoizey
var select = $('[EMAIL PROTECTED] myselect]'); var cachedOnChange = select[0].onchange; I get the onchange in a function, great! select[0].onchange = null; What is the difference between this and unbind('change') or removeAttr ('onchange')? I just found that althrough it works like

Re: [jQuery] Select elements without specific children

2007-02-20 Thread Nicolas Hoizey
$('li.expandable:not([a.on])') A couple things to note: 1. you don't need to repeat li.expandable inside the :not I think it is you MUST NOT repeat... ;) -Nicolas -- Nicolas Brush HOIZEY Clever Age : http://www.clever-age.com/ Gastero Prod : http://www.gasteroprod.com/ Photos :

Re: [jQuery] How to customize already existing events?

2007-02-12 Thread Nicolas Hoizey
No idea? Le 9 févr. 07 à 10:07, Nicolas Hoizey a écrit : Hello, Let's say I have the folowing code I can't change (it's not mine) : select name=myselect onchange=this.nextSibling.visibility='hidden'; option value=1One/option option value=2Two/option /select How can I put

Re: [jQuery] How to customize already existing events?

2007-02-12 Thread Nicolas Hoizey
I think you don't have to use eval..., I'd try this: var select = $('[EMAIL PROTECTED] myselect]'); var cachedOnChange = select[0].onchange; I get the onchange in a function, great! select[0].onchange = null; What is the difference between this and unbind('change') or removeAttr

Re: [jQuery] How to customize already existing events?

2007-02-12 Thread Nicolas Hoizey
select.bind('change', function() { if (confirm('Are you sure?')) { cachedOnChange(); The function uses 'this', which is not available anymore when I call it... I did this: select.onchange = cachedOnChange; select.onchange(); And it seems to work well! I'm not sure there are

[jQuery] How to customize already existing events?

2007-02-09 Thread Nicolas Hoizey
Hello, Let's say I have the folowing code I can't change (it's not mine) : select name=myselect onchange=this.nextSibling.visibility='hidden'; option value=1One/option option value=2Two/option /select How can I put my own change event handler, but being able to run the

Re: [jQuery] Embedding jQuery in a Greasemonkey script

2007-02-05 Thread Nicolas Hoizey
Nicolas emailed me, and I felt it was somewhat my duty/ responsibility to get jQuery to work in greasemonkey again, so here it is! jQuery 1.1.1 -- http://userscripts.org/scripts/show/7373 It works so well, thank you a lot! Could you just explain here what you did, so that everyone can

Re: [jQuery] Embedding jQuery in a Greasemonkey script

2007-02-05 Thread Nicolas Hoizey
In order to get jQuery to work with greasemonkey, the document.ready() code needs to be removed. This is ok because by the time greasemonkey is run, the page has already finished loading so we do not need this event to be called. Find below the code removed from jQ 1.1.1 Thanks! -Nicolas

Re: [jQuery] rewriting the browser address (without refresh)?

2007-02-02 Thread Nicolas Hoizey
I'm wondering if there is a way to rewrite the url in the browser bar without refreshing the page. You can only modify the anchor (after the #), as it is done by some Ajax and Flash sites. -Nicolas -- Nicolas Brush HOIZEY Clever Age : http://www.clever-age.com/ Gastero Prod :

Re: [jQuery] Embedding jQuery in a Greasemonkey script

2007-01-31 Thread Nicolas Hoizey
I right, or do you authorize such bandwidth abuse? -Nicolas On 1/30/07, Nicolas Hoizey [EMAIL PROTECTED] wrote: Hello, I want to improve some of my Greasemonkey scripts by using jQuery instead of traditionnal JS. I tried to load the library during execution[1] and it didn't work

Re: [jQuery] Embedding jQuery in a Greasemonkey script

2007-01-31 Thread Nicolas Hoizey
I would guess that the best way would be to pack the jQuery source into the greasemonkey xpi and access it using the chrome URI interface somehow. I have very limited experience with firefox extensions but that would seem to be the best way in terms of bandwidth and in terms of

Re: [jQuery] Embedding jQuery in a Greasemonkey script

2007-01-31 Thread Nicolas Hoizey
of bandwidth and in terms of usability (you wouldn't need to add a dynamic script load to every page load just to use jQuery in your user scripts) -blair Nicolas Hoizey wrote: Hello Joan, Yes, I remember the threads talking about this, and I was curious about it. After some days I figured out

Re: [jQuery] Embedding jQuery in a Greasemonkey script

2007-01-31 Thread Nicolas Hoizey
maybe you could insert jquery by adding a generated script element to the head and setting its source to a data uri [1] containing the jquery code? ok, i've tested it. it basically works, but firefox crashes after one or two reloads :/ I tried also, and it crashes also! :(

[jQuery] Embedding jQuery in a Greasemonkey script

2007-01-30 Thread Nicolas Hoizey
Hello, I want to improve some of my Greasemonkey scripts by using jQuery instead of traditionnal JS. I tried to load the library during execution[1] and it didn't work as intended. It was loaded from jquery.com, so I didn't want it anyway. I can't load it from my host either. I found a