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

View File

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