Well done, Sean! And thanks for the explanation.
I like your favicon addition to Google searches, too. I tried to post
a comment on the userscripts.org page with my compliments, but there
was something wrong with the system.
Cheers,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Feb 5, 2007, at 11:49 AM, sunsean wrote:
It works so well, thank you a lot! Could you just explain here what
you did, so that everyone can do it with future releases?
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
===================================================
--- jquery-latest.js 2007-01-21 23:42:55.000000000 -0600
+++ jquery-greasemonkey.js 2007-02-05 10:38:02.843261000 -0600
@@ -1442,53 +1442,6 @@
});
- // If Mozilla is used
- if ( jQuery.browser.mozilla || jQuery.browser.opera )
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", jQuery.ready,
false );
-
- // If IE is used, use the excellent hack by Matthias Miller
- // http://www.outofhanwell.com/blog/index.php?
title=the_window_onload_problem_revisited
- else if ( jQuery.browser.msie ) {
-
- // Only works if you document.write() it
- document.write("<scr" + "ipt id=__ie_init defer=true " +
- "src=//:><\/script>");
-
- // Use the defer script hack
- var script = document.getElementById("__ie_init");
-
- // script does not exist if jQuery is loaded dynamically
- if ( script )
- script.onreadystatechange = function() {
- if ( this.readyState != "complete" ) return;
- this.parentNode.removeChild( this );
- jQuery.ready();
- };
-
- // Clear from memory
- script = null;
-
- // If Safari is used
- } else if ( jQuery.browser.safari )
- // Continually check to see if the document.readyState is valid
- jQuery.safariTimer = setInterval(function(){
- // loaded and complete are both valid states
- if ( document.readyState == "loaded" ||
- document.readyState == "complete" ) {
-
- // If either one are found, remove the timer
- clearInterval( jQuery.safariTimer );
- jQuery.safariTimer = null;
-
- // and execute any waiting functions
- jQuery.ready();
- }
- }, 10);
-
- // A fallback to window.onload, that will always work
- jQuery.event.add( window, "load", jQuery.ready );
-
};
===================================================
// Clean up after IE to avoid memory leaks
Most likely only the same code will need to be removed in future
versions, but I will try to keep the jQuery userscript up-to-date.
~Sean
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/