Add ability to clear whole thread watcher

Adds the ability to clear the whole thread watcher via a menu item
This commit is contained in:
Jeff Sandberg 2021-02-05 18:33:10 -07:00
parent a52860494e
commit 981675dce9
No known key found for this signature in database
GPG Key ID: 8298889FE3FA639C

View File

@ -126,6 +126,11 @@ ThreadWatcher =
for a in $$ 'a[title]', ThreadWatcher.list
$.open a.href
$.event 'CloseMenu'
clear: ->
for {siteID, boardID, threadID} in ThreadWatcher.getAll()
ThreadWatcher.db.delete {siteID, boardID, threadID}
ThreadWatcher.refresh()
$.event 'CloseMenu'
pruneDeads: ->
return if $.hasClass @, 'disabled'
for {siteID, boardID, threadID, data} in ThreadWatcher.getAll() when data.isDead
@ -605,6 +610,13 @@ ThreadWatcher =
@el.classList.toggle 'disabled', !ThreadWatcher.list.firstElementChild
true
entries.push
text: 'Clear all threads'
cb: ThreadWatcher.cb.clear
open: ->
@el.classList.toggle 'disabled', !ThreadWatcher.list.firstElementChild
true
# `Prune dead threads` entry
entries.push
text: 'Prune dead threads'