Last active
September 1, 2021 11:21
-
-
Save c7x43t/dc8441f1bcc6267c729356760892e4ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Execute a function as soon as the website has loaded | |
// compatibility: ES3 | |
function loadScript(script) { | |
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len;_key++) { | |
args[_key - 1] = arguments[_key]; | |
} | |
if (document.readyState === "complete" || document.readyState === "interactive") { | |
script.apply(void 0, args); | |
} else { | |
document.addEventListener("DOMContentLoaded",script.bind.apply(script, [this].concat(args))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment