Revert "don't wait for 4chanMainInit before adding CSS"

This reverts commit 77af50b6c9afa200e6b3484393928632db3760c4.
This commit is contained in:
ccd0 2014-08-24 15:18:44 -07:00
parent 450910789d
commit e330426d9b

View File

@ -17,8 +17,6 @@ Main =
if g.VIEW is 'thread' if g.VIEW is 'thread'
g.THREADID = +pathname[3] g.THREADID = +pathname[3]
Main.initStyle()
# flatten Config into Conf # flatten Config into Conf
# and get saved or default values # and get saved or default values
flatten = (parent, obj) -> flatten = (parent, obj) ->
@ -38,6 +36,8 @@ Main =
$.extend Conf, items $.extend Conf, items
Main.initFeatures() Main.initFeatures()
$.on d, '4chanMainInit', Main.initStyle
initFeatures: -> initFeatures: ->
switch location.hostname switch location.hostname
when 'a.4cdn.org' when 'a.4cdn.org'
@ -83,7 +83,8 @@ Main =
$.ready Main.initReady $.ready Main.initReady
initStyle: -> initStyle: ->
return if !Main.isThisPageLegit() $.off d, '4chanMainInit', Main.initStyle
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
$.addClass doc, 'fourchan-x', 'seaweedchan' $.addClass doc, 'fourchan-x', 'seaweedchan'
@ -91,13 +92,9 @@ Main =
$.addClass doc, if chrome? then 'blink' else 'gecko' $.addClass doc, if chrome? then 'blink' else 'gecko'
$.addStyle Main.css $.addStyle Main.css
$.on d, '4chanMainInit', Main.setClass Main.setClass()
setClass: -> setClass: ->
$.off d, '4chanMainInit', Main.setClass
return if Main.setClassRun or !Main.isThisPageLegit()
Main.setClassRun = true
if g.VIEW is 'catalog' if g.VIEW is 'catalog'
$.addClass doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace /_+/g, '-' $.addClass doc, $.id('base-css').href.match(/catalog_(\w+)/)[1].replace('_new', '').replace /_+/g, '-'
return return
@ -129,7 +126,7 @@ Main =
return return
# Something might have gone wrong! # Something might have gone wrong!
Main.setClass() Main.initStyle()
# 4chan Pass Link # 4chan Pass Link
if styleSelector = $.id 'styleSelector' if styleSelector = $.id 'styleSelector'