GM_addStyle -> $.addStyle

This commit is contained in:
James Campos 2011-03-30 15:14:40 -07:00
parent 813606ba08
commit b891f59d51
2 changed files with 14 additions and 14 deletions

View File

@ -109,13 +109,6 @@
return value; return value;
} }
}; };
window.GM_addStyle = function(css) {
var style;
style = document.createElement('style');
style.type = 'text/css';
style.textContent = css;
return document.getElementsByTagName('head')[0].appendChild(style);
};
window.GM_openInTab = function(url) { window.GM_openInTab = function(url) {
return window.open(url, "_blank"); return window.open(url, "_blank");
}; };
@ -232,6 +225,13 @@
return object; return object;
}; };
$.extend($, { $.extend($, {
addStyle: function(css) {
var style;
style = document.createElement('style');
style.type = 'text/css';
style.textContent = css;
return $.append(d.head, style);
},
config: function(name) { config: function(name) {
return GM_getValue(name, config[name][0]); return GM_getValue(name, config[name][0]);
}, },
@ -1575,7 +1575,7 @@
GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies)); GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies));
GM_setValue('lastChecked', now.toString()); GM_setValue('lastChecked', now.toString());
} }
GM_addStyle('\ $.addStyle('\
/* dialog styling */\ /* dialog styling */\
div.dialog {\ div.dialog {\
border: 1px solid;\ border: 1px solid;\

View File

@ -43,11 +43,6 @@ if typeof GM_deleteValue is 'undefined'
Number value Number value
else else
value value
window.GM_addStyle = (css) ->
style = document.createElement 'style'
style.type = 'text/css'
style.textContent = css
document.getElementsByTagName('head')[0].appendChild style
window.GM_openInTab = (url) -> window.GM_openInTab = (url) ->
window.open url, "_blank" window.open url, "_blank"
@ -132,6 +127,11 @@ $.extend = (object, properties) ->
object object
$.extend $, $.extend $,
addStyle: (css) ->
style = document.createElement 'style'
style.type = 'text/css'
style.textContent = css
$.append d.head, style
config: (name) -> config: (name) ->
GM_getValue name, config[name][0] GM_getValue name, config[name][0]
zeroPad: (n) -> zeroPad: (n) ->
@ -1211,7 +1211,7 @@ if lastChecked < now - 1*DAY
GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)) GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies))
GM_setValue('lastChecked', now.toString()) GM_setValue('lastChecked', now.toString())
GM_addStyle ' $.addStyle '
/* dialog styling */ /* dialog styling */
div.dialog { div.dialog {
border: 1px solid; border: 1px solid;