This commit is contained in:
lda committed 2025-12-18 04:39:30 +07:00
1 parent 5990eb424d
commit 4a2974098f
1 file changed
+27 -6
+27 -6
View File
@@ -45,12 +45,6 @@
// do trix // do trix
if (newTab) { if (newTab) {
// background
if (newTab.document.body) {
newTab.document.body.style.backgroundColor =
getComputedStyle(document.body).backgroundColor;
}
newTab.addEventListener("message", () => { newTab.addEventListener("message", () => {
// Swap roles: Current tab -> Content, New tab -> Controller // Swap roles: Current tab -> Content, New tab -> Controller
location.replace("/r"); location.replace("/r");
@@ -59,6 +53,33 @@
}); });
// Trigger the message event to run the swap on the next tick // Trigger the message event to run the swap on the next tick
newTab.postMessage(""); newTab.postMessage("");
// background
if (newTab.document.body) {
newTab.document.body.style.backgroundColor =
getComputedStyle(document.body).backgroundColor;
const f =
document.querySelector(".trail-container");
if (f)
newTab.document.body.innerHTML += f.outerHTML;
// 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);
}
} }
}); });
}); });