diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 822de9503..583850b90 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -183,7 +183,8 @@ 'Code tags': ['Alt+c', 'Insert code tags.'], 'Eqn tags': ['Alt+e', 'Insert eqn tags.'], 'Math tags': ['Alt+m', 'Insert math tags.'], - 'Submit QR': ['Alt+s', 'Submit post.'], + 'Toggle sage': ['Alt+s', 'Toggle sage in email field'], + 'Submit QR': ['Ctrl+Enter', 'Submit post.'], 'Watch': ['w', 'Watch thread.'], 'Update': ['r', 'Update the thread now.'], 'Expand image': ['Shift+e', 'Expand selected image.'], @@ -5096,6 +5097,11 @@ } Keybinds.tags('math', target); break; + case Conf['Toggle sage']: + if (QR.nodes) { + Keybinds.sage(); + } + break; case Conf['Submit QR']: if (QR.nodes && !QR.status()) { QR.submit(); @@ -5247,6 +5253,16 @@ ta.setSelectionRange(range, range); return $.event('input', null, ta); }, + sage: function() { + var isSage; + + isSage = /sage/i.test(QR.nodes.email.value); + if (isSage) { + return QR.nodes.email.value = ""; + } else { + return QR.nodes.email.value = "sage"; + } + }, img: function(thread, all) { var post; diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 6337fa43b..2899fbc2b 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -184,7 +184,8 @@ 'Code tags': ['Alt+c', 'Insert code tags.'], 'Eqn tags': ['Alt+e', 'Insert eqn tags.'], 'Math tags': ['Alt+m', 'Insert math tags.'], - 'Submit QR': ['Alt+s', 'Submit post.'], + 'Toggle sage': ['Alt+s', 'Toggle sage in email field'], + 'Submit QR': ['Ctrl+Enter', 'Submit post.'], 'Watch': ['w', 'Watch thread.'], 'Update': ['r', 'Update the thread now.'], 'Expand image': ['Shift+e', 'Expand selected image.'], @@ -5087,6 +5088,11 @@ } Keybinds.tags('math', target); break; + case Conf['Toggle sage']: + if (QR.nodes) { + Keybinds.sage(); + } + break; case Conf['Submit QR']: if (QR.nodes && !QR.status()) { QR.submit(); @@ -5238,6 +5244,16 @@ ta.setSelectionRange(range, range); return $.event('input', null, ta); }, + sage: function() { + var isSage; + + isSage = /sage/i.test(QR.nodes.email.value); + if (isSage) { + return QR.nodes.email.value = ""; + } else { + return QR.nodes.email.value = "sage"; + } + }, img: function(thread, all) { var post; diff --git a/builds/crx/script.js b/builds/crx/script.js index 319f1fc67..413b4ae1b 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -140,7 +140,8 @@ 'Code tags': ['Alt+c', 'Insert code tags.'], 'Eqn tags': ['Alt+e', 'Insert eqn tags.'], 'Math tags': ['Alt+m', 'Insert math tags.'], - 'Submit QR': ['Alt+s', 'Submit post.'], + 'Toggle sage': ['Alt+s', 'Toggle sage in email field'], + 'Submit QR': ['Ctrl+Enter', 'Submit post.'], 'Watch': ['w', 'Watch thread.'], 'Update': ['r', 'Update the thread now.'], 'Expand image': ['Shift+e', 'Expand selected image.'], @@ -5010,6 +5011,11 @@ } Keybinds.tags('math', target); break; + case Conf['Toggle sage']: + if (QR.nodes) { + Keybinds.sage(); + } + break; case Conf['Submit QR']: if (QR.nodes && !QR.status()) { QR.submit(); @@ -5161,6 +5167,16 @@ ta.setSelectionRange(range, range); return $.event('input', null, ta); }, + sage: function() { + var isSage; + + isSage = /sage/i.test(QR.nodes.email.value); + if (isSage) { + return QR.nodes.email.value = ""; + } else { + return QR.nodes.email.value = "sage"; + } + }, img: function(thread, all) { var post; diff --git a/src/config.coffee b/src/config.coffee index 4a0f6851b..dbb17531c 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -446,8 +446,12 @@ http://iqdb.org/?url=%TURL 'Alt+m' 'Insert math tags.' ] - 'Submit QR': [ + 'Toggle sage': [ 'Alt+s' + 'Toggle sage in email field' + ] + 'Submit QR': [ + 'Ctrl+Enter' 'Submit post.' ] # Thread related diff --git a/src/features/misc/keybinds.coffee b/src/features/misc/keybinds.coffee index 9c11afac1..31a798a04 100644 --- a/src/features/misc/keybinds.coffee +++ b/src/features/misc/keybinds.coffee @@ -50,6 +50,8 @@ Keybinds = when Conf['Math tags'] return if target.nodeName isnt 'TEXTAREA' Keybinds.tags 'math', target + when Conf['Toggle sage'] + do Keybinds.sage if QR.nodes when Conf['Submit QR'] QR.submit() if QR.nodes and !QR.status() # Thread related @@ -161,6 +163,13 @@ Keybinds = # Fire the 'input' event $.event 'input', null, ta + sage: -> + isSage = /sage/i.test QR.nodes.email.value + if isSage + QR.nodes.email.value = "" + else + QR.nodes.email.value = "sage" + img: (thread, all) -> if all ImageExpand.cb.toggleAll()