Update unread count in thread watcher as posts are read.
This commit is contained in:
parent
259d28385e
commit
b656e6d690
@ -290,6 +290,25 @@ ThreadWatcher =
|
||||
Index.sort()
|
||||
Index.buildIndex()
|
||||
|
||||
update: (boardID, threadID, newData) ->
|
||||
return unless data = ThreadWatcher.db?.get {boardID, threadID}
|
||||
if newData.isDead and Conf['Auto Prune']
|
||||
ThreadWatcher.db.delete {boardID, threadID}
|
||||
ThreadWatcher.refresh()
|
||||
return
|
||||
n = 0
|
||||
n++ for key, val of newData when data[key] isnt val
|
||||
return unless n
|
||||
ThreadWatcher.db.forceSync()
|
||||
return unless data = ThreadWatcher.db.get {boardID, threadID}
|
||||
$.extend data, newData
|
||||
ThreadWatcher.db.set {boardID, threadID, val: data}
|
||||
if line = $ "#watched-threads > [data-full-i-d='#{boardID}.#{threadID}']", ThreadWatcher.dialog
|
||||
newLine = ThreadWatcher.makeLine boardID, threadID, data
|
||||
$.replace line, newLine
|
||||
else
|
||||
ThreadWatcher.refresh()
|
||||
|
||||
toggle: (thread) ->
|
||||
boardID = thread.board.ID
|
||||
threadID = thread.ID
|
||||
|
||||
@ -219,6 +219,11 @@ Unread =
|
||||
Unread.title
|
||||
d.title = "#{titleQuotingYou}#{titleCount}#{titleDead}"
|
||||
|
||||
ThreadWatcher.update Unread.thread.board.ID, Unread.thread.ID,
|
||||
isDead: Unread.thread.isDead
|
||||
unread: count
|
||||
quotingYou: countQuotingYou
|
||||
|
||||
return unless Conf['Unread Favicon']
|
||||
|
||||
Favicon.el.href =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user