From 9210cf5b28b59e2f3ad4d00eb237ebabe4fbb34b Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Thu, 31 May 2012 10:53:34 +0200 Subject: [PATCH] Much simpler way to prevent default text input focus on recaptcha reload. --- 4chan_x.user.js | 3 +-- script.coffee | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index ebc033aed..0cb722fad 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1405,7 +1405,6 @@ }); $.before($.id('postForm'), link); } - $.globalEval('Recaptcha.focus_response_field=function(){}'); if (Conf['Persistent QR']) { QR.dialog(); if (Conf['Auto Hide QR']) { @@ -1853,7 +1852,7 @@ return this.input.alt = count; }, reload: function(focus) { - window.location = 'javascript:Recaptcha.reload()'; + window.location = 'javascript:Recaptcha.reload("t")'; if (focus) { return QR.captcha.input.focus(); } diff --git a/script.coffee b/script.coffee index f4129fee6..a4ca8943c 100644 --- a/script.coffee +++ b/script.coffee @@ -1032,9 +1032,6 @@ QR = $('textarea', QR.el).focus() $.before $.id('postForm'), link - # Prevent original captcha input from being focused on reload. - $.globalEval 'Recaptcha.focus_response_field=function(){}' - if Conf['Persistent QR'] QR.dialog() QR.hide() if Conf['Auto Hide QR'] @@ -1381,7 +1378,8 @@ QR = "Verification (#{count} cached captchas)" @input.alt = count # For XTRM RICE. 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. QR.captcha.input.focus() if focus keydown: (e) ->