Start auto-post on connection error when possible. Provide some feedback that we're starting to submit.

This commit is contained in:
Nicolas Stepien 2012-01-26 06:48:59 +01:00
parent 8cd6598e00
commit c94b08c1ab
2 changed files with 19 additions and 9 deletions

View File

@ -1678,6 +1678,9 @@
recaptcha_challenge_field: challenge,
recaptcha_response_field: response
};
qr.status({
progress: '...'
});
if (engine === 'gecko' && reply.file) {
file = {};
reader = new FileReader();
@ -1702,18 +1705,19 @@
} else if (b.childElementCount) {
if (b.firstChild.tagName) node = b.firstChild;
err = b.firstChild.textContent;
if (err === 'You seem to have mistyped the verification.') {
}
if (err) {
if (err === 'You seem to have mistyped the verification.' || err === 'Connection error with sys.4chan.org.') {
qr.cooldown.auto = !!$.get('captchas', []).length;
qr.cooldown.set(10);
} else {
qr.cooldown.auto = false;
}
}
qr.status();
if (err) {
qr.status();
qr.error(err, node);
return;
}
qr.status();
reply = qr.replies[0];
persona = $.get('qr.persona', {});
persona = {

View File

@ -1252,6 +1252,10 @@ qr =
recaptcha_challenge_field: challenge
recaptcha_response_field: response
# Starting to upload might take some time.
# Provide some feedback that we're starting to submit.
qr.status progress: '...'
if engine is 'gecko' and reply.file
# https://bugzilla.mozilla.org/show_bug.cgi?id=673742
# We plan to allow postMessaging Files and FileLists across origins,
@ -1275,20 +1279,22 @@ qr =
else if b.childElementCount # error!
node = b.firstChild if b.firstChild.tagName # duplicate image link
err = b.firstChild.textContent
if err is 'You seem to have mistyped the verification.'
if err
if err is 'You seem to have mistyped the verification.' or err is 'Connection error with sys.4chan.org.'
# Enable auto-post if we have some cached captchas.
qr.cooldown.auto = !!$.get('captchas', []).length
# Too many frequent mistyped captchas will auto-ban you!
# On connection error, the post most likely didn't go through.
qr.cooldown.set 10
else # stop auto-posting
qr.cooldown.auto = false
qr.status()
if err
qr.status()
qr.error err, node
return
qr.status()
reply = qr.replies[0]
persona = $.get 'qr.persona', {}