Greasemonkey Jquery Interference?
Solution 1:
Greasemonkey 1.0, radically changed the way the sandbox works, busting thousands of scripts. See also, jQuery in Greasemonkey 1.0 conflicts with websites using jQuery.
This is a huge problem, and the lead developer of Greasemonkey has expressed a complete unwillingness to resolve it in a sensible way.
To work around it, restore the sandbox to your script, and resolve the $
conflict, by editing your Metadata Block to end with the following lines:
// @grant GM_addStyle// ==/UserScript==/*- The @grant directive is needed to work around a major design change introduced in GM 1.0,
It restores the sandbox.
*/
Specifying a @grant
value (other than none
) reactivates the sandbox.
You might also consider switching to Scriptish, which has offered superior features and performance in the past, and does not suffer from this new sandbox behavior.
Scriptish, so far, hasn't posted updates that destroy a large portion of its install base, either.
Solution 2:
You need to include jQuery only if it isn't already included. So you need to make the first line check. If it is included run the script if it isn't included add like line to include it and then loop the checking function. Something like this:
var wrote = false,
runScript = function(){
if(typeof(jQuery) === 'undefined'){
if(!wrote){
wrote = true;
document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>');
}
setTimeout(runScript, 50);
}else{
//your script goes here
}
};
runScript();
Only problem would be is if google's jquery isn't up.
Post a Comment for "Greasemonkey Jquery Interference?"