seamless
This commit is contained in:
1 parent
5990eb424d
commit
4a2974098f
1 file changed
+27
-6
+27
-6
@@ -45,12 +45,6 @@
|
||||
|
||||
// do trix
|
||||
if (newTab) {
|
||||
// background
|
||||
if (newTab.document.body) {
|
||||
newTab.document.body.style.backgroundColor =
|
||||
getComputedStyle(document.body).backgroundColor;
|
||||
}
|
||||
|
||||
newTab.addEventListener("message", () => {
|
||||
// Swap roles: Current tab -> Content, New tab -> Controller
|
||||
location.replace("/r");
|
||||
@@ -59,6 +53,33 @@
|
||||
});
|
||||
// Trigger the message event to run the swap on the next tick
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user