Prevent adding custom CSS multiple times.
This commit is contained in:
parent
7cdd342bd0
commit
f1ef4b6c3c
@ -114,11 +114,11 @@ $.asap = (test, cb) ->
|
|||||||
else
|
else
|
||||||
setTimeout $.asap, 25, test, cb
|
setTimeout $.asap, 25, test, cb
|
||||||
|
|
||||||
$.addStyle = (css, id) ->
|
$.addStyle = (css, id, test) ->
|
||||||
style = $.el 'style',
|
style = $.el 'style',
|
||||||
id: id
|
id: id
|
||||||
textContent: css
|
textContent: css
|
||||||
$.asap (-> d.head), ->
|
$.asap (-> d.head and (!test? or test())), ->
|
||||||
$.add d.head, style
|
$.add d.head, style
|
||||||
style
|
style
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,7 @@ CustomCSS =
|
|||||||
return unless Conf['Custom CSS']
|
return unless Conf['Custom CSS']
|
||||||
@addStyle()
|
@addStyle()
|
||||||
addStyle: ->
|
addStyle: ->
|
||||||
$.asap (-> $.id 'fourchanx-css'), =>
|
@style = $.addStyle Conf['usercss'], 'custom-css', -> $.id 'fourchanx-css'
|
||||||
@style = $.addStyle Conf['usercss'], 'custom-css'
|
|
||||||
rmStyle: ->
|
rmStyle: ->
|
||||||
if @style
|
if @style
|
||||||
$.rm @style
|
$.rm @style
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user