Optimize Menu.makeButton().
This commit is contained in:
parent
6574e4aa95
commit
be8371d4c6
@ -168,7 +168,7 @@ PostHiding =
|
||||
className: 'stub'
|
||||
$.add post.nodes.stub, a
|
||||
if Conf['Menu']
|
||||
$.add post.nodes.stub, [$.tn(' '), Menu.makeButton()]
|
||||
$.add post.nodes.stub, Menu.makeButton()
|
||||
$.prepend post.nodes.root, post.nodes.stub
|
||||
|
||||
show: (post, showRecursively=Conf['Recursive Hiding']) ->
|
||||
|
||||
@ -124,7 +124,7 @@ ThreadHiding =
|
||||
thread.stub = $.el 'div',
|
||||
className: 'stub'
|
||||
if Conf['Menu']
|
||||
$.add thread.stub, [a, $.tn(' '), Menu.makeButton()]
|
||||
$.add thread.stub, [a, Menu.makeButton()]
|
||||
else
|
||||
$.add thread.stub, a
|
||||
$.prepend root, thread.stub
|
||||
|
||||
@ -9,22 +9,22 @@ Menu =
|
||||
|
||||
node: ->
|
||||
if @isClone
|
||||
button = $ '.menu-button', @nodes.info
|
||||
$.on button, 'click', Menu.toggle
|
||||
$.on $('.menu-button', @nodes.info), 'click', Menu.toggle
|
||||
return
|
||||
button = Menu.makeButton()
|
||||
$.add @nodes.info, [$.tn('\u00A0'), button]
|
||||
$.add @nodes.info, Menu.makeButton()
|
||||
|
||||
makeButton: do ->
|
||||
a = null
|
||||
frag = null
|
||||
->
|
||||
a or= $.el 'a',
|
||||
className: 'menu-button'
|
||||
innerHTML: '[<i></i>]'
|
||||
href: 'javascript:;'
|
||||
button = a.cloneNode true
|
||||
$.on button, 'click', Menu.toggle
|
||||
button
|
||||
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
|
||||
|
||||
toggle: (e) ->
|
||||
try
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user