$.off these 4chanXInitFinished.

This commit is contained in:
Nicolas Stepien 2013-04-15 21:45:36 +02:00
parent a5deb20196
commit cf1d94876a
3 changed files with 14 additions and 3 deletions

View File

@ -8,7 +8,10 @@ class DataBoard
return unless sync
# Chrome also fires the onChanged callback on the current tab,
# so we only start syncing when we're ready.
$.on d, '4chanXInitFinished', => @sync = sync
init = =>
$.off d, '4chanXInitFinished', init
@sync = sync
$.on d, '4chanXInitFinished', init
delete: ({boardID, threadID, postID}) ->
if postID

View File

@ -297,6 +297,7 @@ Settings =
localStorage.setItem '4chan-settings', JSON.stringify settings
open: (openSection) ->
$.off d, '4chanXInitFinished', Settings.open
return if Settings.dialog
$.event 'CloseMenu'
@ -1778,11 +1779,13 @@ Keybinds =
init: ->
return if g.VIEW is 'catalog' or !Conf['Keybinds']
$.on d, '4chanXInitFinished', ->
init = ->
$.off d, '4chanXInitFinished', init
$.on d, 'keydown', Keybinds.keydown
for node in $$ '[accesskey]'
node.removeAttribute 'accesskey'
return
$.on d, '4chanXInitFinished', init
keydown: (e) ->
return unless key = Keybinds.keyCode e
@ -1999,7 +2002,10 @@ Nav =
$.on next, 'click', @next
$.add span, [prev, $.tn(' '), next]
$.on d, '4chanXInitFinished', -> $.add d.body, span
append = ->
$.off d, '4chanXInitFinished', append
$.add d.body, span
$.on d, '4chanXInitFinished', append
prev: ->
if g.VIEW is 'thread'
@ -4259,6 +4265,7 @@ ThreadWatcher =
$.delete 'AutoWatch'
ready: ->
$.off d, '4chanXInitFinished', ThreadWatcher.ready
return unless Main.isThisPageLegit()
ThreadWatcher.refresh()
$.add d.body, ThreadWatcher.dialog

View File

@ -14,6 +14,7 @@ QR =
cb: @node
initReady: ->
$.off d, '4chanXInitFinished', QR.initReady
QR.postingIsEnabled = !!$.id 'postForm'
return unless QR.postingIsEnabled