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