This commit is contained in:
James Campos 2011-07-24 09:40:32 -07:00
parent 674e7e4a1c
commit ca8c6e46dd
3 changed files with 39 additions and 39 deletions

View File

@ -726,19 +726,19 @@
}, },
cb: { cb: {
keydown: function(e) { keydown: function(e) {
var k, o, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2, _ref3; var o, range, selEnd, selStart, ta, thread, valEnd, valMid, valStart, value, _ref, _ref2, _ref3;
if (((_ref = e.target.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) { if (((_ref = e.target.nodeName) === 'TEXTAREA' || _ref === 'INPUT') && !e.altKey && !e.ctrlKey && !(e.keyCode === 27)) {
return; return;
} }
k = keybinds.cb.keyCode(e); key = keybinds.cb.keyCode(e);
if (e.altKey) { if (e.altKey) {
k = 'alt+' + k; key = 'alt+' + key;
} }
if (e.ctrlKey) { if (e.ctrlKey) {
k = 'ctrl+' + k; key = 'ctrl+' + key;
} }
thread = nav.getThread(); thread = nav.getThread();
switch (k) { switch (key) {
case conf.close: case conf.close:
if (o = $('#overlay')) { if (o = $('#overlay')) {
$.rm(o); $.rm(o);
@ -834,21 +834,21 @@
return e.preventDefault(); return e.preventDefault();
}, },
keyCode: function(e, options) { keyCode: function(e, options) {
var k, kc; var kc;
kc = e.keyCode; kc = e.keyCode;
if ((65 <= kc && kc <= 90)) { if ((65 <= kc && kc <= 90)) {
k = String.fromCharCode(kc); key = String.fromCharCode(kc);
if (!e.shiftKey) { if (!e.shiftKey) {
k = k.toLowerCase(); key = key.toLowerCase();
} }
} else if ((48 <= kc && kc <= 57)) { } else if ((48 <= kc && kc <= 57)) {
k = String.fromCharCode(kc); key = String.fromCharCode(kc);
} else if (kc === 27) { } else if (kc === 27) {
k = 'Esc'; key = 'Esc';
} else if (options && kc === 8) { } else if (options && kc === 8) {
k = ''; key = '';
} }
return k; return key;
} }
}, },
img: function(thread, all) { img: function(thread, all) {
@ -1122,22 +1122,21 @@
return g.hiddenReplies = {}; return g.hiddenReplies = {};
}, },
keybind: function(e) { keybind: function(e) {
var k;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
k = keybinds.cb.keyCode(e, true); key = keybinds.cb.keyCode(e, true);
if (k != null) { if (key != null) {
if (k) { if (key) {
if (e.altKey) { if (e.altKey) {
k = 'alt+' + k; key = 'alt+' + key;
} }
if (e.ctrlKey) { if (e.ctrlKey) {
k = 'ctrl+' + k; key = 'ctrl+' + key;
} }
} }
this.value = k; this.value = key;
$.setValue(this.name, k); $.setValue(this.name, key);
return conf[this.name] = k; return conf[this.name] = key;
} }
}, },
time: function(e) { time: function(e) {

View File

@ -7,6 +7,7 @@ github
- fix wrong keybind input in options - fix wrong keybind input in options
- fix time preview - fix time preview
- fix backlink inlining removing its container - fix backlink inlining removing its container
- Fix options key/keybinds key variables.
2.16.1 2.16.1
- mayhem: - mayhem:

View File

@ -520,12 +520,12 @@ keybinds =
cb: cb:
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)
k = keybinds.cb.keyCode e key = keybinds.cb.keyCode e
if e.altKey then k = 'alt+' + k if e.altKey then key = 'alt+' + key
if e.ctrlKey then k = 'ctrl+' + k if e.ctrlKey then key = 'ctrl+' + key
thread = nav.getThread() thread = nav.getThread()
switch k switch key
when conf.close when conf.close
if o = $ '#overlay' if o = $ '#overlay'
$.rm o $.rm o
@ -596,16 +596,16 @@ keybinds =
keyCode: (e, options) -> keyCode: (e, options) ->
kc = e.keyCode kc = e.keyCode
if 65 <= kc <= 90 #A-Z if 65 <= kc <= 90 #A-Z
k = String.fromCharCode kc key = String.fromCharCode kc
if !e.shiftKey if !e.shiftKey
k = k.toLowerCase() key = key.toLowerCase()
else if 48 <= kc <= 57 #0-9 else if 48 <= kc <= 57 #0-9
k = String.fromCharCode kc key = String.fromCharCode kc
else if kc is 27 else if kc is 27
k = 'Esc' key = 'Esc'
else if options and kc is 8 else if options and kc is 8
k = '' key = ''
k key
img: (thread, all) -> img: (thread, all) ->
if all if all
@ -890,15 +890,15 @@ options =
keybind: (e) -> keybind: (e) ->
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
k = keybinds.cb.keyCode e, true key = keybinds.cb.keyCode e, true
if k? if key?
if k if key
k = 'alt+' + k if e.altKey key = 'alt+' + key if e.altKey
k = 'ctrl+' + k if e.ctrlKey key = 'ctrl+' + key if e.ctrlKey
@value = k @value = key
$.setValue @name, k $.setValue @name, key
conf[@name] = k conf[@name] = key
time: (e) -> time: (e) ->
$.setValue 'time', @value $.setValue 'time', @value
conf['time'] = @value conf['time'] = @value