mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 22:40:01 -04:00
clean scramjet scripts from dom
This commit is contained in:
parent
066777fe94
commit
0c0490e751
5 changed files with 25 additions and 2 deletions
|
@ -19,7 +19,12 @@ fi
|
|||
|
||||
time wasm-opt $WASMOPTFLAGS -O4 --vacuum --dce --enable-threads --enable-bulk-memory --enable-simd "$WASM" -o rewriter/out/optimized.wasm
|
||||
|
||||
echo -n "self.WASM = '" > dist/scramjet.wasm.js
|
||||
cat <<EOF > dist/scramjet.wasm.js
|
||||
if ("document" in self && document.currentScript) {
|
||||
document.currentScript.remove();
|
||||
}
|
||||
EOF
|
||||
echo -n "self.WASM = '" >> dist/scramjet.wasm.js
|
||||
base64 -w0 < "rewriter/out/optimized.wasm" >> dist/scramjet.wasm.js
|
||||
echo -n "';">> dist/scramjet.wasm.js
|
||||
echo "Rewriter Build Complete!"
|
||||
|
|
|
@ -22,3 +22,7 @@ if (!(ScramjetClient.SCRAMJET in self)) {
|
|||
runtime.hook();
|
||||
}
|
||||
}
|
||||
|
||||
if ("document" in self && document.currentScript) {
|
||||
document.currentScript.remove();
|
||||
}
|
||||
|
|
|
@ -90,3 +90,7 @@ self.$scramjet.codecs = {
|
|||
xor,
|
||||
base64,
|
||||
};
|
||||
|
||||
if ("document" in self && document.currentScript) {
|
||||
document.currentScript.remove();
|
||||
}
|
||||
|
|
|
@ -29,3 +29,7 @@ self.$scramjet.shared = {
|
|||
rewriteWorkers,
|
||||
},
|
||||
};
|
||||
|
||||
if ("document" in self && document.currentScript) {
|
||||
document.currentScript.remove();
|
||||
}
|
||||
|
|
|
@ -136,7 +136,13 @@ function traverseParsedHtml(node, origin?: URL) {
|
|||
src:
|
||||
"data:application/javascript;base64," +
|
||||
btoa(
|
||||
`self.$scramjet.config = ${JSON.stringify(self.$scramjet.config)}; self.$scramjet.codec = self.$scramjet.codecs[self.$scramjet.config.codec];`
|
||||
`
|
||||
self.$scramjet.config = ${JSON.stringify(self.$scramjet.config)};
|
||||
self.$scramjet.codec = self.$scramjet.codecs[self.$scramjet.config.codec];
|
||||
if ("document" in self && document.currentScript) {
|
||||
document.currentScript.remove();
|
||||
}
|
||||
`
|
||||
),
|
||||
"data-scramjet": "true",
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue