DISQUS

Life is grand: jQuery and GreaseMonkey

  • David Stone · 3 years ago
    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. :)
  • Jörn · 3 years ago
    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.
  • David Stone · 3 years ago
    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.
  • Blair Mitchelmore · 3 years ago
    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.
  • Blair Mitchelmore · 3 years ago
    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...
  • Paul Watson · 3 years ago
    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.
  • Blair Mitchelmore · 3 years ago
    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.