Gildas 2 лет назад
Родитель
Сommit
15684e1acf
2 измененных файлов с 6 добавлено и 1 удалено
  1. 0 0
      lib/single-file-extension-bootstrap.js
  2. 6 1
      src/core/content/content-bootstrap.js

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
lib/single-file-extension-bootstrap.js


+ 6 - 1
src/core/content/content-bootstrap.js

@@ -73,6 +73,7 @@ if (globalThis.window == globalThis.top && location && location.href && (locatio
 }
 
 async function extractFile() {
+	debugger;
 	if (document.documentElement.dataset.sfz !== undefined) {
 		const data = await getContent();
 		document.querySelectorAll("#sfz-error-message").forEach(element => element.remove());
@@ -112,7 +113,11 @@ function getContent() {
 
 function executeBootstrap(data) {
 	const scriptElement = document.createElement("script");
-	scriptElement.textContent = "(() => { document.currentScript.remove(); globalThis.addEventListener('load', () => { const bootstrapReady = this.bootstrap && this.bootstrap([" + (new Uint8Array(data)).toString() + "]); }))()";
+	scriptElement.textContent = "(()=>{" +
+		"document.currentScript.remove();" +
+		"if (document.readyState=='complete') {run()} else {globalThis.addEventListener('load', run)}" +
+		"function run() {this.bootstrap([" + (new Uint8Array(data)).toString() + "])}" +
+		"})()";
 	document.body.appendChild(scriptElement);
 }
 

Некоторые файлы не были показаны из-за большого количества измененных файлов