Persist UI settings v localStorage (no-subs, station, mode, ...)
User feedback: 'ko refrešam se ponovno vklopi kljukica da ni podnapisov to bo problem' Saved fields: - no-subs (checkbox) - auto-chorus (checkbox) - include-prebuild (checkbox) - mode (track/center/blur) - quality (fast/medium/high) - llm-provider (claude/gemini/auto) - tv-station (FOLX SLOVENIJA / ONE DE / ...) On page load: re-aplicira saved values On change: shrani v localStorage TV station: tudi posodobi aktiven tab style Defaults ostanejo isti če nikoli niso spremenjeni.
This commit is contained in:
parent
c2a593de78
commit
d0e78cca02
@ -692,9 +692,54 @@
|
||||
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();
|
||||
if (s.includes(":")) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user