Add the menu button to threads in the catalog.
This commit is contained in:
parent
99f4f14c47
commit
60e89e3f28
@ -444,6 +444,12 @@ a[href="javascript:;"] {
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
}
|
||||
.catalog-thread > a:not(:hover) .menu-button {
|
||||
display: none;
|
||||
}
|
||||
.thread-icons > .menu-button > i {
|
||||
font-size: 14px;
|
||||
}
|
||||
.thread-stats {
|
||||
flex-shrink: 0;
|
||||
cursor: help;
|
||||
|
||||
@ -2,35 +2,46 @@ Menu =
|
||||
init: ->
|
||||
return if g.VIEW is 'catalog' or !Conf['Menu']
|
||||
|
||||
a = $.el 'a',
|
||||
className: 'menu-button'
|
||||
innerHTML: '[<i></i>]'
|
||||
href: 'javascript:;'
|
||||
@frag = $.nodes [$.tn(' '), a]
|
||||
|
||||
@menu = new UI.Menu 'post'
|
||||
Post.callbacks.push
|
||||
name: 'Menu'
|
||||
cb: @node
|
||||
CatalogThread.callbacks.push
|
||||
name: 'Image Hover'
|
||||
cb: @catalogNode
|
||||
|
||||
node: ->
|
||||
if @isClone
|
||||
$.on $('.menu-button', @nodes.info), 'click', Menu.toggle
|
||||
return
|
||||
$.add @nodes.info, Menu.makeButton()
|
||||
catalogNode: ->
|
||||
menuButton = $.el 'a',
|
||||
className: 'menu-button'
|
||||
innerHTML: '<i class="fa fa-bars"></i>'
|
||||
href: 'javascript:;'
|
||||
$.on menuButton, 'click', Menu.toggle
|
||||
$.add @nodes.icons, menuButton
|
||||
|
||||
makeButton: do ->
|
||||
frag = null
|
||||
->
|
||||
unless frag
|
||||
a = $.el 'a',
|
||||
className: 'menu-button'
|
||||
innerHTML: '[<i></i>]'
|
||||
href: 'javascript:;'
|
||||
frag = $.nodes [$.tn(' '), a]
|
||||
clone = frag.cloneNode true
|
||||
$.on clone.lastElementChild, 'click', Menu.toggle
|
||||
clone
|
||||
makeButton: ->
|
||||
clone = Menu.frag.cloneNode true
|
||||
$.on clone.lastElementChild, 'click', Menu.toggle
|
||||
clone
|
||||
|
||||
toggle: (e) ->
|
||||
try
|
||||
# Posts, inlined posts, hidden replies.
|
||||
post = Get.postFromNode @
|
||||
catch
|
||||
# Hidden threads.
|
||||
post = Get.threadFromNode(@).OP
|
||||
post = if fullID = @parentNode.parentNode.parentNode.dataset.fullID
|
||||
g.threads[fullID].OP
|
||||
else
|
||||
# Hidden threads.
|
||||
Get.threadFromNode(@).OP
|
||||
Menu.menu.toggle e, @, post
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user