Gildas 2 tahun lalu
induk
melakukan
15684e1acf

File diff ditekan karena terlalu besar
+ 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);
 }
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini