From a205ea65d52461f3ff138202a16106a73bd55677 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 24 Jun 2011 21:05:25 +0200 Subject: [PATCH] Replace 4chan's submit default behavior. --- 4chan_x.user.js | 10 +++++++++- script.coffee | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index ddc5850dc..755d2352f 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -702,6 +702,7 @@ keybinds.spoiler = (key = $.getValue('key/spoiler', 0)).length >= 0 ? key : 'ctrl+s'; keybinds.openQR = (key = $.getValue('key/openQR', 0)).length >= 0 ? key : 'i'; keybinds.openEmptyQR = (key = $.getValue('key/openEmptyQR', 0)).length >= 0 ? key : 'I'; + keybinds.submit = (key = $.getValue('key/submit', 0)).length >= 0 ? key : 'alt+s'; keybinds.nextReply = (key = $.getValue('key/nextReply', 0)).length >= 0 ? key : 'J'; keybinds.previousReply = (key = $.getValue('key/previousReply', 0)).length >= 0 ? key : 'K'; keybinds.nextThread = (key = $.getValue('key/nextThread', 0)).length >= 0 ? key : 'n'; @@ -820,6 +821,13 @@ _ref2.click(); } break; + case keybinds.submit: + if (qr = $('#qr_form')) { + qr.submit(); + } else { + $('.postarea form').submit(); + } + break; default: return; } @@ -1012,7 +1020,7 @@ var arr, checked, description, dialog, hiddenNum, hiddenThreads, html, input, key, li, link, main, obj, overlay, ul, _i, _j, _k, _len, _len2, _len3, _ref, _ref2, _ref3, _ref4; hiddenThreads = $.getValue("hiddenThreads/" + g.BOARD + "/", {}); hiddenNum = Object.keys(g.hiddenReplies).length + Object.keys(hiddenThreads).length; - html = "

"; + html = "

"; dialog = $.el('div', { id: 'options', innerHTML: html diff --git a/script.coffee b/script.coffee index a8fb24006..cdd792315 100644 --- a/script.coffee +++ b/script.coffee @@ -496,6 +496,7 @@ keybinds = keybinds.spoiler = if (key = $.getValue 'key/spoiler', 0).length >= 0 then key else 'ctrl+s' keybinds.openQR = if (key = $.getValue 'key/openQR', 0).length >= 0 then key else 'i' keybinds.openEmptyQR = if (key = $.getValue 'key/openEmptyQR', 0).length >= 0 then key else 'I' + keybinds.submit = if (key = $.getValue 'key/submit', 0).length >= 0 then key else 'alt+s' keybinds.nextReply = if (key = $.getValue 'key/nextReply', 0).length >= 0 then key else 'J' keybinds.previousReply = if (key = $.getValue 'key/previousReply', 0).length >= 0 then key else 'K' keybinds.nextThread = if (key = $.getValue 'key/nextThread', 0).length >= 0 then key else 'n' @@ -586,6 +587,11 @@ keybinds = $('input[value=Next]')?.click() when keybinds.previousPage $('input[value=Previous]')?.click() + when keybinds.submit + if qr = $('#qr_form') + qr.submit() + else + $('.postarea form').submit() else return e.preventDefault() @@ -792,6 +798,7 @@ options = Quick spoiler Open QR with post number inserted Open QR without post number inserted + Submit post Select next reply Select previous reply See next thread