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