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