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: {
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);
if (e.altKey) {
key = 'alt+' + key;
@ -753,9 +756,8 @@
if (e.ctrlKey) {
key = 'ctrl+' + key;
}
keybinds.key = key;
thread = nav.getThread();
switch (keybinds.key) {
switch (key) {
case keybinds.close:
if (o = $('#overlay')) {
$.rm(o);
@ -824,13 +826,13 @@
threadHiding.toggle(thread);
break;
case keybinds.nextPage:
if ((_ref = $('input[value=Next]')) != null) {
_ref.click();
if ((_ref2 = $('input[value=Next]')) != null) {
_ref2.click();
}
break;
case keybinds.previousPage:
if ((_ref2 = $('input[value=Previous]')) != null) {
_ref2.click();
if ((_ref3 = $('input[value=Previous]')) != null) {
_ref3.click();
}
break;
case keybinds.submit:

View File

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