This commit is contained in:
lda committed 2025-12-29 15:03:03 +07:00
1 parent 58d3e58759
commit c09e018bc5
4 files changed
+50 -44

No files matched your search

+3 -3
View File
@@ -149,10 +149,10 @@ body_class %}layout-wide{% endblock %}{% block content %}
if (mode === "jumblang") {
try {
const response = await fetch("/api/extract/jumblang", {
const response = await fetch("/api/extract/plaintext", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: content }),
headers: { "Content-Type": "text/plain" },
body: content,
});
if (!response.ok) throw new Error("Extraction failed");
links = await response.json();
+6 -4
View File
@@ -64,12 +64,15 @@ import qrcode_queue %}
}
function filterQueue() {
/** @type {HTMLInputElement} */
const input = document.getElementById("search-input");
const filter = input.value.toLowerCase();
/** @type {NodeListOf<HTMLLIElement>} */
const listItems = document.querySelectorAll(".queue-grid li");
let visibleCount = 0;
listItems.forEach((li) => {
/** @type {HTMLAnchorElement} */
const link = li.querySelector("a");
const text = link.textContent || link.innerText;
if (text.toLowerCase().indexOf(filter) > -1) {
@@ -79,10 +82,9 @@ import qrcode_queue %}
li.style.display = "none";
}
});
document.getElementById(
"count-display"
).textContent = `Showing: ${visibleCount} / ${listItems.length}`;
/** @type {HTMLParagraphElement} */
const countDisplay = document.getElementById("count-display");
countDisplay.textContent = `Showing: ${visibleCount} / ${listItems.length}`;
}
</script>
{% endblock %}
-31
View File
@@ -45,37 +45,6 @@
});
// Trigger the message event to run the swap on the next tick
newTab.postMessage("");
// background. This block is racing with the slow internet.
if (newTab.document.body) {
newTab.document.body.style.backgroundColor =
getComputedStyle(document.body).backgroundColor;
document
.querySelectorAll("body > *:not(script)")
.forEach((f) =>
newTab.document.body.appendChild(
f.cloneNode(true)
)
);
// maybe just replace the whole document with this one and then use API to check length
// i aint doing that
const st = new newTab.CSSStyleSheet();
[
...document.styleSheets,
...document.adoptedStyleSheets,
].forEach((i) =>
Array.from(i.cssRules).forEach((ii) =>
st.insertRule(
ii.cssText,
st.cssRules.length
)
)
);
newTab.document.adoptedStyleSheets.push(st);
newTab.document.close();
}
}
});
});