jQuery for IE7Pro userscripts or Greasemonkey
May20Difficulty: 




Some weeks ago I made a blog post, about IE7Pro userscripts, the Greasemonkey-like plugin for Internet Explorer 7.
I’m still deeply in love with userscripts for both IE7Pro and Greasemonkey, but what a waste of time for spending
hours on writing big userscripts with DOM javascripting to extend that “untouchable” website/webapplication.
This should be different! Why not use jQuery for IE7Pro userscripts.
The idea is to load first the jQuery script and then the userscript.
Unfortunately a javascript include script like this will not work:
//load jQuery
inc("jquery.js");
/* jsHandler.js */
function inc(filename)
{
var body = document.getElementsByTagName('body').item(0);
script = document.createElement('script');
script.src = filename;
script.type = 'text/javascript';
body.appendChild(script)
}
However, it’s still very easy to let jQuery run for userscripts.
First download the latest jQuery lib.
Incase of IE7Pro:
Rename the downloaded jQuery script to: jquery.ieuser.js and place it
in the userscript folder. (path\IEPro\userscripts).
Open the jquery.ieuser.js file and add the following comment block on the top of javascript lib file:
// ==UserScript== // @name jQuery // @namespace jQuery // @include * // ==/UserScript==
Now you can reload the jQuery file from the preferences – userscript screen in IE7Pro, and enable jQuery.
To test it, create a new userscript with the following jQuery code. As soon as it runs, you know
that you can use jQuery for every page.
// ==UserScript==
// @name Test
// @namespace Test
// @include *
// @author Lee Boonstra
// ==/UserScript==
$(document).ready(function(){
alert("jQuery in userscripts do work!");
});
Posted in javascript, jquery |DOM, / greasemonkey, / IE7PRO, / javascript, / JQuery, / userscripts
» Post your comment, there are no comments yet. »
Comments
- Pulkit Singhal
- Neil
- mike nittmann
- geniutrixone
- Mika
- Romfrosk
- steve
- shahzad
- Maurice
- Lee
- Oskar Krawczyk