I'm trying to include cluetip in my GreaseMonkey script. To do this I've defined my userscript as follows:
// ==UserScript==
// @name myscript
// @namespace myscript
// @description This is my script
// @require http://plugins.learningjquery.com/cluetip/jquery.cluetip.js
// @require http://plugins.learningjquery.com/cluetip/jquery.bgiframe.min.js
// @require http://plugins.learningjquery.com/cluetip/jquery.hoverIntent.js
// @resource jquery.cluetip.css http://plugins.learningjquery.com/cluetip/jquery.cluetip.css
// @include http://mysite.com/*
// ==/UserScript==
(function(){
function GM_init() {
if(typeof unsafeWindow.jQuery == 'undefined') {
window.setTimeout(GM_wait,100);
} else {
jQuery_init(unsafeWindow.jQuery);
}
}
GM_init();
function jQuery_init($) {
$('a.testTitle').cluetip({splitTitle: '|'});
}
})();
When I import the script it seems to import fine and my config.xml ends up with this entry:
<Script filename="myscript.user.js" name="myscript namespace="myscript" description="This is my script" enabled="true" basedir="myscript">
<Include>http://mysite.com/*</Include>
<Require filename="jquerycluetip.js"/>
<Require filename="jquerybgiframemin.js"/>
<Require filename="jqueryhoverintent.js"/>
<Resource name="jquery.cluetip.css" filename="jquerycluetip.css" mimetype="text/css"/>
</Script>
After the script is installed I see the referenced requires and resources have been downloaded and renamed as per the entries in the myscript folder.
When I load the page myscript does not run. I've tried restarting Firefox, uninstalling and reinstalling the script and setting alerts to ensure the script isn't running. I'm at a loss as to what's wrong. Does anybody have a solution?
For information, JQuery is already included in the page, so I don't need to require it. If I remove all the cluetip entries from config.xml, remove the function call, restart Firefox and just try modifying the link with standard JQuery everything works fine.
Note: I tried adding JQuery to the @Require list as well. This means my script loads, but fails on the first cluetip function call.