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: ->
|
clean: ->
|
||||||
{posts, threads} = g
|
{posts, threads} = g
|
||||||
|
|
||||||
|
# Garbage collection
|
||||||
delete posts[id] for id of posts when posts.hasOwnProperty id
|
delete posts[id] for id of posts when posts.hasOwnProperty id
|
||||||
delete threads[id] for id of threads when threads.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'
|
if g.VIEW is 'thread'
|
||||||
features = [
|
features = [
|
||||||
['Thread Updater', ThreadUpdater]
|
['Thread Updater', ThreadUpdater]
|
||||||
@ -351,11 +356,6 @@ Main =
|
|||||||
# Post.callbacks.clear()
|
# Post.callbacks.clear()
|
||||||
# Thread.callbacks.clear()
|
# Thread.callbacks.clear()
|
||||||
|
|
||||||
# Clean the board, as we'll be dumping shit here
|
|
||||||
# $.rmAll $ '.board'
|
|
||||||
|
|
||||||
g.VIEW = view
|
|
||||||
|
|
||||||
navigate: (e) ->
|
navigate: (e) ->
|
||||||
return if @hostname isnt 'boards.4chan.org'
|
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
|
# 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?
|
view or 'index' # path is "/boardID/". See the problem?
|
||||||
|
|
||||||
if view isnt g.VIEW
|
if view isnt g.VIEW
|
||||||
|
Main.disconnect()
|
||||||
Main.clean()
|
Main.clean()
|
||||||
Main.disconnect view
|
g.VIEW = view
|
||||||
|
|
||||||
if view is 'index'
|
if view is 'index'
|
||||||
Main.updateBoard boardID unless boardID is g.BOARD.ID
|
Main.updateBoard boardID unless boardID is g.BOARD.ID
|
||||||
|
|
||||||
if Index.root
|
if Index.root
|
||||||
Index.connect.call Index
|
Index.connect()
|
||||||
else
|
else
|
||||||
Index.update()
|
Index.update()
|
||||||
|
|
||||||
|
|||||||
@ -62,14 +62,10 @@ ThreadUpdater =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
disconnect: ->
|
disconnect: ->
|
||||||
if Conf['Updater and Stats in Header']
|
|
||||||
Header.rmShortcut @dialog
|
|
||||||
else
|
|
||||||
$.rmClass doc, 'float'
|
|
||||||
$.rm @dialog
|
|
||||||
|
|
||||||
$.off @timer, 'click', @update
|
$.off @timer, 'click', @update
|
||||||
$.off @status, 'click', @update
|
$.off @status, 'click', @update
|
||||||
|
|
||||||
|
clearTimeout @timeoutID if @timeoutID
|
||||||
|
|
||||||
for entry in @entry.subEntries
|
for entry in @entry.subEntries
|
||||||
{el} = entry
|
{el} = entry
|
||||||
@ -83,12 +79,18 @@ ThreadUpdater =
|
|||||||
$.off d, 'QRPostSuccessful', @cb.checkpost
|
$.off d, 'QRPostSuccessful', @cb.checkpost
|
||||||
$.off d, 'visibilitychange', @cb.visibility
|
$.off d, 'visibilitychange', @cb.visibility
|
||||||
|
|
||||||
|
@set 'timer', null
|
||||||
|
@set 'status', 'Offline'
|
||||||
|
|
||||||
$.event 'rmMenuEntry', @entry
|
$.event 'rmMenuEntry', @entry
|
||||||
|
|
||||||
@set 'timer', null
|
if Conf['Updater and Stats in Header']
|
||||||
@set 'status', 'Offline', 'warning'
|
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'
|
Thread.callbacks.rm 'Thread Updater'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user