We don't need DOMNodeInserted to add the main stylesheet anymore.

This commit is contained in:
Nicolas Stepien 2012-09-13 01:35:21 +02:00
parent 0e40b115a3
commit db3a3fbc2b
2 changed files with 5 additions and 19 deletions

View File

@ -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;

View File

@ -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?'