This commit is contained in:
lda committed 2025-12-17 13:25:32 +07:00
1 parent d73f01c5f5
commit f2559bc63e
3 files changed
+71 -42

No files matched your search

+2 -20
View File
@@ -6,12 +6,8 @@
<title>Queue Reader</title>
</head>
<body>
{% if current_link %}
<p>
<a href="/r" target="_blank" rel="noopener noreferrer" id="a"
>{{ current_link }}</a
>
</p>
{% from 'macros.html' import magic_link %} {% if current_link %}
<p>{{ magic_link(current_link, current_link, "a") }}</p>
<button id="b">skip/fw</button>
<script>
document.getElementById("b").addEventListener("click", async () => {
@@ -20,20 +16,6 @@
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>
{% else %}
<p>no</p>
+55
View File
@@ -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
View File
@@ -17,30 +17,22 @@
></textarea>
<input type="submit" value="ahh" />
</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>
window.addEventListener("load", (_) => {
document.querySelectorAll(".qrcode").forEach((e) => {
const a = e.parentElement.textContent.trim();
new QRCode(e, {
text: a,
correctLevel: QRCode.CorrectLevel.L,
});
});
/**@type {HTMLTextAreaElement} */
(
// lifted from google search ai
document.getElementById("l")
).addEventListener("keydown", function (e) {
// 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>
{% endif %}
{% from "macros.html" import qrcode_queue %} {% if queue_items %}
<p>total: {{ queue_items|length }}</p>
{% endif %} {{ qrcode_queue(queue_items) }}
</body>
</html>