Rearrange some stuff, fix ThreadUpdater.disconnect
This commit is contained in:
parent
18d3d6b6e9
commit
3327c9cf36
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -325,10 +325,15 @@ Main =
|
||||
|
||||
clean: ->
|
||||
{posts, threads} = g
|
||||
|
||||
# Garbage collection
|
||||
delete posts[id] for id of posts when posts.hasOwnProperty id
|
||||
delete threads[id] for id of threads when threads.hasOwnProperty id
|
||||
|
||||
disconnect: (view) ->
|
||||
# Delete nodes
|
||||
$.rmAll $ '.board'
|
||||
|
||||
disconnect: ->
|
||||
if g.VIEW is 'thread'
|
||||
features = [
|
||||
['Thread Updater', ThreadUpdater]
|
||||
@ -351,11 +356,6 @@ Main =
|
||||
# Post.callbacks.clear()
|
||||
# Thread.callbacks.clear()
|
||||
|
||||
# Clean the board, as we'll be dumping shit here
|
||||
# $.rmAll $ '.board'
|
||||
|
||||
g.VIEW = view
|
||||
|
||||
navigate: (e) ->
|
||||
return if @hostname isnt 'boards.4chan.org'
|
||||
# Lets have a good idea of what we should we should be expecting for this kind of feature
|
||||
@ -374,14 +374,15 @@ Main =
|
||||
view or 'index' # path is "/boardID/". See the problem?
|
||||
|
||||
if view isnt g.VIEW
|
||||
Main.disconnect()
|
||||
Main.clean()
|
||||
Main.disconnect view
|
||||
g.VIEW = view
|
||||
|
||||
if view is 'index'
|
||||
Main.updateBoard boardID unless boardID is g.BOARD.ID
|
||||
|
||||
if Index.root
|
||||
Index.connect.call Index
|
||||
Index.connect()
|
||||
else
|
||||
Index.update()
|
||||
|
||||
|
||||
@ -62,14 +62,10 @@ ThreadUpdater =
|
||||
cb: @node
|
||||
|
||||
disconnect: ->
|
||||
if Conf['Updater and Stats in Header']
|
||||
Header.rmShortcut @dialog
|
||||
else
|
||||
$.rmClass doc, 'float'
|
||||
$.rm @dialog
|
||||
|
||||
$.off @timer, 'click', @update
|
||||
$.off @status, 'click', @update
|
||||
|
||||
clearTimeout @timeoutID if @timeoutID
|
||||
|
||||
for entry in @entry.subEntries
|
||||
{el} = entry
|
||||
@ -83,12 +79,18 @@ ThreadUpdater =
|
||||
$.off d, 'QRPostSuccessful', @cb.checkpost
|
||||
$.off d, 'visibilitychange', @cb.visibility
|
||||
|
||||
@set 'timer', null
|
||||
@set 'status', 'Offline'
|
||||
|
||||
$.event 'rmMenuEntry', @entry
|
||||
|
||||
@set 'timer', null
|
||||
@set 'status', 'Offline', 'warning'
|
||||
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']
|
||||
delete @[name] for name in ['checkPostCount', 'timer', 'status', 'isUpdating', 'entry', 'dialog', 'thread', 'root', 'lastPost', 'outdateCount', 'online', 'seconds', 'timeoutID']
|
||||
|
||||
Thread.callbacks.rm 'Thread Updater'
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user