enable keybinds on catalog

This commit is contained in:
ccd0 2014-04-26 22:51:48 -07:00
parent 02620f9567
commit e1ff987c1e

View File

@ -1,6 +1,6 @@
Keybinds =
init: ->
return if g.VIEW is 'catalog' or !Conf['Keybinds']
return if !Conf['Keybinds']
for hotkey of Conf.hotkeys
$.sync hotkey, Keybinds.sync
@ -21,9 +21,10 @@ Keybinds =
{target} = e
if target.nodeName in ['INPUT', 'TEXTAREA']
return unless /(Esc|Alt|Ctrl|Meta|Shift\+\w{2,})/.test key
threadRoot = Nav.getThread()
if op = $ '.op', threadRoot
thread = Get.postFromNode(op).thread
unless g.VIEW is 'catalog'
threadRoot = Nav.getThread()
if op = $ '.op', threadRoot
thread = Get.postFromNode(op).thread
switch key
# QR & Options
when Conf['Toggle board list']
@ -32,9 +33,10 @@ Keybinds =
when Conf['Toggle header']
Header.toggleBarVisibility()
when Conf['Open empty QR']
Keybinds.qr threadRoot
Keybinds.qr()
when Conf['Open QR']
Keybinds.qr threadRoot, true
return if g.VIEW is 'catalog'
Keybinds.qr threadRoot
when Conf['Open settings']
Settings.open()
when Conf['Close']
@ -72,17 +74,23 @@ Keybinds =
when 'index'
if Conf['JSON Navigation'] then Index.update()
when Conf['Watch']
return if g.VIEW is 'catalog'
ThreadWatcher.toggle thread
# Images
when Conf['Expand image']
return if g.VIEW is 'catalog'
Keybinds.img threadRoot
when Conf['Expand images']
return if g.VIEW is 'catalog'
Keybinds.img threadRoot, true
when Conf['Open Gallery']
return if g.VIEW is 'catalog'
Gallery.cb.toggle()
when Conf['fappeTyme']
return if g.VIEW is 'catalog'
FappeTyme.cb.toggle.call {name: 'fappe'}
when Conf['werkTyme']
return if g.VIEW is 'catalog'
FappeTyme.cb.toggle.call {name: 'werk'}
# Board Navigation
when Conf['Front page']
@ -109,6 +117,7 @@ Keybinds =
if form = $ '.prev form'
window.location = form.action
when Conf['Search form']
return unless g.VIEW is 'index'
searchInput = if Conf['JSON Navigation'] then Index.searchInput else $.id('search-box')
Header.scrollToIfNeeded searchInput
searchInput.focus()
@ -125,23 +134,32 @@ Keybinds =
return if g.VIEW isnt 'index'
Nav.scroll -1
when Conf['Expand thread']
return if g.VIEW isnt 'index'
ExpandThread.toggle thread
when Conf['Open thread']
return if g.VIEW isnt 'index'
Keybinds.open thread
when Conf['Open thread tab']
return if g.VIEW isnt 'index'
Keybinds.open thread, true
# Reply Navigation
when Conf['Next reply']
return if g.VIEW is 'catalog'
Keybinds.hl +1, threadRoot
when Conf['Previous reply']
return if g.VIEW is 'catalog'
Keybinds.hl -1, threadRoot
when Conf['Deselect reply']
return if g.VIEW is 'catalog'
Keybinds.hl 0, threadRoot
when Conf['Hide']
return if g.VIEW is 'catalog'
ThreadHiding.toggle thread if ThreadHiding.db
when Conf['Previous Post Quoting You']
return if g.VIEW is 'catalog'
QuoteYou.cb.seek 'preceding'
when Conf['Next Post Quoting You']
return if g.VIEW is 'catalog'
QuoteYou.cb.seek 'following'
else
return
@ -176,10 +194,10 @@ Keybinds =
if e.shiftKey then key = 'Shift+' + key
key
qr: (thread, quote) ->
qr: (thread) ->
return unless Conf['Quick Reply'] and QR.postingIsEnabled
QR.open()
if quote
if thread?
QR.quote.call $ 'input', $('.post.highlight', thread) or thread
QR.nodes.com.focus()
if Conf['QR Shortcut']