diff --git a/4chan_x.user.js b/4chan_x.user.js index 4cce42059..fa872ea90 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1054,10 +1054,16 @@ return $.on(d, 'keydown', Keybinds.keydown); }, keydown: function(e) { - var key, link, o, ta, thread; - if (!(key = Keybinds.keyCode(e)) || /TEXTAREA|INPUT/.test(e.target.nodeName) && !(e.altKey || e.ctrlKey || e.keyCode === 27)) { + var key, link, o, target, thread; + if (!(key = Keybinds.keyCode(e))) { return; } + target = e.target; + if (/TEXTAREA|INPUT/.test(target.nodeName)) { + if (!((key === 'Esc') || (/\+/.test(key)))) { + return; + } + } thread = Nav.getThread(); switch (key) { case Conf.openQR: @@ -1084,15 +1090,13 @@ } break; case Conf.spoiler: - ta = e.target; - if (ta.nodeName !== 'TEXTAREA') { + if (target.nodeName !== 'TEXTAREA') { return; } Keybinds.tags('spoiler', ta); break; case Conf.code: - ta = e.target; - if (ta.nodeName !== 'TEXTAREA') { + if (target.nodeName !== 'TEXTAREA') { return; } Keybinds.tags('code', ta); @@ -1233,6 +1237,9 @@ if (e.ctrlKey) { key = 'ctrl+' + key; } + if (e.metaKey) { + key = 'meta+' + key; + } } return key; }, @@ -2280,7 +2287,7 @@ \
\
Keybinds are disabled.
\ -
Allowed keys: Ctrl, Alt, a-z, A-Z, 0-9, Up, Down, Right, Left.
\ +
Allowed keys: Ctrl, Alt, Meta, a-z, A-Z, 0-9, Up, Down, Right, Left.
\ \ \
ActionsKeybinds
\ diff --git a/script.coffee b/script.coffee index 8f38ca3f3..1796680d1 100644 --- a/script.coffee +++ b/script.coffee @@ -793,8 +793,10 @@ Keybinds = $.on d, 'keydown', Keybinds.keydown keydown: (e) -> - if not (key = Keybinds.keyCode(e)) or /TEXTAREA|INPUT/.test(e.target.nodeName) and not (e.altKey or e.ctrlKey or e.keyCode is 27) - return + return unless key = Keybinds.keyCode e + {target} = e + if /TEXTAREA|INPUT/.test target.nodeName + return unless (key is 'Esc') or (/\+/.test key) thread = Nav.getThread() switch key @@ -813,12 +815,10 @@ Keybinds = when Conf.submit QR.submit() if QR.el and !QR.status() when Conf.spoiler - ta = e.target - return if ta.nodeName isnt 'TEXTAREA' + return if target.nodeName isnt 'TEXTAREA' Keybinds.tags 'spoiler', ta when Conf.code - ta = e.target - return if ta.nodeName isnt 'TEXTAREA' + return if target.nodeName isnt 'TEXTAREA' Keybinds.tags 'code', ta # Thread related when Conf.watch @@ -886,8 +886,9 @@ Keybinds = else null if key - if e.altKey then key = 'alt+' + key + if e.altKey then key = 'alt+' + key if e.ctrlKey then key = 'ctrl+' + key + if e.metaKey then key = 'meta+' + key key tags: (tag, ta) -> @@ -1760,7 +1761,7 @@ Options =
Keybinds are disabled.
-
Allowed keys: Ctrl, Alt, a-z, A-Z, 0-9, Up, Down, Right, Left.
+
Allowed keys: Ctrl, Alt, Meta, a-z, A-Z, 0-9, Up, Down, Right, Left.
ActionsKeybinds