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

View File

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