jQuery & greasemonkey while being considerate to John's bandwidth

February 27, 2008 Pivotal Labs

Here is a slight modification to Joan Piedra’s jQuery greasemonkey script that loads the jQuery library on any page you visit. This gives you the power of jQuery when using Firebug or Greasemonkey. Here is an example of its usage.

var jQueryDefinition = (function() {/*jQuery library*/});
var GM_JQ = document.createElement('script');

GM_JQ.innerHTML = '(' + jQueryDefinition.toString() + ')();';
GM_JQ.type = 'text/javascript';

Here is the full script.
Here is the userscrips page.

Make sure that the jquery.user.js script is loaded before any other dependent Greasemonkey scripts.

The difference is you can put the jQuery library into the script itself. This causes the page to load faster and does not use up John Resig’s bandwidth. Unfortunately, this also means you will need to manually upgrade your greasemonkey script when the next version of jQuery comes out.

[Update] Edited the Greasemonkey script to make jQuery compatible with other js libraries.
[Update] Pointing to userscripts.org

About the Author


Firebug Makes…
Firebug Makes…

And you thought it helped us be more productive, ha!

Can less leave the screen alone when it quits?
Can less leave the screen alone when it quits?

From the less faq: blah blah blah ti/te blah blah blah -X blah blah. Also, -R makes it show ANSI c...

SpringOne 2021

Register Now