commento.js: remove double call protection
This commit is contained in:
parent
c7b3686506
commit
a9d7076c2e
@ -1273,12 +1273,7 @@
|
|||||||
$(ID_LOGIN_BOX_EMAIL_INPUT).focus();
|
$(ID_LOGIN_BOX_EMAIL_INPUT).focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
var mainExecuted = false;
|
|
||||||
function main(callback) {
|
function main(callback) {
|
||||||
if (mainExecuted)
|
|
||||||
return;
|
|
||||||
mainExecuted = true;
|
|
||||||
|
|
||||||
root = $(ID_ROOT);
|
root = $(ID_ROOT);
|
||||||
|
|
||||||
loginBoxCreate();
|
loginBoxCreate();
|
||||||
@ -1299,7 +1294,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("domready", main);
|
// There's no danger of both main()s being called because if the first one is
|
||||||
|
// called later, the second `main()` wouldn't have executed because readyState
|
||||||
|
// woldn't have been "interactive" or "complete" at registration. If the
|
||||||
|
// second main() executes, the first would never execute because
|
||||||
|
// DOMContentLoaded wouldn't be fired in the future.
|
||||||
|
document.addEventListener("DOMContentLoaded", main);
|
||||||
if (document.readyState == "interactive" || document.readyState == "complete")
|
if (document.readyState == "interactive" || document.readyState == "complete")
|
||||||
main();
|
main();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user