Remove dependence on 4chanMainInit event.
This commit is contained in:
parent
5fc2e7946f
commit
a0e98250b2
@ -39,7 +39,13 @@ Main =
|
|||||||
$.extend Conf, items
|
$.extend Conf, items
|
||||||
$.asap (-> doc = d.documentElement), Main.initFeatures
|
$.asap (-> doc = d.documentElement), Main.initFeatures
|
||||||
|
|
||||||
$.on d, '4chanMainInit', Main.initStyle
|
# set up CSS when <head> is completely loaded
|
||||||
|
$.asap (-> d.documentElement), ->
|
||||||
|
observer = new MutationObserver ->
|
||||||
|
if d.body
|
||||||
|
observer.disconnect()
|
||||||
|
Main.initStyle()
|
||||||
|
observer.observe d.documentElement, childList: true
|
||||||
|
|
||||||
initFeatures: ->
|
initFeatures: ->
|
||||||
switch location.hostname
|
switch location.hostname
|
||||||
@ -86,7 +92,6 @@ Main =
|
|||||||
$.ready Main.initReady
|
$.ready Main.initReady
|
||||||
|
|
||||||
initStyle: ->
|
initStyle: ->
|
||||||
$.off d, '4chanMainInit', Main.initStyle
|
|
||||||
return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x'
|
return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x'
|
||||||
# disable the mobile layout
|
# disable the mobile layout
|
||||||
$('link[href*=mobile]', d.head)?.disabled = true
|
$('link[href*=mobile]', d.head)?.disabled = true
|
||||||
@ -128,9 +133,6 @@ Main =
|
|||||||
Redirect.navigate href, "/#{g.BOARD}/"
|
Redirect.navigate href, "/#{g.BOARD}/"
|
||||||
return
|
return
|
||||||
|
|
||||||
# Something might have gone wrong!
|
|
||||||
Main.initStyle()
|
|
||||||
|
|
||||||
# 4chan Pass Link
|
# 4chan Pass Link
|
||||||
if styleSelector = $.id 'styleSelector'
|
if styleSelector = $.id 'styleSelector'
|
||||||
passLink = $.el 'a',
|
passLink = $.el 'a',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user