1
0

Pārlūks: darbojas arī iegultā (sandbox) iframe

history.replaceState un location.hash piekļuve aizsargāta ar try/catch, jo iegultā srcdoc lapā (piem., priekšskatījumā) URL maiņa nav atļauta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016679RwmHsuTFfxt26wP6rk
This commit is contained in:
2026-10-11 06:04:29 +00:00
parent e77ce6195b
commit 4698200a23

View File

@@ -16193,8 +16193,8 @@ const srcLabel = (M, a) => { const s = M.src[a.src]; if (!s) return ""; return (
/* ============================================================ stāvoklis */ /* ============================================================ stāvoklis */
const S = {v: "problema", y: null, sub: "kopsavilkums", fund: "all", grp: "resori", open: new Set(), q: "", rfund: "basic", cflow: "expenditure", sel: null, sort: "code"}; const S = {v: "problema", y: null, sub: "kopsavilkums", fund: "all", grp: "resori", open: new Set(), q: "", rfund: "basic", cflow: "expenditure", sel: null, sort: "code"};
const cur = () => MODELS[S.y]; const cur = () => MODELS[S.y];
function setHash(){ const h = "#/" + S.v + (["budzets"].includes(S.v) ? "/" + S.y + "/" + S.sub : (["salidz", "saderiba", "modelis"].includes(S.v) ? "/" + S.y : "")); if (location.hash !== h) history.replaceState(null, "", h); } function setHash(){ const h = "#/" + S.v + (["budzets"].includes(S.v) ? "/" + S.y + "/" + S.sub : (["salidz", "saderiba", "modelis"].includes(S.v) ? "/" + S.y : "")); if (setHash.off || location.hash === h) return; try { history.replaceState(null, "", h); } catch (e) { setHash.off = true; } }
function readHash(){ const p = location.hash.replace(/^#\/?/, "").split("/"); if (p[0]) S.v = p[0]; if (p[1] && MODELS[p[1]]) S.y = p[1]; if (p[2]) S.sub = p[2]; } function readHash(){ let lh = ""; try { lh = location.hash || ""; } catch (e) {} const p = lh.replace(/^#\/?/, "").split("/"); if (p[0]) S.v = p[0]; if (p[1] && MODELS[p[1]]) S.y = p[1]; if (p[2]) S.sub = p[2]; }
/* ============================================================ karkass */ /* ============================================================ karkass */
function renderYearSeg(){ function renderYearSeg(){