diff --git a/4chan_x.user.js b/4chan_x.user.js index 90dd26b25..462cae0d8 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -406,7 +406,7 @@ style = $.el('style', { textContent: css }); - $.add(d.head, style); + $.add(d.head || d.documentElement, style); return style; }, x: function(path, root) { @@ -5044,7 +5044,7 @@ if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) { Main.css += '#postForm { display: none; }'; } - Main.addStyle(); + $.addStyle(Main.css); now = Date.now(); if (Conf['Check for Updates'] && $.get('lastUpdate', 0) < now - 6 * $.HOUR) { $.ready(function() { @@ -5253,14 +5253,6 @@ Conf[parent] = obj; } }, - addStyle: function() { - $.off(d, 'DOMNodeInserted', Main.addStyle); - if (d.head) { - return $.addStyle(Main.css); - } else { - return $.on(d, 'DOMNodeInserted', Main.addStyle); - } - }, message: function(e) { var version; version = e.data.version; diff --git a/script.coffee b/script.coffee index f17f59756..8c012aa78 100644 --- a/script.coffee +++ b/script.coffee @@ -315,7 +315,8 @@ $.extend $, addStyle: (css) -> style = $.el 'style', textContent: css - $.add d.head, style + # XXX Only Chrome has no d.head on document-start. + $.add d.head or d.documentElement, style style x: (path, root=d.body) -> # XPathResult.ANY_UNORDERED_NODE_TYPE is 8 @@ -4031,7 +4032,7 @@ Main = if Conf['Quick Reply'] and Conf['Hide Original Post Form'] Main.css += '#postForm { display: none; }' - Main.addStyle() + $.addStyle Main.css now = Date.now() if Conf['Check for Updates'] and $.get('lastUpdate', 0) < now - 6*$.HOUR @@ -4214,13 +4215,6 @@ Main = Conf[parent] = obj return - addStyle: -> - $.off d, 'DOMNodeInserted', Main.addStyle - if d.head - $.addStyle Main.css - else # XXX fox - $.on d, 'DOMNodeInserted', Main.addStyle - message: (e) -> {version} = e.data if version and version isnt Main.version and confirm 'An updated version of 4chan X is available, would you like to install it now?'