This commit is contained in:
Ilya Kantor 2015-11-18 16:15:29 +03:00
parent 4bca225593
commit 547854a151
1655 changed files with 847 additions and 89231 deletions

View file

@ -1,3 +0,0 @@
function a() {
b();
}

View file

@ -1,3 +0,0 @@
function b() {
c();
}

View file

@ -1,3 +0,0 @@
function c() {
alert('ok');
}

View file

@ -1,54 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
function addScript(src) {
var script = document.createElement('script');
script.src = src;
var s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(script, s);
return script;
}
function addScripts(scripts, callback) {
var loaded = {}; // Для загруженных файлов loaded[i] = true
var counter = 0;
function onload(i) {
if (loaded[i]) return; // лишний вызов onload/onreadystatechange
loaded[i] = true;
counter++;
if (counter == scripts.length) callback();
}
for (var i = 0; i < scripts.length; i++)(function(i) {
var script = addScript(scripts[i]);
script.onload = function() {
onload(i);
};
script.onreadystatechange = function() { // IE8-
if (this.readyState == 'loaded' || this.readyState == 'complete') {
setTimeout(this.onload, 0); // возможны повторные вызовы onload
}
};
}(i));
}
addScripts(["a.js", "b.js", "c.js"], function() {
a()
});
</script>
</body>
</html>