MJ: fix 1

This commit is contained in:
2026-04-26 13:01:58 +03:00
parent 929af21d08
commit a5d57d55fc

View File

@@ -124,14 +124,22 @@ async function pollAndExecute() {
} }
// ---------------------------------------------------------------- // ----------------------------------------------------------------
// Boot // Boot — works whether page is already loaded or not.
// When eval()'d dynamically the 'load' event has already fired,
// so we check readyState and boot immediately in that case.
// ---------------------------------------------------------------- // ----------------------------------------------------------------
window.addEventListener('load', () => { function boot() {
log('Grepolis Remote Control v4.0.0 (remote) loaded'); log('Grepolis Remote Control v4.0.0 (remote) loaded');
detectCaptcha(); detectCaptcha();
setTimeout(pushState, 5000); setTimeout(pushState, 5000);
jitterLoop(pushState, 60000, 120000); jitterLoop(pushState, 60000, 120000);
jitterLoop(pollAndExecute, 8000, 18000); jitterLoop(pollAndExecute, 8000, 18000);
}); }
if (document.readyState === 'complete') {
// Page already loaded (normal case when eval()'d dynamically)
boot();
} else {
// Fallback: wait for load event (shouldn't happen but safe to keep)
window.addEventListener('load', boot);
}