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);
} }
script = $.el('script', { setTimeout(function() {
textContent: 'Recaptcha.focus_response_field=function(){}' var script;
script = $.el('script', {
textContent: 'Recaptcha.focus_response_field=function(){}'
});
$.add(d.head, script);
return $.rm(script);
}); });
$.add(d.head, script);
$.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,10 +1036,12 @@ 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
# Prevent original captcha input from being focused on reload. # This is extemely slow, execute is asynchronously.
script = $.el 'script', textContent: 'Recaptcha.focus_response_field=function(){}' setTimeout ->
$.add d.head, script # Prevent original captcha input from being focused on reload.
$.rm script script = $.el 'script', textContent: 'Recaptcha.focus_response_field=function(){}'
$.add d.head, script
$.rm script
if conf['Persistent QR'] if conf['Persistent QR']
qr.dialog() qr.dialog()