Greetings fellow Greasemonkeys
I can't seem to wrap my head around this conundrum and it's making me want to pull out every single strand of hair I got.
In my userscript meta data I have the following
// @require http://code.jquery.com/jquery-1.10.2.js
// @require http://code.jquery.com/ui/1.11.0/jquery-ui.js
// @resource myCss http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css
// @grant GM_addStyle
// @grant GM_getResourceText
Followed by
var cssTxt = GM_getResourceText("myCss");
GM_addStyle(cssTxt);
var input = document.createElement("button");
input.setAttribute("id", "btn1");
document.body.insertBefore(input, document.body.firstChild);
$("#btn1").button({
icons: {
primary: "ui-icon-wrench"
},
text: false
})
.click(function (event) {
alert("Hello World");
});
Why is it that the little icon on the jquery button not show up? How am I using GM_getResourceText
and GM_addStyle incorrectly
Your advise is greatly appreciated
PS: Running this code in jsFiddle yields results