Add pin/hide/show thread menu entries for the catalog.
Conflicts: src/General/Index.coffee src/General/Main.coffee src/Images/AutoGIF.coffee
This commit is contained in:
parent
78ea850517
commit
18b343671d
@ -81,7 +81,7 @@ ThreadHiding =
|
|||||||
el: div
|
el: div
|
||||||
order: 20
|
order: 20
|
||||||
open: ({thread, isReply}) ->
|
open: ({thread, isReply}) ->
|
||||||
if isReply or thread.isHidden
|
if isReply or thread.isHidden or Conf['Index Mode'] is 'catalog'
|
||||||
return false
|
return false
|
||||||
ThreadHiding.menu.thread = thread
|
ThreadHiding.menu.thread = thread
|
||||||
true
|
true
|
||||||
|
|||||||
@ -142,6 +142,42 @@ Index =
|
|||||||
new Notice 'info', "Last page reached.", 2
|
new Notice 'info', "Last page reached.", 2
|
||||||
setTimeout reset, 3 * $.SECOND
|
setTimeout reset, 3 * $.SECOND
|
||||||
|
|
||||||
|
menu:
|
||||||
|
init: ->
|
||||||
|
return if g.VIEW isnt 'index' or !Conf['Menu'] or g.BOARD.ID is 'f'
|
||||||
|
|
||||||
|
Menu.menu.addEntry
|
||||||
|
el: $.el 'a', href: 'javascript:;'
|
||||||
|
order: 5
|
||||||
|
open: ({thread}) ->
|
||||||
|
return false if Conf['Index Mode'] isnt 'catalog'
|
||||||
|
@el.textContent = if thread.isHidden
|
||||||
|
'Show thread'
|
||||||
|
else
|
||||||
|
'Hide thread'
|
||||||
|
$.off @el, 'click', @cb if @cb
|
||||||
|
@cb = ->
|
||||||
|
$.event 'CloseMenu'
|
||||||
|
Index.toggleHide thread
|
||||||
|
$.on @el, 'click', @cb
|
||||||
|
true
|
||||||
|
|
||||||
|
Menu.menu.addEntry
|
||||||
|
el: $.el 'a', href: 'javascript:;'
|
||||||
|
order: 6
|
||||||
|
open: ({thread}) ->
|
||||||
|
return false if Conf['Index Mode'] isnt 'catalog'
|
||||||
|
@el.textContent = if thread.isPinned
|
||||||
|
'Unpin thread'
|
||||||
|
else
|
||||||
|
'Pin thread'
|
||||||
|
$.off @el, 'click', @cb if @cb
|
||||||
|
@cb = ->
|
||||||
|
$.event 'CloseMenu'
|
||||||
|
Index.togglePin thread
|
||||||
|
$.on @el, 'click', @cb
|
||||||
|
true
|
||||||
|
|
||||||
threadNode: ->
|
threadNode: ->
|
||||||
return unless data = Index.db.get {boardID: @board.ID, threadID: @ID}
|
return unless data = Index.db.get {boardID: @board.ID, threadID: @ID}
|
||||||
@pin() if data.isPinned
|
@pin() if data.isPinned
|
||||||
@ -149,17 +185,16 @@ Index =
|
|||||||
$.on @nodes.thumb, 'click', Index.onClick
|
$.on @nodes.thumb, 'click', Index.onClick
|
||||||
onClick: (e) ->
|
onClick: (e) ->
|
||||||
return if e.button isnt 0
|
return if e.button isnt 0
|
||||||
root = @parentNode.parentNode
|
thread = g.threads[@parentNode.parentNode.dataset.fullID]
|
||||||
thread = g.threads[root.dataset.fullID]
|
|
||||||
if e.shiftKey
|
if e.shiftKey
|
||||||
Index.toggleHide thread, root
|
Index.toggleHide thread
|
||||||
else if e.altKey
|
else if e.altKey
|
||||||
Index.togglePin thread
|
Index.togglePin thread
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
toggleHide: (thread, root) ->
|
toggleHide: (thread) ->
|
||||||
$.rm root
|
$.rm thread.catalogView.nodes.root
|
||||||
if Index.showHiddenThreads
|
if Index.showHiddenThreads
|
||||||
ThreadHiding.show thread
|
ThreadHiding.show thread
|
||||||
return unless ThreadHiding.db.get {boardID: thread.board.ID, threadID: thread.ID}
|
return unless ThreadHiding.db.get {boardID: thread.board.ID, threadID: thread.ID}
|
||||||
@ -483,7 +518,7 @@ Index =
|
|||||||
# Sticky threads
|
# Sticky threads
|
||||||
Index.sortOnTop (thread) -> thread.isSticky
|
Index.sortOnTop (thread) -> thread.isSticky
|
||||||
# Highlighted threads
|
# Highlighted threads
|
||||||
Index.sortOnTop((thread) -> thread.isOnTop) if Conf['Filter']
|
Index.sortOnTop (thread) -> thread.isOnTop
|
||||||
# Non-hidden threads
|
# Non-hidden threads
|
||||||
Index.sortOnTop((thread) -> !thread.isHidden) if Conf['Anchor Hidden Threads']
|
Index.sortOnTop((thread) -> !thread.isHidden) if Conf['Anchor Hidden Threads']
|
||||||
|
|
||||||
|
|||||||
@ -295,6 +295,7 @@ Main =
|
|||||||
['Strike-through Quotes', QuoteStrikeThrough]
|
['Strike-through Quotes', QuoteStrikeThrough]
|
||||||
['Quick Reply', QR]
|
['Quick Reply', QR]
|
||||||
['Menu', Menu]
|
['Menu', Menu]
|
||||||
|
['Index Generator (Menu)', Index.menu]
|
||||||
['Report Link', ReportLink]
|
['Report Link', ReportLink]
|
||||||
['Thread Hiding (Menu)', ThreadHiding.menu]
|
['Thread Hiding (Menu)', ThreadHiding.menu]
|
||||||
['Reply Hiding (Menu)', PostHiding.menu]
|
['Reply Hiding (Menu)', PostHiding.menu]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user