remove dead feature disconnection code
This commit is contained in:
parent
efc852464f
commit
e810af22ca
@ -3,17 +3,13 @@ class Callbacks
|
|||||||
@keys = []
|
@keys = []
|
||||||
|
|
||||||
push: ({name, cb}) ->
|
push: ({name, cb}) ->
|
||||||
@connect name if @[name]
|
|
||||||
@keys.push name unless @[name]
|
@keys.push name unless @[name]
|
||||||
@[name] = cb
|
@[name] = cb
|
||||||
|
|
||||||
connect: (name) -> delete @[name].disconnected if @[name].disconnected
|
|
||||||
disconnect: (name) -> @[name].disconnected = true if @[name]
|
|
||||||
|
|
||||||
execute: (node) ->
|
execute: (node) ->
|
||||||
for name in @keys
|
for name in @keys
|
||||||
try
|
try
|
||||||
@[name].call node unless @[name].disconnected
|
@[name].call node
|
||||||
catch err
|
catch err
|
||||||
errors = [] unless errors
|
errors = [] unless errors
|
||||||
errors.push
|
errors.push
|
||||||
|
|||||||
@ -89,8 +89,3 @@ class DataBoard
|
|||||||
onSync: (data) =>
|
onSync: (data) =>
|
||||||
@data = data or boards: {}
|
@data = data or boards: {}
|
||||||
@sync?()
|
@sync?()
|
||||||
|
|
||||||
disconnect: ->
|
|
||||||
$.desync @key
|
|
||||||
delete @sync
|
|
||||||
delete @data
|
|
||||||
|
|||||||
@ -6,6 +6,3 @@ ThreadExcerpt =
|
|||||||
name: 'Thread Excerpt'
|
name: 'Thread Excerpt'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: -> d.title = Get.threadExcerpt @
|
node: -> d.title = Get.threadExcerpt @
|
||||||
disconnect: ->
|
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Thread Excerpt']
|
|
||||||
Thread.callbacks.disconnect 'Thread Excerpt'
|
|
||||||
|
|||||||
@ -34,26 +34,6 @@ ThreadStats =
|
|||||||
ThreadStats.update postCount, fileCount
|
ThreadStats.update postCount, fileCount
|
||||||
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
||||||
|
|
||||||
disconnect: ->
|
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Thread Stats']
|
|
||||||
|
|
||||||
if Conf['Updater and Stats in Header']
|
|
||||||
Header.rmShortcut @dialog
|
|
||||||
else
|
|
||||||
$.rm @dialog
|
|
||||||
|
|
||||||
clearTimeout @timeout # a possible race condition might be that this won't clear in time, but the resulting error will prevent issues anyways.
|
|
||||||
|
|
||||||
delete @timeout
|
|
||||||
delete @thread
|
|
||||||
delete @postCountEl
|
|
||||||
delete @fileCountEl
|
|
||||||
delete @pageCountEl
|
|
||||||
delete @dialog
|
|
||||||
|
|
||||||
Thread.callbacks.disconnect 'Thread Stats'
|
|
||||||
$.off d, 'ThreadUpdate', ThreadStats.onUpdate
|
|
||||||
|
|
||||||
onUpdate: (e) ->
|
onUpdate: (e) ->
|
||||||
return if e.detail[404]
|
return if e.detail[404]
|
||||||
{postCount, fileCount} = e.detail
|
{postCount, fileCount} = e.detail
|
||||||
|
|||||||
@ -63,40 +63,6 @@ ThreadUpdater =
|
|||||||
name: 'Thread Updater'
|
name: 'Thread Updater'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
|
||||||
$.off @timer, 'click', @update
|
|
||||||
$.off @status, 'click', @update
|
|
||||||
|
|
||||||
clearTimeout @timeoutID if @timeoutID
|
|
||||||
|
|
||||||
for entry in @entry.subEntries
|
|
||||||
{el} = entry
|
|
||||||
input = el.firstElementChild
|
|
||||||
$.off input, 'change', $.cb.checked
|
|
||||||
$.off input, 'change', @cb.scrollBG
|
|
||||||
$.off input, 'change', @cb.update
|
|
||||||
|
|
||||||
$.off @settings, 'click', @intervalShortcut
|
|
||||||
$.off window, 'online offline', @cb.online
|
|
||||||
$.off d, 'QRPostSuccessful', @cb.checkpost
|
|
||||||
$.off d, 'visibilitychange', @cb.visibility
|
|
||||||
|
|
||||||
@set 'timer', null
|
|
||||||
@set 'status', 'Offline'
|
|
||||||
|
|
||||||
UI.rmMenuEntry @entry
|
|
||||||
|
|
||||||
if Conf['Updater and Stats in Header']
|
|
||||||
Header.rmShortcut @dialog
|
|
||||||
else
|
|
||||||
$.rmClass doc, 'float'
|
|
||||||
$.rm @dialog
|
|
||||||
|
|
||||||
delete @[name] for name in ['checkPostCount', 'timer', 'status', 'isUpdating', 'entry', 'dialog', 'thread', 'root', 'lastPost', 'outdateCount', 'online', 'seconds', 'timeoutID']
|
|
||||||
|
|
||||||
Thread.callbacks.disconnect 'Thread Updater'
|
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
ThreadUpdater.thread = @
|
ThreadUpdater.thread = @
|
||||||
ThreadUpdater.root = @OP.nodes.root.parentNode
|
ThreadUpdater.root = @OP.nodes.root.parentNode
|
||||||
|
|||||||
@ -12,21 +12,6 @@ Unread =
|
|||||||
name: 'Unread'
|
name: 'Unread'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
|
||||||
return if g.VIEW isnt 'thread' or !Conf['Unread Count'] and !Conf['Unread Favicon'] and !Conf['Desktop Notifications']
|
|
||||||
|
|
||||||
Unread.db.disconnect()
|
|
||||||
$.rm hr if {hr} = Unread
|
|
||||||
|
|
||||||
delete @[name] for name in ['db', 'hr', 'posts', 'postsQuotingYou', 'thread', 'title', 'lastReadPost']
|
|
||||||
|
|
||||||
$.off d, '4chanXInitFinished', @ready
|
|
||||||
$.off d, 'ThreadUpdate', @onUpdate
|
|
||||||
$.off d, 'scroll visibilitychange', @read
|
|
||||||
$.off d, 'visibilitychange', @setLine if Conf['Unread Line'] and not Conf['Quote Threading']
|
|
||||||
|
|
||||||
Thread.callbacks.disconnect 'Unread'
|
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
Unread.thread = @
|
Unread.thread = @
|
||||||
Unread.title = d.title
|
Unread.title = d.title
|
||||||
|
|||||||
@ -24,19 +24,6 @@ QuoteThreading =
|
|||||||
name: 'Quote Threading'
|
name: 'Quote Threading'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
|
||||||
return unless Conf['Quote Threading'] and g.VIEW is 'thread'
|
|
||||||
input = $ 'input', @controls
|
|
||||||
$.off input, 'change', @toggle
|
|
||||||
|
|
||||||
UI.rmMenuEntry @entry
|
|
||||||
|
|
||||||
delete @enabled
|
|
||||||
delete @controls
|
|
||||||
delete @entry
|
|
||||||
|
|
||||||
Post.callbacks.disconnect 'Quote Threading'
|
|
||||||
|
|
||||||
ready: ->
|
ready: ->
|
||||||
$.off d, '4chanXInitFinished', QuoteThreading.ready
|
$.off d, '4chanXInitFinished', QuoteThreading.ready
|
||||||
QuoteThreading.force()
|
QuoteThreading.force()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user