macro
This commit is contained in:
1 parent
d73f01c5f5
commit
f2559bc63e
3 files changed
+71
-42
No files matched your search
+2
-20
@@ -6,12 +6,8 @@
|
|||||||
<title>Queue Reader</title>
|
<title>Queue Reader</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{% if current_link %}
|
{% from 'macros.html' import magic_link %} {% if current_link %}
|
||||||
<p>
|
<p>{{ magic_link(current_link, current_link, "a") }}</p>
|
||||||
<a href="/r" target="_blank" rel="noopener noreferrer" id="a"
|
|
||||||
>{{ current_link }}</a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
<button id="b">skip/fw</button>
|
<button id="b">skip/fw</button>
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("b").addEventListener("click", async () => {
|
document.getElementById("b").addEventListener("click", async () => {
|
||||||
@@ -20,20 +16,6 @@
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
/**@type {HTMLAnchorElement}*/
|
|
||||||
const a = document.getElementById("a");
|
|
||||||
a.addEventListener("click", function (e) {
|
|
||||||
// all ts so safari works ://
|
|
||||||
e.preventDefault();
|
|
||||||
window.open(
|
|
||||||
this.href,
|
|
||||||
this.target,
|
|
||||||
Array.from(this.relList).join(", ")
|
|
||||||
);
|
|
||||||
setTimeout(() => {
|
|
||||||
window.location.reload();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>no</p>
|
<p>no</p>
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
{% macro magic_link(url, text, unique_id='magic_link') %}
|
||||||
|
<a
|
||||||
|
href="{{ url }}"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
id="{{ unique_id }}"
|
||||||
|
>
|
||||||
|
{{ text }}
|
||||||
|
</a>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
const a = document.getElementById("{{ unique_id }}");
|
||||||
|
a.addEventListener("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
window.open(
|
||||||
|
this.href,
|
||||||
|
this.target,
|
||||||
|
Array.from(this.relList).join(", ")
|
||||||
|
);
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
{% endmacro %} {% macro qrcode_queue(queue_items) %} {% if queue_items %}
|
||||||
|
<ol>
|
||||||
|
{% for item in queue_items %}
|
||||||
|
<li>
|
||||||
|
<a href="{{ item }}" target="_blank" rel="noreferrer noopener">
|
||||||
|
{{ item }}
|
||||||
|
<div class="qrcode"></div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
<style>
|
||||||
|
/* it works ig */
|
||||||
|
li:has(.qrcode) {
|
||||||
|
width: min-content;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/[email protected]/qrcode.js"></script>
|
||||||
|
<script>
|
||||||
|
window.addEventListener("load", (_) => {
|
||||||
|
document.querySelectorAll(".qrcode").forEach((e) => {
|
||||||
|
const a = e.parentElement.textContent.trim();
|
||||||
|
new QRCode(e, {
|
||||||
|
text: a,
|
||||||
|
correctLevel: QRCode.CorrectLevel.L,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endif %} {% endmacro %}
|
||||||
+14
-22
@@ -17,30 +17,22 @@
|
|||||||
></textarea>
|
></textarea>
|
||||||
<input type="submit" value="ahh" />
|
<input type="submit" value="ahh" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% if queue_items %}
|
|
||||||
<ol>
|
|
||||||
{% for item in queue_items %}
|
|
||||||
<li>
|
|
||||||
<a href="{{ item }}" target="_blank" rel="noreferrer noopener">
|
|
||||||
{{ item }}
|
|
||||||
<div class="qrcode"></div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ol>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/qrcode.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("load", (_) => {
|
/**@type {HTMLTextAreaElement} */
|
||||||
document.querySelectorAll(".qrcode").forEach((e) => {
|
(
|
||||||
const a = e.parentElement.textContent.trim();
|
// lifted from google search ai
|
||||||
new QRCode(e, {
|
document.getElementById("l")
|
||||||
text: a,
|
).addEventListener("keydown", function (e) {
|
||||||
correctLevel: QRCode.CorrectLevel.L,
|
// Check for Ctrl+Enter (Windows/Linux) or Command+Enter (Mac)
|
||||||
});
|
if ((e.ctrlKey || e.metaKey) && e.key === "Enter") {
|
||||||
});
|
e.preventDefault(); // Prevent the default newline character
|
||||||
|
// Submit the form associated with this textarea
|
||||||
|
this.form.submit();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% from "macros.html" import qrcode_queue %} {% if queue_items %}
|
||||||
|
<p>total: {{ queue_items|length }}</p>
|
||||||
|
{% endif %} {{ qrcode_queue(queue_items) }}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user