Remove dependence on 4chanMainInit event.

This commit is contained in:
ccd0 2014-12-20 13:53:05 -08:00
parent 5fc2e7946f
commit a0e98250b2

View File

@ -39,7 +39,13 @@ Main =
$.extend Conf, items
$.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: ->
switch location.hostname
@ -86,7 +92,6 @@ Main =
$.ready Main.initReady
initStyle: ->
$.off d, '4chanMainInit', Main.initStyle
return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x'
# disable the mobile layout
$('link[href*=mobile]', d.head)?.disabled = true
@ -128,9 +133,6 @@ Main =
Redirect.navigate href, "/#{g.BOARD}/"
return
# Something might have gone wrong!
Main.initStyle()
# 4chan Pass Link
if styleSelector = $.id 'styleSelector'
passLink = $.el 'a',