diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 819e6cb85..eb1302a16 100755 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -41,7 +41,7 @@ Main = # set up CSS when is completely loaded $.asap (-> doc = d.documentElement), -> - $.onExists doc, 'body', Main.initStyle + $.onExists doc, 'body', false, Main.initStyle initFeatures: -> switch location.hostname diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index 24db901d5..a4c9cd601 100755 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -114,15 +114,14 @@ $.asap = (test, cb) -> else setTimeout $.asap, 25, test, cb -$.onExists = (root, selector, cb) -> +$.onExists = (root, selector, subtree, cb) -> if el = $ selector, root return cb el observer = new MutationObserver -> if el = $ selector, root observer.disconnect() cb el - observer.observe root, - childList: true + observer.observe root, {childList: true, subtree} $.addStyle = (css, id, test) -> style = $.el 'style', diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index b9b123aa3..46496054d 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -30,7 +30,10 @@ QR = Header.addShortcut sc if Conf['Hide Original Post Form'] - $.asap (-> doc), -> $.addClass doc, 'hide-original-post-form' + $.addClass doc, 'hide-original-post-form' + if !doc.dataset.jsEnabled + # Prevent unnecessary loading of fallback iframe. + $.onExists doc, '#postForm noscript', true, $.rm $.on d, '4chanXInitFinished', @initReady