fix: poll iframe for canvas instead of load event for accurate Nitro ready detection

This commit is contained in:
root
2026-05-22 21:25:26 +02:00
parent 16dd87d365
commit f694caa397
2 changed files with 22 additions and 10 deletions
@@ -807,11 +807,17 @@
}
}
if (iframe) {
iframe.addEventListener('load', function() {
var elapsed = Date.now() - startTime;
var minWait = Math.max(0, 4500 - elapsed);
setTimeout(hideOverlay, minWait);
});
var poll = setInterval(function() {
try {
var doc = iframe.contentDocument || iframe.contentWindow?.document;
if (doc && doc.querySelector('canvas')) {
clearInterval(poll);
var elapsed = Date.now() - startTime;
var minWait = Math.max(0, 3000 - elapsed);
setTimeout(hideOverlay, minWait);
}
} catch(e) {}
}, 200);
}
setTimeout(hideOverlay, 15000);
})();
@@ -668,11 +668,17 @@
}
}
if (iframe) {
iframe.addEventListener('load', function() {
var elapsed = Date.now() - startTime;
var minWait = Math.max(0, 4500 - elapsed);
setTimeout(hideOverlay, minWait);
});
var poll = setInterval(function() {
try {
var doc = iframe.contentDocument || iframe.contentWindow?.document;
if (doc && doc.querySelector('canvas')) {
clearInterval(poll);
var elapsed = Date.now() - startTime;
var minWait = Math.max(0, 3000 - elapsed);
setTimeout(hideOverlay, minWait);
}
} catch(e) {}
}, 200);
}
setTimeout(hideOverlay, 15000);
})();