Don't allow hotkeys without ctrl or alt within textareas or inputs.

This commit is contained in:
Nicolas Stepien 2011-06-25 01:07:39 +02:00
parent 254f0057fb
commit 1697dd5f8b
2 changed files with 11 additions and 9 deletions

View File

@ -745,7 +745,10 @@
}, },
cb: { cb: {
keydown: function(e) { keydown: function(e) {
var key, o, qr, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2; var key, o, qr, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2, _ref3;
if (((_ref = d.activeElement.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey) {
return;
}
key = keybinds.cb.keyCode(e); key = keybinds.cb.keyCode(e);
if (e.altKey) { if (e.altKey) {
key = 'alt+' + key; key = 'alt+' + key;
@ -753,9 +756,8 @@
if (e.ctrlKey) { if (e.ctrlKey) {
key = 'ctrl+' + key; key = 'ctrl+' + key;
} }
keybinds.key = key;
thread = nav.getThread(); thread = nav.getThread();
switch (keybinds.key) { switch (key) {
case keybinds.close: case keybinds.close:
if (o = $('#overlay')) { if (o = $('#overlay')) {
$.rm(o); $.rm(o);
@ -824,13 +826,13 @@
threadHiding.toggle(thread); threadHiding.toggle(thread);
break; break;
case keybinds.nextPage: case keybinds.nextPage:
if ((_ref = $('input[value=Next]')) != null) { if ((_ref2 = $('input[value=Next]')) != null) {
_ref.click(); _ref2.click();
} }
break; break;
case keybinds.previousPage: case keybinds.previousPage:
if ((_ref2 = $('input[value=Previous]')) != null) { if ((_ref3 = $('input[value=Previous]')) != null) {
_ref2.click(); _ref3.click();
} }
break; break;
case keybinds.submit: case keybinds.submit:

View File

@ -539,13 +539,13 @@ keybinds =
cb: cb:
keydown: (e) -> keydown: (e) ->
return if d.activeElement.nodeName in ['TEXTAREA', 'INPUT'] and not e.altKey and not e.ctrlKey
key = keybinds.cb.keyCode e key = keybinds.cb.keyCode e
if e.altKey then key = 'alt+' + key if e.altKey then key = 'alt+' + key
if e.ctrlKey then key = 'ctrl+' + key if e.ctrlKey then key = 'ctrl+' + key
keybinds.key = key
thread = nav.getThread() thread = nav.getThread()
switch keybinds.key switch key
when keybinds.close when keybinds.close
if o = $ '#overlay' if o = $ '#overlay'
$.rm o $.rm o