use conf for keybinds
This commit is contained in:
parent
b384204219
commit
401fabb424
@ -721,26 +721,6 @@
|
||||
node = _ref[_i];
|
||||
node.removeAttribute('accesskey');
|
||||
}
|
||||
keybinds.close = $.getValue('key/close', config.hotkeys.close);
|
||||
keybinds.spoiler = $.getValue('key/spoiler', config.hotkeys.spoiler);
|
||||
keybinds.openQR = $.getValue('key/openQR', config.hotkeys.openQR);
|
||||
keybinds.openEmptyQR = $.getValue('key/openEmptyQR', config.hotkeys.openEmptyQR);
|
||||
keybinds.submit = $.getValue('key/submit', config.hotkeys.submit);
|
||||
keybinds.nextReply = $.getValue('key/nextReply', config.hotkeys.nextReply);
|
||||
keybinds.previousReply = $.getValue('key/previousReply', config.hotkeys.previousReply);
|
||||
keybinds.nextThread = $.getValue('key/nextThread', config.hotkeys.nextThread);
|
||||
keybinds.previousThread = $.getValue('key/previousThread', config.hotkeys.previousThread);
|
||||
keybinds.nextPage = $.getValue('key/nextPage', config.hotkeys.nextPage);
|
||||
keybinds.previousPage = $.getValue('key/previousPage', config.hotkeys.previousPage);
|
||||
keybinds.zero = $.getValue('key/zero', config.hotkeys.zero);
|
||||
keybinds.openThreadTab = $.getValue('key/openThreadTab', config.hotkeys.openThreadTab);
|
||||
keybinds.openThread = $.getValue('key/openThread', config.hotkeys.openThread);
|
||||
keybinds.expandThread = $.getValue('key/expandThread', config.hotkeys.expandThread);
|
||||
keybinds.watch = $.getValue('key/watch', config.hotkeys.watch);
|
||||
keybinds.hide = $.getValue('key/hide', config.hotkeys.hide);
|
||||
keybinds.expandImages = $.getValue('key/expandImages', config.hotkeys.expandImages);
|
||||
keybinds.expandAllImages = $.getValue('key/expandAllImages', config.hotkeys.expandAllImages);
|
||||
keybinds.update = $.getValue('key/update', config.hotkeys.update);
|
||||
return $.bind(d, 'keydown', keybinds.cb.keydown);
|
||||
},
|
||||
cb: {
|
||||
@ -758,14 +738,14 @@
|
||||
}
|
||||
thread = nav.getThread();
|
||||
switch (key) {
|
||||
case keybinds.close:
|
||||
case conf.close:
|
||||
if (o = $('#overlay')) {
|
||||
$.rm(o);
|
||||
} else if (qr.el) {
|
||||
qr.close();
|
||||
}
|
||||
break;
|
||||
case keybinds.spoiler:
|
||||
case conf.spoiler:
|
||||
ta = e.target;
|
||||
if (ta.nodeName !== 'TEXTAREA') {
|
||||
return;
|
||||
@ -780,62 +760,62 @@
|
||||
range = valStart.length + valMid.length;
|
||||
ta.setSelectionRange(range, range);
|
||||
break;
|
||||
case keybinds.zero:
|
||||
case conf.zero:
|
||||
window.location = "/" + g.BOARD + "/0#0";
|
||||
break;
|
||||
case keybinds.openEmptyQR:
|
||||
case conf.openEmptyQR:
|
||||
keybinds.qr(thread);
|
||||
break;
|
||||
case keybinds.nextReply:
|
||||
case conf.nextReply:
|
||||
keybinds.hl.next(thread);
|
||||
break;
|
||||
case keybinds.previousReply:
|
||||
case conf.previousReply:
|
||||
keybinds.hl.prev(thread);
|
||||
break;
|
||||
case keybinds.expandAllImages:
|
||||
case conf.expandAllImages:
|
||||
keybinds.img(thread, true);
|
||||
break;
|
||||
case keybinds.openThread:
|
||||
case conf.openThread:
|
||||
keybinds.open(thread);
|
||||
break;
|
||||
case keybinds.expandThread:
|
||||
case conf.expandThread:
|
||||
expandThread.toggle(thread);
|
||||
break;
|
||||
case keybinds.openQR:
|
||||
case conf.openQR:
|
||||
keybinds.qr(thread, true);
|
||||
break;
|
||||
case keybinds.expandImages:
|
||||
case conf.expandImages:
|
||||
keybinds.img(thread);
|
||||
break;
|
||||
case keybinds.nextThread:
|
||||
case conf.nextThread:
|
||||
nav.next();
|
||||
break;
|
||||
case keybinds.openThreadTab:
|
||||
case conf.openThreadTab:
|
||||
keybinds.open(thread, true);
|
||||
break;
|
||||
case keybinds.previousThread:
|
||||
case conf.previousThread:
|
||||
nav.prev();
|
||||
break;
|
||||
case keybinds.update:
|
||||
case conf.update:
|
||||
updater.update();
|
||||
break;
|
||||
case keybinds.watch:
|
||||
case conf.watch:
|
||||
watcher.toggle(thread);
|
||||
break;
|
||||
case keybinds.hide:
|
||||
case conf.hide:
|
||||
threadHiding.toggle(thread);
|
||||
break;
|
||||
case keybinds.nextPage:
|
||||
case conf.nextPage:
|
||||
if ((_ref2 = $('input[value=Next]')) != null) {
|
||||
_ref2.click();
|
||||
}
|
||||
break;
|
||||
case keybinds.previousPage:
|
||||
case conf.previousPage:
|
||||
if ((_ref3 = $('input[value=Previous]')) != null) {
|
||||
_ref3.click();
|
||||
}
|
||||
break;
|
||||
case keybinds.submit:
|
||||
case conf.submit:
|
||||
if (qr.el) {
|
||||
qr.submit.call($('form', qr.el));
|
||||
} else {
|
||||
|
||||
@ -513,28 +513,6 @@ keybinds =
|
||||
init: ->
|
||||
for node in $$ '[accesskey]'
|
||||
node.removeAttribute 'accesskey'
|
||||
|
||||
keybinds.close = $.getValue 'key/close', config.hotkeys.close
|
||||
keybinds.spoiler = $.getValue 'key/spoiler', config.hotkeys.spoiler
|
||||
keybinds.openQR = $.getValue 'key/openQR', config.hotkeys.openQR
|
||||
keybinds.openEmptyQR = $.getValue 'key/openEmptyQR', config.hotkeys.openEmptyQR
|
||||
keybinds.submit = $.getValue 'key/submit', config.hotkeys.submit
|
||||
keybinds.nextReply = $.getValue 'key/nextReply', config.hotkeys.nextReply
|
||||
keybinds.previousReply = $.getValue 'key/previousReply', config.hotkeys.previousReply
|
||||
keybinds.nextThread = $.getValue 'key/nextThread', config.hotkeys.nextThread
|
||||
keybinds.previousThread = $.getValue 'key/previousThread', config.hotkeys.previousThread
|
||||
keybinds.nextPage = $.getValue 'key/nextPage', config.hotkeys.nextPage
|
||||
keybinds.previousPage = $.getValue 'key/previousPage', config.hotkeys.previousPage
|
||||
keybinds.zero = $.getValue 'key/zero', config.hotkeys.zero
|
||||
keybinds.openThreadTab = $.getValue 'key/openThreadTab', config.hotkeys.openThreadTab
|
||||
keybinds.openThread = $.getValue 'key/openThread', config.hotkeys.openThread
|
||||
keybinds.expandThread = $.getValue 'key/expandThread', config.hotkeys.expandThread
|
||||
keybinds.watch = $.getValue 'key/watch', config.hotkeys.watch
|
||||
keybinds.hide = $.getValue 'key/hide', config.hotkeys.hide
|
||||
keybinds.expandImages = $.getValue 'key/expandImages', config.hotkeys.expandImages
|
||||
keybinds.expandAllImages = $.getValue 'key/expandAllImages', config.hotkeys.expandAllImages
|
||||
keybinds.update = $.getValue 'key/update', config.hotkeys.update
|
||||
|
||||
$.bind d, 'keydown', keybinds.cb.keydown
|
||||
|
||||
cb:
|
||||
@ -546,12 +524,12 @@ keybinds =
|
||||
|
||||
thread = nav.getThread()
|
||||
switch key
|
||||
when keybinds.close
|
||||
when conf.close
|
||||
if o = $ '#overlay'
|
||||
$.rm o
|
||||
else if qr.el
|
||||
qr.close()
|
||||
when keybinds.spoiler
|
||||
when conf.spoiler
|
||||
ta = e.target
|
||||
return unless ta.nodeName is 'TEXTAREA'
|
||||
|
||||
@ -566,41 +544,41 @@ keybinds =
|
||||
ta.value = valStart + valMid + valEnd
|
||||
range = valStart.length + valMid.length
|
||||
ta.setSelectionRange range, range
|
||||
when keybinds.zero
|
||||
when conf.zero
|
||||
window.location = "/#{g.BOARD}/0#0"
|
||||
when keybinds.openEmptyQR
|
||||
when conf.openEmptyQR
|
||||
keybinds.qr thread
|
||||
when keybinds.nextReply
|
||||
when conf.nextReply
|
||||
keybinds.hl.next thread
|
||||
when keybinds.previousReply
|
||||
when conf.previousReply
|
||||
keybinds.hl.prev thread
|
||||
when keybinds.expandAllImages
|
||||
when conf.expandAllImages
|
||||
keybinds.img thread, true
|
||||
when keybinds.openThread
|
||||
when conf.openThread
|
||||
keybinds.open thread
|
||||
when keybinds.expandThread
|
||||
when conf.expandThread
|
||||
expandThread.toggle thread
|
||||
when keybinds.openQR
|
||||
when conf.openQR
|
||||
keybinds.qr thread, true
|
||||
when keybinds.expandImages
|
||||
when conf.expandImages
|
||||
keybinds.img thread
|
||||
when keybinds.nextThread
|
||||
when conf.nextThread
|
||||
nav.next()
|
||||
when keybinds.openThreadTab
|
||||
when conf.openThreadTab
|
||||
keybinds.open thread, true
|
||||
when keybinds.previousThread
|
||||
when conf.previousThread
|
||||
nav.prev()
|
||||
when keybinds.update
|
||||
when conf.update
|
||||
updater.update()
|
||||
when keybinds.watch
|
||||
when conf.watch
|
||||
watcher.toggle thread
|
||||
when keybinds.hide
|
||||
when conf.hide
|
||||
threadHiding.toggle thread
|
||||
when keybinds.nextPage
|
||||
when conf.nextPage
|
||||
$('input[value=Next]')?.click()
|
||||
when keybinds.previousPage
|
||||
when conf.previousPage
|
||||
$('input[value=Previous]')?.click()
|
||||
when keybinds.submit
|
||||
when conf.submit
|
||||
if qr.el
|
||||
qr.submit.call $ 'form', qr.el
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user