diff --git a/static/app.js b/static/app.js index d1044d1..3bca601 100644 --- a/static/app.js +++ b/static/app.js @@ -720,7 +720,7 @@ function lockSection(d) { async function setDemo(body) { try { S.demo = await api("PUT", "/api/demo", body); - if (S.demo.enabled) { S.cur = "demo"; S.settings = false; S.view = "mixer"; } + if (S.demo.enabled) S.cur = "demo"; // ready at the top; the settings stay open render(); } catch (e) { toast(t("Error: ") + trMsg(e.message)); } } @@ -1984,6 +1984,8 @@ function langCard() { if (lang === LANG) return; store.set("dsp.lang", lang); if (S.isApp) await api("PUT", "/api/lang", { lang }).catch(() => {}); + // the texts are set when the page loads: reload, but come back to the settings where we were + try { sessionStorage.setItem("dsp.reopen", JSON.stringify({ settings: S.settings, y: window.scrollY })); } catch { /* private mode */ } location.reload(); }; return h("div", { class: "card" }, h("h3", {}, "Language / Sprache"), @@ -2158,7 +2160,9 @@ function connectEvents() { if (S.demo.enabled && S.devices.demo && !S.devices[S.cur]?.demo) S.cur = "demo"; S.order.forEach(id => maybeAskUnlock(S.devices[id])); if (!S.order.length) S.settings = true; - render(); break; + render(); + if (S.reopenY != null) { window.scrollTo(0, S.reopenY); S.reopenY = null; } + break; case "device": { if (!S.devices[ev.device]) S.order.push(ev.device); const was = testOn(S.devices[ev.device]); @@ -2300,6 +2304,11 @@ async function startApp() { showMuteAll(); if (S.isApp) S.remote = await api("GET", "/api/remote"); } catch { /* plain web UI */ } + try { // after a language switch: back to the settings and the scroll position + const r = JSON.parse(sessionStorage.getItem("dsp.reopen") || "null"); + sessionStorage.removeItem("dsp.reopen"); + if (r && r.settings) { S.settings = true; S.reopenY = r.y || 0; } + } catch { /* private mode */ } connectEvents(); }