Much simpler way to prevent default text input focus on recaptcha reload.

This commit is contained in:
Nicolas Stepien 2012-05-31 10:53:34 +02:00
parent 1712549f62
commit 9210cf5b28
2 changed files with 3 additions and 6 deletions

View File

@ -1405,7 +1405,6 @@
}); });
$.before($.id('postForm'), link); $.before($.id('postForm'), link);
} }
$.globalEval('Recaptcha.focus_response_field=function(){}');
if (Conf['Persistent QR']) { if (Conf['Persistent QR']) {
QR.dialog(); QR.dialog();
if (Conf['Auto Hide QR']) { if (Conf['Auto Hide QR']) {
@ -1853,7 +1852,7 @@
return this.input.alt = count; return this.input.alt = count;
}, },
reload: function(focus) { reload: function(focus) {
window.location = 'javascript:Recaptcha.reload()'; window.location = 'javascript:Recaptcha.reload("t")';
if (focus) { if (focus) {
return QR.captcha.input.focus(); return QR.captcha.input.focus();
} }

View File

@ -1032,9 +1032,6 @@ QR =
$('textarea', QR.el).focus() $('textarea', QR.el).focus()
$.before $.id('postForm'), link $.before $.id('postForm'), link
# Prevent original captcha input from being focused on reload.
$.globalEval 'Recaptcha.focus_response_field=function(){}'
if Conf['Persistent QR'] if Conf['Persistent QR']
QR.dialog() QR.dialog()
QR.hide() if Conf['Auto Hide QR'] QR.hide() if Conf['Auto Hide QR']
@ -1381,7 +1378,8 @@ QR =
"Verification (#{count} cached captchas)" "Verification (#{count} cached captchas)"
@input.alt = count # For XTRM RICE. @input.alt = count # For XTRM RICE.
reload: (focus) -> reload: (focus) ->
window.location = 'javascript:Recaptcha.reload()' # the "t" argument prevents the input from being focused
window.location = 'javascript:Recaptcha.reload("t")'
# Focus if we meant to. # Focus if we meant to.
QR.captcha.input.focus() if focus QR.captcha.input.focus() if focus
keydown: (e) -> keydown: (e) ->