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

View File

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