From 17c594e19a7a645aa6e96b698b8531f315fc0ca9 Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 23 Aug 2011 20:57:18 -0700 Subject: [PATCH] qr.autoPost --- 4chan_x.user.js | 9 ++++++--- script.coffee | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index e5227c687..4bebc12a9 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1220,9 +1220,7 @@ submit.disabled = false; submit.value = 'Submit'; } - if (qr.el && $('#auto', qr.el).checked && !qr.postInvalid()) { - return qr.submit.call($('form', qr.el)); - } + return qr.autoPost(); } } }; @@ -1258,6 +1256,11 @@ oldFile = $('#qr_form input[type=file]', qr.el); return $.replace(oldFile, file); }, + autoPost: function() { + if (qr.el && $('#auto', qr.el).checked && !qr.postInvalid()) { + return qr.submit.call($('form', qr.el)); + } + }, captchaNode: function(e) { var target; if (!qr.el) { diff --git a/script.coffee b/script.coffee index 0db5f083d..466966d94 100644 --- a/script.coffee +++ b/script.coffee @@ -960,8 +960,7 @@ cooldown = for submit in submits submit.disabled = false submit.value = 'Submit' - if qr.el and $('#auto', qr.el).checked and not qr.postInvalid() - qr.submit.call $ 'form', qr.el + qr.autoPost() qr = # TODO @@ -995,6 +994,10 @@ qr = oldFile = $ '#qr_form input[type=file]', qr.el $.replace oldFile, file + autoPost: -> + if qr.el and $('#auto', qr.el).checked and not qr.postInvalid() + qr.submit.call $ 'form', qr.el + captchaNode: (e) -> return unless qr.el {target} = e