diff --git a/4chan_x.user.js b/4chan_x.user.js index 405870105..f2f16f26c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -190,7 +190,7 @@ d = document; - doc = d.documentElement; + doc = null; g = { VERSION: '3.0.0', @@ -5835,9 +5835,6 @@ } Misc.clearThreads("yourPosts." + g.BOARD); this.syncYourPosts(); - if (Conf['Hide Original Post Form']) { - $.addClass(doc, 'hide-original-post-form'); - } $.on(d, '4chanXInitFinished', this.initReady); return Post.prototype.callbacks.push({ name: 'Quick Reply', @@ -5850,6 +5847,9 @@ if (!QR.postingIsEnabled) { return; } + if (Conf['Hide Original Post Form']) { + $.addClass(doc, 'hide-original-post-form'); + } link = $.el('a', { className: 'qr-shortcut', textContent: 'Quick Reply', @@ -7364,6 +7364,11 @@ Main = { init: function() { var flatten, initFeature, key, pathname, val; + $.asap((function() { + return d.documentElement; + }), function() { + return doc = d.documentElement; + }); flatten = function(parent, obj) { var key, val; if (obj instanceof Array) { diff --git a/src/globals.coffee b/src/globals.coffee index 973ab5778..fa73113f7 100644 --- a/src/globals.coffee +++ b/src/globals.coffee @@ -4,7 +4,7 @@ return unless /^(boards|images|sys)\.4chan\.org$/.test location.hostname Conf = {} d = document -doc = d.documentElement +doc = null g = VERSION: '<%= version %>' NAMESPACE: "<%= meta.name %>." diff --git a/src/main.coffee b/src/main.coffee index 14ce5f4c6..bbf57067f 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -260,6 +260,9 @@ class Clone extends Post Main = init: -> + $.asap (-> d.documentElement), -> + doc = d.documentElement + # flatten Config into Conf # and get saved or default values flatten = (parent, obj) -> diff --git a/src/qr.coffee b/src/qr.coffee index 07d6e42a0..a2e9d0fe7 100644 --- a/src/qr.coffee +++ b/src/qr.coffee @@ -5,9 +5,6 @@ QR = Misc.clearThreads "yourPosts.#{g.BOARD}" @syncYourPosts() - if Conf['Hide Original Post Form'] - $.addClass doc, 'hide-original-post-form' - $.on d, '4chanXInitFinished', @initReady Post::callbacks.push @@ -18,6 +15,9 @@ QR = QR.postingIsEnabled = !!$.id 'postForm' return unless QR.postingIsEnabled + if Conf['Hide Original Post Form'] + $.addClass doc, 'hide-original-post-form' + link = $.el 'a', className: 'qr-shortcut' textContent: 'Quick Reply'