From b5fc2dfe4e81bcb2c42ed21ee4ee9db213594f3e Mon Sep 17 00:00:00 2001 From: mkelvers Date: Sat, 6 Jun 2026 16:52:16 +0200 Subject: [PATCH] feat: add app entry point, password toggle, and schedule modules --- static/app.ts | 15 +++++++++++++++ static/login.ts | 22 ++++++++++++++++++++++ static/schedule.ts | 13 +++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 static/app.ts create mode 100644 static/login.ts create mode 100644 static/schedule.ts diff --git a/static/app.ts b/static/app.ts new file mode 100644 index 0000000..045b8ce --- /dev/null +++ b/static/app.ts @@ -0,0 +1,15 @@ +import "./theme"; +import "./toast"; +import "./htmx"; +import "./dropdown"; +import "./discover"; +import "./anime"; +import "./timezone"; +import "./search"; +import "./sort_filter"; +import "./dedupe"; +import "./shell"; +import "./watchlist"; +import "./top_pick_carousel"; +import "./login"; +import "./schedule"; diff --git a/static/login.ts b/static/login.ts new file mode 100644 index 0000000..2437f4c --- /dev/null +++ b/static/login.ts @@ -0,0 +1,22 @@ +const initPasswordToggle = (): void => { + document.addEventListener("click", (event) => { + const target = event.target; + if (!(target instanceof Element)) return; + + const button = target.closest("[data-toggle-password]"); + if (!button) return; + + const field = button.closest("form")?.querySelector("#password"); + const openEye = button.querySelector("[data-eye-open]"); + const closedEye = button.querySelector("[data-eye-closed]"); + if (!(field instanceof HTMLInputElement) || !openEye || !closedEye) return; + + const showPassword = field.type === "password"; + field.type = showPassword ? "text" : "password"; + button.setAttribute("aria-label", showPassword ? "Hide password" : "Show password"); + openEye.classList.toggle("hidden", showPassword); + closedEye.classList.toggle("hidden", !showPassword); + }); +}; + +initPasswordToggle(); diff --git a/static/schedule.ts b/static/schedule.ts new file mode 100644 index 0000000..c35604c --- /dev/null +++ b/static/schedule.ts @@ -0,0 +1,13 @@ +import { onReady } from "./utils"; + +const scheduleTimezone = (): string => Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC"; + +const initScheduleLoader = (): void => { + onReady(() => { + const loader = document.querySelector("[data-schedule-loader]"); + if (!loader) return; + loader.setAttribute("hx-vals", JSON.stringify({ timezone: scheduleTimezone() })); + }); +}; + +initScheduleLoader();