Fix and tweak watcher updater after an index refresh.

This commit is contained in:
Mayhem 2013-11-01 15:59:33 +01:00
parent 7e8fd31733
commit c8f7eef912
2 changed files with 8 additions and 8 deletions

View File

@ -169,9 +169,9 @@ Index =
if Conf['Index Mode'] is 'paged'
pageNum = +window.location.pathname.split('/')[2]
nodesPerPage = Index.threadsNumPerPage * 2
nodes = Index.sortedNodes.slice nodesPerPage * pageNum, nodesPerPage * (pageNum + 1)
nodes = Index.sortedNodes.slice nodesPerPage * pageNum, nodesPerPage * (pageNum + 1)
else
nodes = Index.sortedNodes
nodes = Index.sortedNodes
$.event 'IndexRefresh'
$.rmAll Index.root
$.add Index.root, nodes

View File

@ -74,14 +74,14 @@ ThreadWatcher =
else if Conf['Auto Watch Reply']
ThreadWatcher.add board.threads[threadID]
onIndexRefresh: ->
{db} = ThreadWatcher
for threadID, data of db.data.boards[g.BOARD.ID] when threadID not in g.BOARD.threads
{db} = ThreadWatcher
boardID = g.BOARD.ID
for threadID, data of db.data.boards[boardID] when not data.isDead and threadID not of g.BOARD.threads
if Conf['Auto Prune']
ThreadWatcher.rm g.BOARD.ID, threadID
ThreadWatcher.db.delete {boardID, threadID}
else
data.isDead = true
db.data.lastChecked = Date.now()
db.save()
ThreadWatcher.db.set {boardID, threadID, val: data}
ThreadWatcher.refresh()
onThreadRefresh: (e) ->
{thread} = e.detail
@ -114,7 +114,7 @@ ThreadWatcher =
ThreadWatcher.status.textContent = status
return if @status isnt 404
if Conf['Auto Prune']
ThreadWatcher.rm boardID, threadID
ThreadWatcher.db.delete {boardID, threadID}
else
data.isDead = true
ThreadWatcher.db.set {boardID, threadID, val: data}