diff --git a/templates/index.html b/templates/index.html index 342b9a3..ad5c042 100644 --- a/templates/index.html +++ b/templates/index.html @@ -692,8 +692,53 @@ btn.style.color = "#fff"; btn.style.borderColor = "var(--accent)"; $("#tv-station-input").value = btn.dataset.station; + // Persist + try { localStorage.setItem("reels_tv_station", btn.dataset.station); } catch(e) {} }); }); + + // ─── Settings persist v localStorage ───────────────────────── + // Da se ohranijo med page reload-i (no-subs, mode, quality, station, ...) + const PERSIST_FIELDS = [ + { id: "no-subs", type: "checkbox" }, + { id: "auto-chorus", type: "checkbox" }, + { id: "include-prebuild", type: "checkbox" }, + { id: "mode", type: "select" }, + { id: "quality", type: "select" }, + { id: "llm-provider", type: "select" }, + ]; + + // Load saved values na DOM ready + PERSIST_FIELDS.forEach(f => { + const el = document.getElementById(f.id); + if (!el) return; + const saved = localStorage.getItem("reels_" + f.id); + if (saved !== null) { + if (f.type === "checkbox") el.checked = saved === "true"; + else el.value = saved; + } + // Persist na vsako spremembo + el.addEventListener("change", () => { + try { + if (f.type === "checkbox") localStorage.setItem("reels_" + f.id, el.checked ? "true" : "false"); + else localStorage.setItem("reels_" + f.id, el.value); + } catch(e) {} + }); + }); + + // Saved TV station + const savedStation = localStorage.getItem("reels_tv_station"); + if (savedStation) { + $("#tv-station-input").value = savedStation; + // Aktiven gumb + document.querySelectorAll(".tv-tab").forEach(b => { + const isActive = b.dataset.station === savedStation; + b.classList.toggle("active", isActive); + b.style.background = isActive ? "var(--accent)" : "transparent"; + b.style.color = isActive ? "#fff" : "#ccc"; + b.style.borderColor = isActive ? "var(--accent)" : "#444"; + }); + } function parseTimestamp(s) { s = s.trim();