Alt & spoiler

This commit is contained in:
Nicolas Stepien 2011-06-23 22:35:10 +02:00
parent 6ae05b723a
commit f7fd352264
2 changed files with 14 additions and 2 deletions

View File

@ -694,6 +694,7 @@
init: function() { init: function() {
var key; var key;
keybinds.close = (key = $.getValue('key/close')) ? key : '<Esc>'; keybinds.close = (key = $.getValue('key/close')) ? key : '<Esc>';
keybinds.spoiler = (key = $.getValue('key/spoiler')) ? key : '^s';
keybinds.zero = (key = $.getValue('key/zero')) ? key : '0'; keybinds.zero = (key = $.getValue('key/zero')) ? key : '0';
keybinds.openQR = (key = $.getValue('key/openQR')) ? key : 'i'; keybinds.openQR = (key = $.getValue('key/openQR')) ? key : 'i';
keybinds.openEmptyQR = (key = $.getValue('key/openEmptyQR')) ? key : 'I'; keybinds.openEmptyQR = (key = $.getValue('key/openEmptyQR')) ? key : 'I';
@ -729,6 +730,9 @@
if (e.ctrlKey) { if (e.ctrlKey) {
key = '^' + key; key = '^' + key;
} }
if (e.altKey) {
key = 'alt+' + key;
}
} else { } else {
if (kc === 27) { if (kc === 27) {
key = '<Esc>'; key = '<Esc>';
@ -748,7 +752,7 @@
case keybinds.close: case keybinds.close:
e.preventDefault(); e.preventDefault();
return $.rm($('#qr')); return $.rm($('#qr'));
case '^s': case keybinds.spoiler:
ta = d.activeElement; ta = d.activeElement;
if (ta.nodeName !== 'TEXTAREA') { if (ta.nodeName !== 'TEXTAREA') {
return; return;
@ -770,6 +774,7 @@
thread = nav.getThread(); thread = nav.getThread();
switch (keybinds.key) { switch (keybinds.key) {
case keybinds.close: case keybinds.close:
e.preventDefault();
if (o = $('#overlay')) { if (o = $('#overlay')) {
return $.rm(o); return $.rm(o);
} }
@ -1090,6 +1095,9 @@
if (e.ctrlKey) { if (e.ctrlKey) {
key = '^' + key; key = '^' + key;
} }
if (e.altKey) {
key = 'alt+' + key;
}
} else { } else {
if (kc === 27) { if (kc === 27) {
key = '<Esc>'; key = '<Esc>';

View File

@ -490,6 +490,7 @@ replyHiding =
keybinds = keybinds =
init: -> init: ->
keybinds.close = if key = $.getValue 'key/close' then key else '<Esc>' keybinds.close = if key = $.getValue 'key/close' then key else '<Esc>'
keybinds.spoiler = if key = $.getValue 'key/spoiler' then key else '^s'
keybinds.zero = if key = $.getValue 'key/zero' then key else '0' keybinds.zero = if key = $.getValue 'key/zero' then key else '0'
keybinds.openQR = if key = $.getValue 'key/openQR' then key else 'i' keybinds.openQR = if key = $.getValue 'key/openQR' then key else 'i'
keybinds.openEmptyQR = if key = $.getValue 'key/openEmptyQR' then key else 'I' keybinds.openEmptyQR = if key = $.getValue 'key/openEmptyQR' then key else 'I'
@ -522,6 +523,7 @@ keybinds =
if !e.shiftKey if !e.shiftKey
key = key.toLowerCase() key = key.toLowerCase()
if e.ctrlKey then key = '^' + key if e.ctrlKey then key = '^' + key
if e.altKey then key = 'alt+' + key
else else
if kc is 27 if kc is 27
key = '<Esc>' key = '<Esc>'
@ -537,7 +539,7 @@ keybinds =
when keybinds.close when keybinds.close
e.preventDefault() e.preventDefault()
$.rm $ '#qr' $.rm $ '#qr'
when '^s' when keybinds.spoiler
ta = d.activeElement ta = d.activeElement
return unless ta.nodeName is 'TEXTAREA' return unless ta.nodeName is 'TEXTAREA'
@ -559,6 +561,7 @@ keybinds =
thread = nav.getThread() thread = nav.getThread()
switch keybinds.key switch keybinds.key
when keybinds.close when keybinds.close
e.preventDefault()
$.rm o if o = $ '#overlay' $.rm o if o = $ '#overlay'
when keybinds.zero when keybinds.zero
window.location = "/#{g.BOARD}/0#0" window.location = "/#{g.BOARD}/0#0"
@ -880,6 +883,7 @@ options =
if !e.shiftKey if !e.shiftKey
key = key.toLowerCase() key = key.toLowerCase()
if e.ctrlKey then key = '^' + key if e.ctrlKey then key = '^' + key
if e.altKey then key = 'alt+' + key
else else
if kc is 27 if kc is 27
key = '<Esc>' key = '<Esc>'