function GM_addStyle_from_file(fileName) {
var head = document.head
, link = document.createElement("link")
link.type = "text/css"
link.rel = "stylesheet"
link.href = fileName
head.appendChild(link)
}
function GM_addStyle_from_string(str) {
var node = document.createElement('style');
node.innerHTML = str;
document.body.appendChild(node);
}
Example usage:
GM_addStyle_from_file("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.base.css");
GM_addStyle_from_string (
".embeddedImgContainer {" +
"background: "+imgContainerBackgroundColor+";" +
"}" +
".embeddedImgAnchor {"+
"display: inline-block;"+
"}"
)