1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Wrap appLoader in anonymous function

This commit is contained in:
MrTimscampi 2020-08-11 19:53:11 +02:00
parent fe0c7d359e
commit 96963cb8b6

View file

@ -1,48 +1,50 @@
function injectScriptElement(src, onload) {
if (!src) {
return;
}
const script = document.createElement('script');
if (self.dashboardVersion) {
src += `?v=${self.dashboardVersion}`;
}
script.src = src;
script.setAttribute('async', '');
if (onload) {
script.onload = onload;
}
document.head.appendChild(script);
}
function loadSite() {
injectScriptElement(
'./libraries/alameda.js',
function() {
// onload of require library
injectScriptElement('./scripts/site.js');
(function() {
function injectScriptElement(src, onload) {
if (!src) {
return;
}
);
}
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;
self.Promise = undefined;
}
const script = document.createElement('script');
if (self.dashboardVersion) {
src += `?v=${self.dashboardVersion}`;
}
script.src = src;
script.setAttribute('async', '');
if (!self.Promise) {
// Load Promise polyfill if they are not natively supported
injectScriptElement(
'./libraries/npo.js',
loadSite
);
} else {
loadSite();
}
if (onload) {
script.onload = onload;
}
document.head.appendChild(script);
}
function loadSite() {
injectScriptElement(
'./libraries/alameda.js',
function() {
// onload of require library
injectScriptElement('./scripts/site.js');
}
);
}
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;
self.Promise = undefined;
}
if (!self.Promise) {
// Load Promise polyfill if they are not natively supported
injectScriptElement(
'./libraries/npo.js',
loadSite
);
} else {
loadSite();
}
})();