I want to load an external library (jQuery) into my .user.js
script, to modify the CSS of an existing site. Now i am using $script to load external libraries, but it doesn't work.
On the other hand it would be also good to load external CSS files to modify the page, but I don't know how to do that. How can I modify the CSS easily with .user.js
? How can I load external JS libraries?
This is my userscript at pastebin.com.
UPDATE:
I want to write a script or load a CSS which automatically modify the page look.
I tried to load the jQuery library with $script micro library but it doesn't work, because Chrome disables AJAX communication in the .user.js
.
If you don't mind taking Chrome Extension route then all problems you describing can be solved very easily without any extra coding, just with manifest file:
{
"name": "My extension",
...
"content_scripts": [
{
"matches": ["http://www.google.com/*"],
"css": ["mystyles.css"],
"js": ["jquery.js", "myscript.js"]
}
],
...
}
It will automatically inject jquery and css along with your script to domains you specified.