Add a menu item to open unread in ThreadWatcher

This commit is contained in:
Jeff Sandberg 2021-02-25 12:27:37 -07:00
parent a52860494e
commit 93e9510fe5
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'
openUnread: ->
return if $.hasClass @, 'disabled'
for a in $$ '.replies-unread a[title]', ThreadWatcher.list
$.open a.href
$.event 'CloseMenu'
pruneDeads: ->
return if $.hasClass @, 'disabled'
for {siteID, boardID, threadID, data} in ThreadWatcher.getAll() when data.isDead
@ -605,6 +610,14 @@ ThreadWatcher =
@el.classList.toggle 'disabled', !ThreadWatcher.list.firstElementChild
true
# `Open Unread` entry
entries.push
text: 'Open unread threads'
cb: ThreadWatcher.cb.openUnread
open: ->
@el.classList.toggle 'disabled', !$('.replies-unread', ThreadWatcher.list)
true
# `Prune dead threads` entry
entries.push
text: 'Prune dead threads'