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:
parent
fe0c7d359e
commit
96963cb8b6
1 changed files with 47 additions and 45 deletions
|
@ -1,48 +1,50 @@
|
||||||
function injectScriptElement(src, onload) {
|
(function() {
|
||||||
if (!src) {
|
function injectScriptElement(src, onload) {
|
||||||
return;
|
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');
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
const script = document.createElement('script');
|
||||||
Promise.resolve();
|
if (self.dashboardVersion) {
|
||||||
} catch (ex) {
|
src += `?v=${self.dashboardVersion}`;
|
||||||
// this checks for several cases actually, typical is
|
}
|
||||||
// Promise() being missing on some legacy browser, and a funky one
|
script.src = src;
|
||||||
// is Promise() present but buggy on WebOS 2
|
script.setAttribute('async', '');
|
||||||
window.Promise = undefined;
|
|
||||||
self.Promise = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!self.Promise) {
|
if (onload) {
|
||||||
// Load Promise polyfill if they are not natively supported
|
script.onload = onload;
|
||||||
injectScriptElement(
|
}
|
||||||
'./libraries/npo.js',
|
|
||||||
loadSite
|
document.head.appendChild(script);
|
||||||
);
|
}
|
||||||
} else {
|
|
||||||
loadSite();
|
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();
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue