fix, refactor conditional

This commit is contained in:
James Campos 2011-08-10 00:38:09 -07:00
parent ed353971e4
commit d2fb9a275a
2 changed files with 11 additions and 3 deletions

View File

@ -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;

View File

@ -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