-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathkms5.js
48 lines (36 loc) · 1.44 KB
/
kms5.js
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
var KMS = {};
(function (module) {
/********************************************************************/
function loadScriptsOnce(scriptList, globalVar, cb) {
if (typeof window[globalVar] === 'undefined') {
function getScript(url, success) {
var script = document.createElement('script');
script.src = url;
var head = document.getElementsByTagName('head')[0],
done = false;
script.onload = script.onreadystatechange = function () {
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
done = true;
script.onload = script.onreadystatechange = null;
head.removeChild(script);
success();
}
};
head.appendChild(script);
}
function getScriptAt(sList, i, success) {
if (i === sList.length) {
success();
} else {
getScript(sList[i], function () {
getScriptAt(sList, i + 1, success);
})
}
}
getScriptAt(scriptList, 0, cb);
} else {
cb();
}
}
/*************************************************************************/
}());