So I've been able to get Greasemonkey and jQuery 1.2.6 to work together without issue, but, now I'm wondering how to embed additional jQuery plugins into my Greasemonkey script, such as Eric Martin's SimpleModal plugin (http://www.ericmmartin.com/projects/simplemodal/).
The following code gets jQuery loaded, but I'm not sure how to get SimpleModal loaded properly:
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
var GM_JQ_SM = document.createElement('script');
GM_JQ_SM.src = 'http://simplemodal.googlecode.com/files/jquery.simplemodal-1.2.2.min.js';
GM_JQ_SM.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ_SM);
// Check if jQuery's loaded
function GM_wait() {
if(typeof unsafeWindow.jQuery == 'undefined') {
window.setTimeout(GM_wait,100);
}
else {
$ = unsafeWindow.jQuery;
}
}
GM_wait();
Anyone have any ideas? Thanks.