More combination possibilities.

This commit is contained in:
Nicolas Stepien 2011-06-24 03:27:33 +02:00
parent e30db0dc6f
commit 1a0e537d79
2 changed files with 49 additions and 50 deletions

View File

@ -722,18 +722,16 @@
if (!e.shiftKey) { if (!e.shiftKey) {
key = key.toLowerCase(); key = key.toLowerCase();
} }
if (e.ctrlKey) { } else if ((48 <= kc && kc <= 57)) {
key = 'ctrl+' + key; key = String.fromCharCode(kc);
} } else if (kc === 27) {
if (e.altKey) { key = 'Esc';
key = 'alt+' + key; }
} if (e.altKey) {
} else { key = 'alt+' + key;
if (kc === 27) { }
key = 'Esc'; if (e.ctrlKey) {
} else if ((48 <= kc && kc <= 57)) { key = 'ctrl+' + key;
key = String.fromCharCode(kc);
}
} }
keybinds.key = key; keybinds.key = key;
thread = nav.getThread(); thread = nav.getThread();
@ -1089,31 +1087,32 @@
keybind: function(e) { keybind: function(e) {
var kc, key; var kc, key;
e.preventDefault(); e.preventDefault();
e.stopPropagation();
kc = e.keyCode; kc = e.keyCode;
if ((65 <= kc && kc <= 90)) { if ((65 <= kc && kc <= 90)) {
key = String.fromCharCode(kc); key = String.fromCharCode(kc);
if (!e.shiftKey) { if (!e.shiftKey) {
key = key.toLowerCase(); key = key.toLowerCase();
} }
if (e.ctrlKey) { } else if ((48 <= kc && kc <= 57)) {
key = 'ctrl+' + key; key = String.fromCharCode(kc);
} } else if (kc === 27) {
if (e.altKey) { key = 'Esc';
key = 'alt+' + key; } else if (kc === 8) {
} key = '';
} else { }
if (kc === 27) { if (key.length >= 0) {
key = 'Esc'; if (key) {
} else if ((48 <= kc && kc <= 57)) { if (e.altKey) {
key = String.fromCharCode(kc); key = 'alt+' + key;
} else if (kc === 8) { }
key = ''; if (e.ctrlKey) {
} else { key = 'ctrl+' + key;
key = this.value; }
} }
this.value = key;
return $.setValue("key/" + this.name, key);
} }
this.value = key;
return $.setValue("key/" + this.name, key);
}, },
time: function(e) { time: function(e) {
$.setValue('time', this.value); $.setValue('time', this.value);

View File

@ -517,13 +517,12 @@ keybinds =
key = String.fromCharCode kc key = String.fromCharCode kc
if !e.shiftKey if !e.shiftKey
key = key.toLowerCase() key = key.toLowerCase()
if e.ctrlKey then key = 'ctrl+' + key else if 48 <= kc <= 57 #0-9
if e.altKey then key = 'alt+' + key key = String.fromCharCode kc
else else if kc is 27
if kc is 27 key = 'Esc'
key = 'Esc' if e.altKey then key = 'alt+' + key
else if 48 <= kc <= 57 #0-9 if e.ctrlKey then key = 'ctrl+' + key
key = String.fromCharCode kc
keybinds.key = key keybinds.key = key
thread = nav.getThread() thread = nav.getThread()
@ -867,24 +866,25 @@ options =
g.hiddenReplies = {} g.hiddenReplies = {}
keybind: (e) -> keybind: (e) ->
e.preventDefault() e.preventDefault()
e.stopPropagation()
kc = e.keyCode kc = e.keyCode
if 65 <= kc <= 90 #A-Z if 65 <= kc <= 90 #A-Z
key = String.fromCharCode kc key = String.fromCharCode kc
if !e.shiftKey if !e.shiftKey
key = key.toLowerCase() key = key.toLowerCase()
if e.ctrlKey then key = 'ctrl+' + key else if 48 <= kc <= 57 #0-9
if e.altKey then key = 'alt+' + key key = String.fromCharCode kc
else else if kc is 27
if kc is 27 key = 'Esc'
key = 'Esc' else if kc is 8
else if 48 <= kc <= 57 #0-9 key = ''
key = String.fromCharCode kc
else if kc is 8 if key.length >= 0
key = '' if key
else key = 'alt+' + key if e.altKey
key = @value key = 'ctrl+' + key if e.ctrlKey
@value = key @value = key
$.setValue "key/#{@name}", key $.setValue "key/#{@name}", key
time: (e) -> time: (e) ->
$.setValue 'time', @value $.setValue 'time', @value
Time.foo() Time.foo()