DISQUS

DISQUS Hello! Life is grand is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

jQuery and GreaseMonkey

Started by paulmwatson · 10 months ago

jQuery is a fantastic piece of JavaScript and is fast replacing prototype in my projects. I’d like it to go beyond that though. I want it to be a library I can call on any website I am visiting, whether the site has it loaded or not.

GreaseMonkey seems the logical way to do this. I [...] ... Continue reading »

7 comments

  • Same trick we use in CPhog:

    var theScript = document.createElement("script");
    theScript.src = "http://jquery.com/src/latest.js";
    theScript.language = "javascript";
    document.body.insertBefore(theScript, document.body.firstChild);

    :)

    I even opened up Firebug to try it out...it works. :)
  • Hey David,

    > theScript.src = “http://jquery.com/src/latest.js”;

    including jQuery directly from John's server is something you should avoid. Though it was recommened in the jQuery tutorial, it could produce quite a lot of traffic and therefore costs for John.

    On the other hand, it should be no problem to simply include a local copy of jQuery. AFAIK the "lastest" version isn't currently updated anymore.
  • Yeah. That's actually a better idea. It was kinda late last night when I wrote that. ;)

    Another thing that breaks-ish is that if you include all sites with that user script, then secure sites won't be marked as secure because some items aren't secured.
  • Or you could roll your own greasemonkey xpi with jquery added in. then you could reference it through the chrome:// interface afforded to firefox. Same technique you just don't have to rely on the jquery server.
  • Or... (duh) put a copy of jQuery inside a greasemonkey script set to run on all pages...

    Install the user script and you're set...
  • I tried that out Blair and it didn't work. Is there a special trick to getting it to work?

    Good idea on the XPI though, I'll give that a bash and save the servers.
  • In case you didn't get around to xpi fiddling, I just modified a greamonkey xpi to include a copy of jquery. I don't know if it works but I'll host it at http://jquery.offput.ca/greasemonkey-0.6.4-fx.xpi for anyone willing to try.

Add New Comment

Returning? Login