From d2fb9a275abe52243e9a7d0a6f65ee6b11daf2a6 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 10 Aug 2011 00:38:09 -0700 Subject: [PATCH] fix, refactor conditional --- 4chan_x.user.js | 7 ++++++- script.coffee | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 99e93219b..b10c37f0d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1263,7 +1263,12 @@ return $('#recaptcha_challenge_field', qr.el).value = target.value; }, captchaKeydown: function(e) { - if (e.keyCode !== 13 || (!cooldown.duration || ($('textarea', qr.el).value || $('#qr_form input[type=file]', qr.el).length))) { + var blank; + if (e.keyCode !== 13) { + return; + } + blank = !$('textarea', qr.el).value && !$('input[type=file]', qr.el).files.length; + if (!(blank || cooldown.duration)) { return; } $('#auto', qr.el).checked = true; diff --git a/script.coffee b/script.coffee index f43d770f8..efe1ecb59 100644 --- a/script.coffee +++ b/script.coffee @@ -997,8 +997,11 @@ qr = $('#recaptcha_challenge_field', qr.el).value = target.value captchaKeydown: (e) -> - return if e.keyCode isnt 13 or (!cooldown.duration or - ($('textarea', qr.el).value or $('#qr_form input[type=file]', qr.el).length)) + return unless e.keyCode is 13 #enter + + blank = !$('textarea', qr.el).value and !$('input[type=file]', qr.el).files.length + return unless blank or cooldown.duration + $('#auto', qr.el).checked = true $('#autohide', qr.el).checked = true if conf['Auto Hide QR'] qr.captchaPush.call this