aboutsummaryrefslogtreecommitdiffstats
path: root/VegaData/wwwroot
diff options
context:
space:
mode:
authorivar <i@oiee.no>2025-10-08 10:57:18 +0200
committerivar <i@oiee.no>2025-10-08 10:57:18 +0200
commit9448868357415f63c382e32a0777c0cad1c9be30 (patch)
treeb70c3c69a30496942017a37e12fe65126109f1e3 /VegaData/wwwroot
parent54af95c7c2fa9e59e22af964554f1e860b8b9890 (diff)
downloadvegadata-9448868357415f63c382e32a0777c0cad1c9be30.tar.xz
vegadata-9448868357415f63c382e32a0777c0cad1c9be30.zip
n
Diffstat (limited to 'VegaData/wwwroot')
-rw-r--r--VegaData/wwwroot/index.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/VegaData/wwwroot/index.js b/VegaData/wwwroot/index.js
index cad938d..8ce5c62 100644
--- a/VegaData/wwwroot/index.js
+++ b/VegaData/wwwroot/index.js
@@ -62,7 +62,7 @@ function urlId(e) {
return `${e.movieVersion}${e.startDateTime}`.replaceAll("-", "").replaceAll(" ", "").replaceAll(":", "")
}
-async function renderShows(query = search.value) {
+async function renderShows(query, rendered) {
query = query?.trim();
sqp({ q: query ?? "" })
@@ -126,19 +126,23 @@ async function renderShows(query = search.value) {
if (!lis.length) ulShows.replaceChildren(...[t("i", undefined, "Dessverre")])
else ulShows.replaceChildren(...lis);
+ const interval = setInterval(() => {
+ const element = document.querySelector("#ulShows");
+ if (element.childNodes.length > 0) {
+ clearInterval(interval);
+ rendered();
+ }
+ }, 50);
}
-document.addEventListener("DOMContentLoaded", () => {
+renderShows(search.value, () => {
if (gqp("q")) search.value = gqp("q")
search.addEventListener("input", e => renderShows(e.currentTarget.value));
- renderShows();
const id = location.href.indexOf("#") !== -1 ? location.href.substring(location.href.indexOf("#")) : ""
- document.querySelectorAll(".time").forEach(el => el.classList.remove("activeShow"))
if (id !== "") {
- setTimeout(() => {
- const target = document.querySelector(id)
- target.scrollIntoView({ behavior: "smooth", block: "center" })
- target.classList.add("activeShow")
- }, 50)
+ const target = document.querySelector(id)
+ target.scrollIntoView({ behavior: "smooth", block: "center" })
+ target.classList.add("activeShow")
+ document.querySelectorAll(".time").forEach(el => el.id !== id.slice(1) && el.classList.remove("activeShow"))
}
-})
+}); \ No newline at end of file