From f5060431c2d28fb3e00e238e8f29ed1e3319e8d7 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 24 Aug 2011 09:10:14 -0700 Subject: [PATCH] auto posting fix --- 4chan_x.user.js | 6 ++++-- script.coffee | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 67de2b56e..a80aa0d9b 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1257,7 +1257,7 @@ return $.replace(oldFile, file); }, autoPost: function() { - if (qr.el && $('#auto', qr.el).checked && !qr.postInvalid()) { + if (qr.el && $('#auto', qr.el).checked) { return qr.submit.call($('form', qr.el)); } }, @@ -1435,7 +1435,9 @@ submit: function(e) { var id, msg, op; if (msg = qr.postInvalid()) { - e.preventDefault(); + if (typeof e.preventDefault === "function") { + e.preventDefault(); + } alert(msg); if (msg === 'You forgot to type in the verification.') { $('#dummy', qr.el).focus(); diff --git a/script.coffee b/script.coffee index f8d73fbd3..90b0c93af 100644 --- a/script.coffee +++ b/script.coffee @@ -996,7 +996,7 @@ qr = $.replace oldFile, file autoPost: -> - if qr.el and $('#auto', qr.el).checked and not qr.postInvalid() + if qr.el and $('#auto', qr.el).checked qr.submit.call $ 'form', qr.el captchaNode: (e) -> @@ -1173,8 +1173,9 @@ qr = $.replace oldFile, newFile submit: (e) -> + #XXX `e` won't exist if we're here from `qr.submit.call form`. if msg = qr.postInvalid() - e.preventDefault() + e.preventDefault?() alert msg if msg is 'You forgot to type in the verification.' $('#dummy', qr.el).focus()