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) {
|
||||
return;
|
||||
}
|
||||
|
@ -15,9 +16,9 @@ function injectScriptElement(src, onload) {
|
|||
}
|
||||
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
}
|
||||
|
||||
function loadSite() {
|
||||
function loadSite() {
|
||||
injectScriptElement(
|
||||
'./libraries/alameda.js',
|
||||
function() {
|
||||
|
@ -25,24 +26,25 @@ function loadSite() {
|
|||
injectScriptElement('./scripts/site.js');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
Promise.resolve();
|
||||
} catch (ex) {
|
||||
} 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) {
|
||||
if (!self.Promise) {
|
||||
// Load Promise polyfill if they are not natively supported
|
||||
injectScriptElement(
|
||||
'./libraries/npo.js',
|
||||
loadSite
|
||||
);
|
||||
} else {
|
||||
} else {
|
||||
loadSite();
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue