Immediate rebind.

This commit is contained in:
Nicolas Stepien 2011-06-24 22:22:54 +02:00
parent 278ff8a2e2
commit 17cc6262b1
2 changed files with 5 additions and 1 deletions

View File

@ -1134,6 +1134,7 @@
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);
@ -1157,7 +1158,8 @@
} }
} }
this.value = key; this.value = key;
return $.setValue("key/" + this.name, key); $.setValue("key/" + this.name, key);
return keybinds[this.name] = key;
} }
}, },
time: function(e) { time: function(e) {

View File

@ -905,6 +905,7 @@ 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
@ -923,6 +924,7 @@ options =
key = 'ctrl+' + key if e.ctrlKey key = 'ctrl+' + key if e.ctrlKey
@value = key @value = key
$.setValue "key/#{@name}", key $.setValue "key/#{@name}", key
keybinds[@name] = key
time: (e) -> time: (e) ->
$.setValue 'time', @value $.setValue 'time', @value
Time.foo() Time.foo()