Also avoid full Thread Watcher rebuild on removing entry.
This commit is contained in:
parent
af00c711ff
commit
4fe17ac6ef
@ -306,8 +306,7 @@ ThreadWatcher =
|
|||||||
replies = @response.posts.length-1
|
replies = @response.posts.length-1
|
||||||
isDead = !!@response.posts[0].archived
|
isDead = !!@response.posts[0].archived
|
||||||
if isDead and Conf['Auto Prune']
|
if isDead and Conf['Auto Prune']
|
||||||
ThreadWatcher.db.delete {siteID, boardID, threadID}
|
ThreadWatcher.rm siteID, boardID, threadID
|
||||||
ThreadWatcher.refresh()
|
|
||||||
return
|
return
|
||||||
|
|
||||||
return if last is data.last and isDead is data.isDead
|
return if last is data.last and isDead is data.isDead
|
||||||
@ -459,17 +458,19 @@ ThreadWatcher =
|
|||||||
ThreadWatcher.shortcut.classList.toggle className, !!$(".#{className}", ThreadWatcher.dialog)
|
ThreadWatcher.shortcut.classList.toggle className, !!$(".#{className}", ThreadWatcher.dialog)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
getLine: (siteID, boardID, threadID) ->
|
||||||
|
$ "#watched-threads > [data-site-i-d='#{siteID}'][data-full-i-d='#{boardID}.#{threadID}']", ThreadWatcher.dialog
|
||||||
|
|
||||||
update: (siteID, boardID, threadID, newData) ->
|
update: (siteID, boardID, threadID, newData) ->
|
||||||
return if not (data = ThreadWatcher.db?.get {siteID, boardID, threadID})
|
return if not (data = ThreadWatcher.db?.get {siteID, boardID, threadID})
|
||||||
if newData.isDead and Conf['Auto Prune']
|
if newData.isDead and Conf['Auto Prune']
|
||||||
ThreadWatcher.db.delete {siteID, boardID, threadID}
|
ThreadWatcher.rm siteID, boardID, threadID
|
||||||
ThreadWatcher.refresh()
|
|
||||||
return
|
return
|
||||||
n = 0
|
n = 0
|
||||||
n++ for key, val of newData when data[key] isnt val
|
n++ for key, val of newData when data[key] isnt val
|
||||||
return unless n
|
return unless n
|
||||||
ThreadWatcher.db.extend {siteID, boardID, threadID, val: newData}
|
ThreadWatcher.db.extend {siteID, boardID, threadID, val: newData}
|
||||||
if line = $ "#watched-threads > [data-site-i-d='#{siteID}'][data-full-i-d='#{boardID}.#{threadID}']", ThreadWatcher.dialog
|
if (line = ThreadWatcher.getLine siteID, boardID, threadID)
|
||||||
newLine = ThreadWatcher.makeLine siteID, boardID, threadID, data
|
newLine = ThreadWatcher.makeLine siteID, boardID, threadID, data
|
||||||
$.replace line, newLine
|
$.replace line, newLine
|
||||||
ThreadWatcher.refreshIcon()
|
ThreadWatcher.refreshIcon()
|
||||||
@ -514,7 +515,7 @@ ThreadWatcher =
|
|||||||
|
|
||||||
rm: (siteID, boardID, threadID) ->
|
rm: (siteID, boardID, threadID) ->
|
||||||
ThreadWatcher.db.delete {siteID, boardID, threadID}
|
ThreadWatcher.db.delete {siteID, boardID, threadID}
|
||||||
ThreadWatcher.refresh()
|
$.rm ThreadWatcher.getLine(siteID, boardID, threadID)
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
init: ->
|
init: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user