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,4 +1,5 @@
|
||||||
function injectScriptElement(src, onload) {
|
(function() {
|
||||||
|
function injectScriptElement(src, onload) {
|
||||||
if (!src) {
|
if (!src) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,9 +16,9 @@ function injectScriptElement(src, onload) {
|
||||||
}
|
}
|
||||||
|
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSite() {
|
function loadSite() {
|
||||||
injectScriptElement(
|
injectScriptElement(
|
||||||
'./libraries/alameda.js',
|
'./libraries/alameda.js',
|
||||||
function() {
|
function() {
|
||||||
|
@ -25,24 +26,25 @@ function loadSite() {
|
||||||
injectScriptElement('./scripts/site.js');
|
injectScriptElement('./scripts/site.js');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Promise.resolve();
|
Promise.resolve();
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// this checks for several cases actually, typical is
|
// this checks for several cases actually, typical is
|
||||||
// Promise() being missing on some legacy browser, and a funky one
|
// Promise() being missing on some legacy browser, and a funky one
|
||||||
// is Promise() present but buggy on WebOS 2
|
// is Promise() present but buggy on WebOS 2
|
||||||
window.Promise = undefined;
|
window.Promise = undefined;
|
||||||
self.Promise = undefined;
|
self.Promise = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.Promise) {
|
if (!self.Promise) {
|
||||||
// Load Promise polyfill if they are not natively supported
|
// Load Promise polyfill if they are not natively supported
|
||||||
injectScriptElement(
|
injectScriptElement(
|
||||||
'./libraries/npo.js',
|
'./libraries/npo.js',
|
||||||
loadSite
|
loadSite
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
loadSite();
|
loadSite();
|
||||||
}
|
}
|
||||||
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue