Save some hundreads of ms in qr.init.

This commit is contained in:
Nicolas Stepien 2012-03-03 04:31:48 +01:00
parent 82a92c3799
commit f77e4b35f9
2 changed files with 14 additions and 9 deletions

View File

@ -1265,7 +1265,7 @@
qr = { qr = {
init: function() { init: function() {
var form, iframe, link, loadChecking, script; var form, iframe, link, loadChecking;
if (!$.id('recaptcha_challenge_field_holder')) return; if (!$.id('recaptcha_challenge_field_holder')) return;
if (conf['Hide Original Post Form']) { if (conf['Hide Original Post Form']) {
link = $.el('h1', { link = $.el('h1', {
@ -1306,11 +1306,14 @@
}); });
$.add(d.head, iframe); $.add(d.head, iframe);
} }
setTimeout(function() {
var script;
script = $.el('script', { script = $.el('script', {
textContent: 'Recaptcha.focus_response_field=function(){}' textContent: 'Recaptcha.focus_response_field=function(){}'
}); });
$.add(d.head, script); $.add(d.head, script);
$.rm(script); return $.rm(script);
});
if (conf['Persistent QR']) { if (conf['Persistent QR']) {
qr.dialog(); qr.dialog();
if (conf['Auto Hide QR']) qr.hide(); if (conf['Auto Hide QR']) qr.hide();

View File

@ -1036,6 +1036,8 @@ qr =
$.on iframe, 'load', -> if @src isnt 'about:blank' then setTimeout loadChecking, 500, @ $.on iframe, 'load', -> if @src isnt 'about:blank' then setTimeout loadChecking, 500, @
$.add d.head, iframe $.add d.head, iframe
# This is extemely slow, execute is asynchronously.
setTimeout ->
# Prevent original captcha input from being focused on reload. # Prevent original captcha input from being focused on reload.
script = $.el 'script', textContent: 'Recaptcha.focus_response_field=function(){}' script = $.el 'script', textContent: 'Recaptcha.focus_response_field=function(){}'
$.add d.head, script $.add d.head, script