tricks
This commit is contained in:
1 parent
5a1ae7f842
commit
ebab37fc00
3 files changed
+27
-18
No files matched your search
+20
-12
@@ -9,11 +9,12 @@
|
||||
href="{{ url_for('static', path='style.css') }}"
|
||||
/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% if queue_length > 0 %}
|
||||
<div class="trail-container">
|
||||
<div class="trail-count">{{ queue_length }}</div>
|
||||
<p>Items Left</p>
|
||||
<p>items left</p>
|
||||
|
||||
<p
|
||||
style="
|
||||
@@ -35,22 +36,29 @@
|
||||
<div class="trail-hint">Tap anywhere to open & next</div>
|
||||
</div>
|
||||
<script>
|
||||
if (window.opener) {
|
||||
// new tab = window open no "noopener".
|
||||
console.log(/** @type {Window} */ (window.opener)); // hi hello hi
|
||||
}
|
||||
window.addEventListener("load", () => {
|
||||
document.body.addEventListener("click", async (e) => {
|
||||
document.body.addEventListener("click", (e) => {
|
||||
if (e.target.tagName === "A") return;
|
||||
// now this is not the new updated
|
||||
const newTab = window.open("", "_blank");
|
||||
|
||||
// do trix
|
||||
await fetch("/r", { redirect: "manual" });
|
||||
if (newTab) {
|
||||
// background
|
||||
if (newTab.document.body) {
|
||||
newTab.document.body.style.backgroundColor =
|
||||
getComputedStyle(document.body).backgroundColor;
|
||||
}
|
||||
|
||||
// now this is the new updated
|
||||
const newTab = window.open(window.location.href, "_blank");
|
||||
|
||||
// yo this is good no security error
|
||||
window.location.replace("{{ current_link }}");
|
||||
newTab.addEventListener("message", () => {
|
||||
// Swap roles: Current tab -> Content, New tab -> Controller
|
||||
location.replace("/r");
|
||||
newTab.opener = null;
|
||||
newTab.location.replace(window.location.href);
|
||||
});
|
||||
// Trigger the message event to run the swap on the next tick
|
||||
newTab.postMessage("");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user