don't wait for 4chanMainInit before adding CSS
This commit is contained in:
parent
97fd782a12
commit
77af50b6c9
@ -17,6 +17,8 @@ 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) ->
|
||||||
@ -37,8 +39,6 @@ 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'
|
||||||
@ -84,8 +84,7 @@ Main =
|
|||||||
$.ready Main.initReady
|
$.ready Main.initReady
|
||||||
|
|
||||||
initStyle: ->
|
initStyle: ->
|
||||||
$.off d, '4chanMainInit', Main.initStyle
|
return if !Main.isThisPageLegit()
|
||||||
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'
|
||||||
@ -93,9 +92,13 @@ Main =
|
|||||||
$.addClass doc, if chrome? then 'blink' else 'gecko'
|
$.addClass doc, if chrome? then 'blink' else 'gecko'
|
||||||
$.addStyle Main.css
|
$.addStyle Main.css
|
||||||
|
|
||||||
Main.setClass()
|
$.on d, '4chanMainInit', 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
|
||||||
@ -127,7 +130,7 @@ Main =
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Something might have gone wrong!
|
# Something might have gone wrong!
|
||||||
Main.initStyle()
|
Main.setClass()
|
||||||
|
|
||||||
# 4chan Pass Link
|
# 4chan Pass Link
|
||||||
if styleSelector = $.id 'styleSelector'
|
if styleSelector = $.id 'styleSelector'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user