diff --git a/4chan_x.js b/4chan_x.js index a872b27c0..cf72f8857 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -109,13 +109,6 @@ 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) { return window.open(url, "_blank"); }; @@ -232,6 +225,13 @@ return object; }; $.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) { return GM_getValue(name, config[name][0]); }, @@ -1575,7 +1575,7 @@ GM_setValue("hiddenReplies/" + g.BOARD + "/", JSON.stringify(g.hiddenReplies)); GM_setValue('lastChecked', now.toString()); } - GM_addStyle('\ + $.addStyle('\ /* dialog styling */\ div.dialog {\ border: 1px solid;\ diff --git a/script.coffee b/script.coffee index 353c2e2a4..8c906fcc8 100644 --- a/script.coffee +++ b/script.coffee @@ -43,11 +43,6 @@ if typeof GM_deleteValue is 'undefined' Number value else 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.open url, "_blank" @@ -132,6 +127,11 @@ $.extend = (object, properties) -> object $.extend $, + addStyle: (css) -> + style = document.createElement 'style' + style.type = 'text/css' + style.textContent = css + $.append d.head, style config: (name) -> GM_getValue name, config[name][0] zeroPad: (n) -> @@ -1211,7 +1211,7 @@ if lastChecked < now - 1*DAY GM_setValue("hiddenReplies/#{g.BOARD}/", JSON.stringify(g.hiddenReplies)) GM_setValue('lastChecked', now.toString()) -GM_addStyle ' +$.addStyle ' /* dialog styling */ div.dialog { border: 1px solid;