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.sort()
|
||||||
Index.buildIndex()
|
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) ->
|
toggle: (thread) ->
|
||||||
boardID = thread.board.ID
|
boardID = thread.board.ID
|
||||||
threadID = thread.ID
|
threadID = thread.ID
|
||||||
|
|||||||
@ -219,6 +219,11 @@ Unread =
|
|||||||
Unread.title
|
Unread.title
|
||||||
d.title = "#{titleQuotingYou}#{titleCount}#{titleDead}"
|
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']
|
return unless Conf['Unread Favicon']
|
||||||
|
|
||||||
Favicon.el.href =
|
Favicon.el.href =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user