fix options keybinding

This commit is contained in:
James Campos 2011-07-24 09:44:05 -07:00
parent ca8c6e46dd
commit 78fcfd2c33
2 changed files with 20 additions and 35 deletions

View File

@ -731,12 +731,6 @@
return; return;
} }
key = keybinds.cb.keyCode(e); key = keybinds.cb.keyCode(e);
if (e.altKey) {
key = 'alt+' + key;
}
if (e.ctrlKey) {
key = 'ctrl+' + key;
}
thread = nav.getThread(); thread = nav.getThread();
switch (key) { switch (key) {
case conf.close: case conf.close:
@ -833,7 +827,7 @@
} }
return e.preventDefault(); return e.preventDefault();
}, },
keyCode: function(e, options) { keyCode: function(e) {
var kc; var kc;
kc = e.keyCode; kc = e.keyCode;
if ((65 <= kc && kc <= 90)) { if ((65 <= kc && kc <= 90)) {
@ -845,9 +839,15 @@
key = String.fromCharCode(kc); key = String.fromCharCode(kc);
} else if (kc === 27) { } else if (kc === 27) {
key = 'Esc'; key = 'Esc';
} else if (options && kc === 8) { } else {
key = ''; key = '';
} }
if (e.altKey) {
key = 'alt+' + key;
}
if (e.ctrlKey) {
key = 'ctrl+' + key;
}
return key; return key;
} }
}, },
@ -1124,20 +1124,10 @@
keybind: function(e) { keybind: function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
key = keybinds.cb.keyCode(e, true); key = keybinds.cb.keyCode(e);
if (key != null) { this.value = key;
if (key) { $.setValue(this.name, key);
if (e.altKey) { return conf[this.name] = key;
key = 'alt+' + key;
}
if (e.ctrlKey) {
key = 'ctrl+' + key;
}
}
this.value = key;
$.setValue(this.name, key);
return conf[this.name] = key;
}
}, },
time: function(e) { time: function(e) {
$.setValue('time', this.value); $.setValue('time', this.value);

View File

@ -521,8 +521,6 @@ keybinds =
keydown: (e) -> keydown: (e) ->
return if e.target.nodeName in ['TEXTAREA', 'INPUT'] and not e.altKey and not e.ctrlKey and not (e.keyCode is 27) return if e.target.nodeName in ['TEXTAREA', 'INPUT'] and not e.altKey and not e.ctrlKey and not (e.keyCode is 27)
key = keybinds.cb.keyCode e key = keybinds.cb.keyCode e
if e.altKey then key = 'alt+' + key
if e.ctrlKey then key = 'ctrl+' + key
thread = nav.getThread() thread = nav.getThread()
switch key switch key
@ -593,7 +591,7 @@ keybinds =
return return
e.preventDefault() e.preventDefault()
keyCode: (e, options) -> keyCode: (e) ->
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
@ -603,8 +601,10 @@ keybinds =
key = String.fromCharCode kc key = String.fromCharCode kc
else if kc is 27 else if kc is 27
key = 'Esc' key = 'Esc'
else if options and kc is 8 else
key = '' key = ''
if e.altKey then key = 'alt+' + key
if e.ctrlKey then key = 'ctrl+' + key
key key
img: (thread, all) -> img: (thread, all) ->
@ -890,15 +890,10 @@ options =
keybind: (e) -> keybind: (e) ->
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
key = keybinds.cb.keyCode e, true key = keybinds.cb.keyCode e
@value = key
if key? $.setValue @name, key
if key conf[@name] = key
key = 'alt+' + key if e.altKey
key = 'ctrl+' + key if e.ctrlKey
@value = key
$.setValue @name, key
conf[@name] = key
time: (e) -> time: (e) ->
$.setValue 'time', @value $.setValue 'time', @value
conf['time'] = @value conf['time'] = @value