2013-08-11 03:26:38 +04:00
|
|
|
(function () {
|
|
|
|
|
|
|
|
var loadScript = function (src, callback) {
|
|
|
|
var script = window.document.createElement('script');
|
|
|
|
script.setAttribute('src',src);
|
|
|
|
script.setAttribute('onload',callback);
|
|
|
|
window.document.body.appendChild(script);
|
|
|
|
};
|
|
|
|
|
|
|
|
if (window.location.href.indexOf("debug") != -1) {
|
|
|
|
window.exports = {};
|
|
|
|
var scriptIndex = 0;
|
|
|
|
window.loadNextScript = function () {
|
2013-09-28 23:10:12 +04:00
|
|
|
if (scriptIndex == window.exports.scripts.length) {
|
2013-08-11 03:26:38 +04:00
|
|
|
pskl.app.init();
|
|
|
|
// cleanup
|
|
|
|
delete window.exports;
|
|
|
|
delete window.loadDebugScripts;
|
|
|
|
delete window.done;
|
|
|
|
} else {
|
2013-09-28 23:10:12 +04:00
|
|
|
loadScript(window.exports.scripts[scriptIndex], "loadNextScript()");
|
2013-08-11 03:26:38 +04:00
|
|
|
scriptIndex ++;
|
|
|
|
}
|
|
|
|
};
|
2013-08-11 12:45:56 +04:00
|
|
|
loadScript("piskel-script-list.js", "loadNextScript()");
|
2013-08-11 03:26:38 +04:00
|
|
|
} else {
|
|
|
|
var script;
|
|
|
|
if (window.location.href.indexOf("pack") != -1) {
|
|
|
|
script = "build/piskel-packaged.js";
|
|
|
|
} else {
|
|
|
|
script = "build/piskel-packaged-min.js";
|
|
|
|
}
|
|
|
|
var loaderInterval = window.setInterval(function () {
|
|
|
|
if (document.querySelectorAll("._ctl").length === 0) {
|
|
|
|
window.clearInterval(loaderInterval);
|
|
|
|
loadScript(script, "pskl.app.init()");
|
|
|
|
} else {
|
|
|
|
console.log("waiting for templates to load ....");
|
|
|
|
}
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
})();
|