Files
qrcode-from-onetab/templates/reader.html
T
2025-12-17 22:09:07 +07:00

59 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Queue Reader</title>
<link
rel="stylesheet"
href="{{ url_for('static', path='style.css') }}"
/>
</head>
<body>
{% from 'macros.html' import magic_link %} {% if current_link %}
<div class="card">
<h2>Current Link</h2>
<p>{{ magic_link(current_link, current_link, "a") }}</p>
<div class="qrcode" id="current-qr"></div>
<div class="actions" style="margin-top: 20px">
<button id="b" class="btn">Skip / Next</button>
</div>
<p style="margin-top: 10px; font-size: 0.8rem; color: #666">
{{ queue_length }} items remaining
</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/qrcode.js"></script>
<script>
// QR Code generation
new QRCode(document.getElementById("current-qr"), {
text: "{{ current_link }}",
correctLevel: QRCode.CorrectLevel.L,
width: 256,
height: 256,
});
// Skip button logic
document.getElementById("b").addEventListener("click", async () => {
await fetch("/r", { redirect: "manual" });
setTimeout(() => {
window.location.reload();
});
});
</script>
{% else %}
<div class="card">
<h2>Queue Empty</h2>
<p>No links in the queue. Go add some!</p>
<div class="actions">
<a href="/" class="btn">Home</a>
<a href="/queuein" class="btn">Add Links</a>
<a href="javascript:location.reload()" class="btn">Reload</a>
</div>
</div>
{% endif %}
</body>
</html>