Files
2025-04-24 11:44:23 +02:00

16 lines
453 B
JavaScript

// static/router.js — core routing for SPA navigation
export const Router = {
sections: Array.from(document.querySelectorAll("main > section")),
showOnly(id) {
this.sections.forEach(sec => {
sec.hidden = sec.id !== id;
sec.tabIndex = -1;
});
localStorage.setItem("last_page", id);
const target = document.getElementById(id);
if (target) target.focus();
}
};
export const showOnly = Router.showOnly.bind(Router);