tricks
This commit is contained in:
1 parent
5a1ae7f842
commit
ebab37fc00
3 files changed
+27
-18
No files matched your search
@@ -1,5 +1,4 @@
|
||||
{% macro magic_link(url, text, unique_id='magic_link') %}
|
||||
{# Example Macro #}
|
||||
{% macro magic_link(url, text, unique_id='magic_link') %} {# Example Macro #}
|
||||
<a
|
||||
href="{{ url }}"
|
||||
target="_blank"
|
||||
@@ -24,13 +23,15 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endmacro %} {% macro qrcode_queue(queue_items) %} {% if queue_items %}
|
||||
{% endmacro %} {% macro qrcode_queue(queue_items, qr_limit = 100) %} {% if
|
||||
queue_items %}
|
||||
<ol class="queue-grid">
|
||||
{% for item in queue_items %}
|
||||
<li>
|
||||
<a href="{{ item }}" target="_blank" rel="noreferrer noopener">
|
||||
{{ item }}
|
||||
{{ item }} {% if not loop.index > qr_limit %}
|
||||
<div class="qrcode"></div>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
+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