From f7fd352264581ea8cff86e6a30acfc63c0d64f5c Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 23 Jun 2011 22:35:10 +0200 Subject: [PATCH] Alt & spoiler --- 4chan_x.user.js | 10 +++++++++- script.coffee | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 7d53d2dda..ee11fbde6 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -694,6 +694,7 @@ init: function() { var key; keybinds.close = (key = $.getValue('key/close')) ? key : ''; + 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 = ''; @@ -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 = ''; diff --git a/script.coffee b/script.coffee index c91071dc0..98979b9d3 100644 --- a/script.coffee +++ b/script.coffee @@ -490,6 +490,7 @@ replyHiding = keybinds = init: -> keybinds.close = if key = $.getValue 'key/close' then key else '' + 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 = '' @@ -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 = ''