Prevent unnecessary loading of fallback iframe when Javascript is disabled.
This commit is contained in:
parent
ab40bfbe69
commit
44cd4d842a
@ -41,7 +41,7 @@ Main =
|
||||
|
||||
# set up CSS when <head> is completely loaded
|
||||
$.asap (-> doc = d.documentElement), ->
|
||||
$.onExists doc, 'body', Main.initStyle
|
||||
$.onExists doc, 'body', false, Main.initStyle
|
||||
|
||||
initFeatures: ->
|
||||
switch location.hostname
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user