mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-13 14:30:02 -04:00
fix rewriting
This commit is contained in:
parent
9be963e977
commit
00dbf22c70
4 changed files with 27 additions and 5 deletions
|
@ -21,3 +21,20 @@ declare global {
|
|||
__s: any;
|
||||
}
|
||||
}
|
||||
|
||||
const scripts = document.querySelectorAll("script:not([data-scramjet])");
|
||||
|
||||
for (const script of scripts) {
|
||||
const clone = document.createElement("script");
|
||||
|
||||
for (const attr of Array.from(script.attributes)) {
|
||||
clone.setAttribute(attr.name, attr.value);
|
||||
}
|
||||
|
||||
if (script.innerHTML !== "") {
|
||||
clone.innerHTML = script.innerHTML;
|
||||
}
|
||||
|
||||
script.insertAdjacentElement("afterend", clone);
|
||||
script.remove();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue