This commit is contained in:
Nicolas Stepien 2012-12-18 16:11:15 +01:00
parent c32b6dba59
commit a5a5f297e4
2 changed files with 13 additions and 9 deletions

View File

@ -1834,7 +1834,7 @@
$.add(el, err);
}
QR.open();
if (QR.captchaIsEnabled && /captcha|verification/i.test(el.textContent)) {
if (QR.captcha.isEnabled && /captcha|verification/i.test(el.textContent)) {
$('[autocomplete]', QR.el).focus();
}
if (d.hidden || d.oHidden || d.mozHidden || d.webkitHidden) {
@ -2286,7 +2286,7 @@
if (-1 !== d.cookie.indexOf('pass_enabled=')) {
return;
}
if (!(QR.captchaIsEnabled = !!$.id('captchaFormPart'))) {
if (!(this.isEnabled = !!$.id('captchaFormPart'))) {
return;
}
if ($.id('recaptcha_challenge_field_holder')) {
@ -2523,7 +2523,7 @@
} else if (!(reply.com || reply.file)) {
err = 'No file selected.';
}
if (QR.captchaIsEnabled && !err) {
if (QR.captcha.isEnabled && !err) {
captchas = $.get('captchas', []);
while ((captcha = captchas[0]) && captcha.time < Date.now()) {
captchas.shift();
@ -2632,7 +2632,7 @@
if (/mistyped/i.test(err.textContent)) {
err = 'Error: You seem to have mistyped the CAPTCHA.';
}
QR.cooldown.auto = QR.captchaIsEnabled ? !!$.get('captchas', []).length : true;
QR.cooldown.auto = QR.captcha.isEnabled ? !!$.get('captchas', []).length : err === 'Connection error with sys.4chan.org.' ? true : false;
QR.cooldown.set({
delay: 2
});

View File

@ -1416,7 +1416,7 @@ QR =
el.innerHTML = null
$.add el, err
QR.open()
if QR.captchaIsEnabled and /captcha|verification/i.test el.textContent
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
# Focus the captcha input on captcha error.
$('[autocomplete]', QR.el).focus()
alert el.textContent if d.hidden or d.oHidden or d.mozHidden or d.webkitHidden
@ -1780,7 +1780,7 @@ QR =
captcha:
init: ->
return if -1 isnt d.cookie.indexOf 'pass_enabled='
return unless QR.captchaIsEnabled = !!$.id 'captchaFormPart'
return unless @isEnabled = !!$.id 'captchaFormPart'
if $.id 'recaptcha_challenge_field_holder'
@ready()
else
@ -1975,7 +1975,7 @@ QR =
else unless reply.com or reply.file
err = 'No file selected.'
if QR.captchaIsEnabled and !err
if QR.captcha.isEnabled and !err
# get oldest valid captcha
captchas = $.get 'captchas', []
# remove old captchas
@ -2080,10 +2080,14 @@ QR =
err = 'Error: You seem to have mistyped the CAPTCHA.'
# Enable auto-post if we have some cached captchas.
QR.cooldown.auto =
if QR.captchaIsEnabled
if QR.captcha.isEnabled
!!$.get('captchas', []).length
else
else if err is 'Connection error with sys.4chan.org.'
true
else
# Something must've gone terribly wrong if you get captcha errors without captchas.
# Don't auto-post indefinitely in that case.
false
# Too many frequent mistyped captchas will auto-ban you!
# On connection error, the post most likely didn't go through.
QR.cooldown.set delay: 2