tl;dr
Don't use exotic dynamic injection of external libraries in Userscript. @require
them instead.
Original Question
I am trying to modify this page with the following script:
console.log("run");
!function(){var e=document.createElement("SCRIPT")
e.src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js",e.type="text/javascript",document.getElementsByTagName("head")[0].appendChild(e)
var t=function(e){window.jQuery?e(jQuery):window.setTimeout(function(){t(e)},100)}
t(function(e){e(".title").children().each(function(){this.href="/"+this.href.split("'")[1]})})}()
The script works fine from the console (try it), transforming window-open links to URL href
s. However, the same script in Tampermonkey does not work (and the debug line shows in the console, indicating that the script is indeed running):
These are the settings for the particular script:
What am I doing wrong? How can I make the script work from Tampermonkey?
After checking syntax (see comments):
Changing some commas to semicolons --- this is a mess.