This commit is contained in:
lda committed 2025-12-29 15:03:03 +07:00
1 parent 58d3e58759
commit c09e018bc5
4 files changed
+50 -44

No files matched your search

-31
View File
@@ -45,37 +45,6 @@
});
// Trigger the message event to run the swap on the next tick
newTab.postMessage("");
// background. This block is racing with the slow internet.
if (newTab.document.body) {
newTab.document.body.style.backgroundColor =
getComputedStyle(document.body).backgroundColor;
document
.querySelectorAll("body > *:not(script)")
.forEach((f) =>
newTab.document.body.appendChild(
f.cloneNode(true)
)
);
// maybe just replace the whole document with this one and then use API to check length
// i aint doing that
const st = new newTab.CSSStyleSheet();
[
...document.styleSheets,
...document.adoptedStyleSheets,
].forEach((i) =>
Array.from(i.cssRules).forEach((ii) =>
st.insertRule(
ii.cssText,
st.cssRules.length
)
)
);
newTab.document.adoptedStyleSheets.push(st);
newTab.document.close();
}
}
});
});