autopost timeout

try to not look like a spambot
This commit is contained in:
James Campos 2011-08-09 04:38:59 -07:00
parent 17a55d0542
commit 01592ae8d7
2 changed files with 14 additions and 20 deletions

View File

@ -1263,12 +1263,13 @@
}, },
autoPost: function() { autoPost: function() {
var captcha, responseField; var captcha, responseField;
responseField = $('#recaptcha_response_field', qr.el); if (!(captcha = qr.captcha.shift())) {
if (!responseField.value && (captcha = qr.captcha.shift())) { return;
$('#recaptcha_challenge_field', qr.el).value = captcha.challenge;
responseField.value = captcha.response;
responseField.nextSibling.textContent = qr.captcha.length + ' captcha cached';
} }
$('#recaptcha_challenge_field', qr.el).value = captcha.challenge;
responseField = $('#recaptcha_response_field', qr.el);
responseField.value = captcha.response;
responseField.nextSibling.textContent = qr.captcha.length + ' captcha cached';
return qr.submit.call($('form', qr.el)); return qr.submit.call($('form', qr.el));
}, },
captchaNode: function(e) { captchaNode: function(e) {
@ -1341,15 +1342,11 @@
$('#recaptcha_response_field', qr.el).value = ''; $('#recaptcha_response_field', qr.el).value = '';
$('#autohide', qr.el).checked = false; $('#autohide', qr.el).checked = false;
if (data.textContent === 'You seem to have mistyped the verification.') { if (data.textContent === 'You seem to have mistyped the verification.') {
if (qr.captcha.length) { setTimeout(qr.autoPost, 1000);
qr.autoPost();
}
} else if (data.textContent === 'Error: Duplicate file entry detected.' && qr.files.childElementCount) { } else if (data.textContent === 'Error: Duplicate file entry detected.' && qr.files.childElementCount) {
$('textarea', qr.el).value += '\n' + data.textContent + ' ' + data.href; $('textarea', qr.el).value += '\n' + data.textContent + ' ' + data.href;
qr.attachNext(); qr.attachNext();
if (qr.captcha.length) { setTimeout(qr.autoPost, 1000);
qr.autoPost();
}
} }
return; return;
} }

View File

@ -970,7 +970,6 @@ qr =
# error handling / logging # error handling / logging
# persistent captcha # persistent captcha
# rm Recaptcha # rm Recaptcha
# error too large error should happen on attach
init: -> init: ->
g.callbacks.push qr.node g.callbacks.push qr.node
$.bind window, 'message', qr.message $.bind window, 'message', qr.message
@ -999,11 +998,11 @@ qr =
$.replace oldFile, file $.replace oldFile, file
autoPost: -> autoPost: ->
return unless captcha = qr.captcha.shift()
$('#recaptcha_challenge_field', qr.el).value = captcha.challenge
responseField = $ '#recaptcha_response_field', qr.el responseField = $ '#recaptcha_response_field', qr.el
if !responseField.value and captcha = qr.captcha.shift() responseField.value = captcha.response
$('#recaptcha_challenge_field', qr.el).value = captcha.challenge responseField.nextSibling.textContent = qr.captcha.length + ' captcha cached'
responseField.value = captcha.response
responseField.nextSibling.textContent = qr.captcha.length + ' captcha cached'
qr.submit.call $ 'form', qr.el qr.submit.call $ 'form', qr.el
captchaNode: (e) -> captchaNode: (e) ->
@ -1086,13 +1085,11 @@ qr =
$('#recaptcha_response_field', qr.el).value = '' $('#recaptcha_response_field', qr.el).value = ''
$('#autohide', qr.el).checked = false $('#autohide', qr.el).checked = false
if data.textContent is 'You seem to have mistyped the verification.' if data.textContent is 'You seem to have mistyped the verification.'
if qr.captcha.length setTimeout qr.autoPost, 1000
qr.autoPost()
else if data.textContent is 'Error: Duplicate file entry detected.' and qr.files.childElementCount else if data.textContent is 'Error: Duplicate file entry detected.' and qr.files.childElementCount
$('textarea', qr.el).value += '\n' + data.textContent + ' ' + data.href $('textarea', qr.el).value += '\n' + data.textContent + ' ' + data.href
qr.attachNext() qr.attachNext()
if qr.captcha.length setTimeout qr.autoPost, 1000
qr.autoPost()
return return
if qr.el if qr.el