Merge pull request #76 from jellyfin/fix-build-1

Fix loading order
This commit is contained in:
Odd Stråbø 2021-04-26 14:44:59 +02:00 committed by GitHub
commit d130aed974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,18 +46,28 @@ function modifyIndex() {
meta.setAttribute('content', 'default-src * \'self\' \'unsafe-inline\' \'unsafe-eval\' data: gap: file: filesystem: ws: wss:;');
this.head.appendChild(meta);
// Search for injected apploader
let apploader = this.body.querySelector('script[src*="apploader"]');
// Search for injected main.bundle
let apploader = this.head.querySelector('script[src^=main]');
if (!apploader) {
// inject apploader.js
apploader = this.createElement('script');
apploader.setAttribute('src', 'scripts/apploader.js');
if (apploader) {
console.debug('Found injected main.bundle');
apploader.setAttribute('defer', '');
this.body.appendChild(apploader);
} else {
console.debug('Found injected apploader');
apploader.setAttribute('defer', '');
// Search for injected apploader
apploader = this.body.querySelector('script[src*="apploader"]');
if (apploader) {
console.debug('Found injected apploader');
apploader.setAttribute('defer', '');
} else {
console.debug('Inject apploader');
// inject apploader.js
apploader = this.createElement('script');
apploader.setAttribute('src', 'scripts/apploader.js');
apploader.setAttribute('defer', '');
this.body.appendChild(apploader);
}
}
const injectTarget = apploader.parentNode;