2020-08-11 19:53:11 +02:00
|
|
|
(function() {
|
|
|
|
function injectScriptElement(src, onload) {
|
|
|
|
if (!src) {
|
|
|
|
return;
|
|
|
|
}
|
2019-05-22 14:49:57 -04:00
|
|
|
|
2020-08-11 19:53:11 +02:00
|
|
|
const script = document.createElement('script');
|
2020-08-25 10:12:35 +09:00
|
|
|
if (window.dashboardVersion) {
|
|
|
|
src += `?v=${window.dashboardVersion}`;
|
2020-08-11 19:53:11 +02:00
|
|
|
}
|
|
|
|
script.src = src;
|
|
|
|
script.setAttribute('async', '');
|
2020-02-26 10:29:52 -05:00
|
|
|
|
2020-08-11 19:53:11 +02:00
|
|
|
if (onload) {
|
|
|
|
script.onload = onload;
|
|
|
|
}
|
2020-04-23 18:31:11 +03:00
|
|
|
|
2020-08-11 19:53:11 +02:00
|
|
|
document.head.appendChild(script);
|
|
|
|
}
|
2020-07-16 22:19:09 +02:00
|
|
|
|
2020-08-11 19:53:11 +02:00
|
|
|
function loadSite() {
|
|
|
|
injectScriptElement(
|
|
|
|
'./libraries/alameda.js',
|
|
|
|
function() {
|
|
|
|
// onload of require library
|
|
|
|
injectScriptElement('./scripts/site.js');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2020-07-16 22:19:09 +02:00
|
|
|
|
2020-08-11 19:53:11 +02:00
|
|
|
try {
|
|
|
|
Promise.resolve();
|
|
|
|
} catch (ex) {
|
|
|
|
// this checks for several cases actually, typical is
|
|
|
|
// Promise() being missing on some legacy browser, and a funky one
|
|
|
|
// is Promise() present but buggy on WebOS 2
|
|
|
|
window.Promise = undefined;
|
2020-08-25 10:12:35 +09:00
|
|
|
window.Promise = undefined;
|
2020-08-11 19:53:11 +02:00
|
|
|
}
|
2020-07-16 22:19:09 +02:00
|
|
|
|
2020-08-25 10:12:35 +09:00
|
|
|
if (!window.Promise) {
|
2020-08-11 19:53:11 +02:00
|
|
|
// Load Promise polyfill if they are not natively supported
|
|
|
|
injectScriptElement(
|
|
|
|
'./libraries/npo.js',
|
|
|
|
loadSite
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
loadSite();
|
|
|
|
}
|
|
|
|
})();
|