commento.js: allow dynamic script loading

This commit is contained in:
Adhityaa 2018-06-11 14:18:32 +05:30
parent 70505c5f06
commit 9e682a964a

View File

@ -1273,7 +1273,12 @@
$(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();
@ -1294,6 +1299,8 @@
}); });
} }
document.addEventListener("DOMContentLoaded", main); document.addEventListener("domready", main);
if (document.readyState == "interactive" || document.readyState == "complete")
main();
}(window, document)); }(window, document));