var Loader function function instanceof Array for var length var modul

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
var Loader = function() {
function k(a, c, d) {
a instanceof Array || (a = [a]);
for (var e = 0, f = 0; f < a.length; ++f) {
var g = a[f],
h = modules[g];
h.name = g, h.state = h.state || 0;
var i = b[g];
i ? c && i.cb[d ? "unshift" : "push"](c) : i = {
mod: h,
cb: c ? [c] : []
}, h.state == j ? l(i) : (b[g] = i, h.deps && h.deps.length && k(h.deps), ++e)
}
e && n()
}
function l(a) {
var d = !0;
if (a.mod.state != j && (a.mod.state = i, a.mod.deps))
for (var e = 0; e < a.mod.deps.length; ++e)
if (modules[a.mod.deps[e]].state != j) {
d = !1;
break
}
var f = !1;
if (d) {
a.mod.state != j && (a.mod.state = j, a.mod.init && a.mod.init(), f = !0), c[a.mod.name] || (c[a.mod.name] = 1, a.mod.onRequest && a.mod.onRequest());
for (var e = 0; e < a.cb.length; ++e) a.cb[e] && a.cb[e]();
delete b[a.mod.name]
}
return f
}
function m(a) {
if (this.parentNode) {
if (this._done || this.readyState && "loaded" !== this.readyState && "complete" !== this.readyState) return;
this._done = !0, this.onload = this.onreadystatechange = null, d[this.script_name] = 2, this.parentNode.removeChild(this)
}
console.log(a.mod._scripts, a.mod.name, a.mod.scripts), 0 == --a.mod._scripts && (l(a), n())
}
function n() {
if (!f) return e = !0, void 0;
for (;;) {
var a = !0;
for (var c in b) {
var d = b[c];
if (d.mod.state) d.mod.state != h && l(d) && (a = !1);
else {
if (d.mod.state = h, d.mod.preSetup && d.mod.preSetup.apply(d.mod, d.mod), d.mod._scripts = d.mod.scripts.length, d.mod.styles)
for (var g = 0; g < d.mod.styles.length; g++) document.body.insertBefore(ce("link", {
type: "text/css",
rel: "stylesheet",
href: p(d.mod.styles[g], CSS_URL, REVISION)
}), document.body.firstChild);
for (var g = 0; g < d.mod.scripts.length; ++g) t(p(d.mod.scripts[g], BASE_URL, REVISION), mk_callback(null, m, [d]))
}
}
if (a) break
}
}
function o() {
for (var a = document.getElementsByTagName("script"), b = document.location.protocol + "//" + document.location.hostname, c = 0; c < a.length; ++c) {
var g = a[c];
g.parentNode && g.src && 0 == g.src.indexOf(b) && (d[s(g.src)] = 1)
}
f = !0, e && (e = !1, n()), document.body.className += " js-on"
}
function p(a, b, c) {
return b = r(b), 0 == a.indexOf(b + "/") ? q(a, c) : 0 == a.indexOf("http:") || 0 == a.indexOf("https:") ? a : "/" == a.charAt(0) ? q(b + a, c) : q(b + "/" + a, c)
}
function q(a, b) {
var c = a.indexOf("?");
return c > 0 && (a = a.substr(0, c)), b ? a + "?r=" + b : a
}
function r(a) {
return "/" == a.charAt(0) ? location.protocol + "://" + location.host + a : a
}
function s(a) {
return p(a, BASE_URL, null)
}
function t(a, b) {
var c = s(a);
return d[c] ? (console.error("уже загружн: " + c, "=>", d[c]), b(), void 0) : (document.body.insertBefore(ce("script", {
script_name: c,
src: src,
type: "text/javascript",
async: "async",
_done: !1,
onreadystatechange: b,
onload: b
}), document.body.firstChild), void 0)
}
function u(a, b) {
for (a.length || b && setTimeout(b); a.length > 0;) {
var c = a.shift();
if (c.src) {
var d = document.createElement("script");
d.src = c.src, d.type = "text/javascript", d.async = "async", d.onload = function() {
Loader.loadScripts(a, b)
}, c.parentElement ? c.parentElement.replaceChild(d, c) : document.body.appendChild(d), c = null;
break
}
setTimeout(c.textContent), 0 == a.length && b && setTimeout(b)
}
}
var b = {},
c = {},
d = {},
e = !1,
f = !1,
h = 1,
i = 2,
j = 3;
return {
require: k,
loadScripts: u,
onDomReady: o,
onNewRequestHandler: function() {
c = {}
},
dump: function() {
console.log(b)
}
}
}();
window.require = Loader.require, window.module_init = function(a, b) {
return Loader.require(a, b, !0)
};