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
|
# set up CSS when <head> is completely loaded
|
||||||
$.asap (-> doc = d.documentElement), ->
|
$.asap (-> doc = d.documentElement), ->
|
||||||
$.onExists doc, 'body', Main.initStyle
|
$.onExists doc, 'body', false, Main.initStyle
|
||||||
|
|
||||||
initFeatures: ->
|
initFeatures: ->
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
|
|||||||
@ -114,15 +114,14 @@ $.asap = (test, cb) ->
|
|||||||
else
|
else
|
||||||
setTimeout $.asap, 25, test, cb
|
setTimeout $.asap, 25, test, cb
|
||||||
|
|
||||||
$.onExists = (root, selector, cb) ->
|
$.onExists = (root, selector, subtree, cb) ->
|
||||||
if el = $ selector, root
|
if el = $ selector, root
|
||||||
return cb el
|
return cb el
|
||||||
observer = new MutationObserver ->
|
observer = new MutationObserver ->
|
||||||
if el = $ selector, root
|
if el = $ selector, root
|
||||||
observer.disconnect()
|
observer.disconnect()
|
||||||
cb el
|
cb el
|
||||||
observer.observe root,
|
observer.observe root, {childList: true, subtree}
|
||||||
childList: true
|
|
||||||
|
|
||||||
$.addStyle = (css, id, test) ->
|
$.addStyle = (css, id, test) ->
|
||||||
style = $.el 'style',
|
style = $.el 'style',
|
||||||
|
|||||||
@ -30,7 +30,10 @@ QR =
|
|||||||
Header.addShortcut sc
|
Header.addShortcut sc
|
||||||
|
|
||||||
if Conf['Hide Original Post Form']
|
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
|
$.on d, '4chanXInitFinished', @initReady
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user