Add index refresh shortcut in the header bar.

Also fix lazy/lame implementation of Header.addShortcut()
This commit is contained in:
Mayhem 2013-10-31 00:55:45 +01:00
parent 66ebbd87f0
commit c2984275e5
4 changed files with 11 additions and 5 deletions

View File

@ -257,11 +257,10 @@ Header =
addShortcut: (el, index) ->
shortcut = $.el 'span',
className: 'shortcut'
shortcut.dataset.index = index
$.add shortcut, el
shortcuts = $ '#shortcuts', Header.bar
nodes = [shortcuts.childNodes...]
nodes.splice index, 0, shortcut
$.add shortcuts, nodes
$.add shortcuts, [shortcuts.childNodes...].concat(shortcut).sort (a, b) -> a.dataset.index - b.dataset.index
menuToggle: (e) ->
Header.menu.toggle e, @, g

View File

@ -7,7 +7,7 @@ ImageExpand =
title: 'Expand All Images'
href: 'javascript:;'
$.on @EAI, 'click', ImageExpand.cb.toggleAll
Header.addShortcut @EAI, 2
Header.addShortcut @EAI, 3
Post.callbacks.push
name: 'Image Expansion'

View File

@ -2,6 +2,13 @@ Index =
init: ->
return if g.VIEW isnt 'index'
button = $.el 'a',
className: 'index-refresh-shortcut fa fa-refresh'
title: 'Refresh Index'
href: 'javascript:;'
$.on button, 'click', Index.update
Header.addShortcut button, 1
subEntries = []
subEntry =

View File

@ -26,7 +26,7 @@ QR =
$.event 'CloseMenu'
QR.open()
QR.nodes.com.focus()
Header.addShortcut sc, 1
Header.addShortcut sc, 2
$.on d, 'QRGetSelectedPost', ({detail: cb}) ->
cb QR.selected