von single Page hin zur mehreren Seiten geändert
This commit is contained in:
1 parent
8c94fc91f6
commit
31c4bd47cd
36 files changed
+207
-97
No files matched your search
@@ -33,6 +33,36 @@ function loadUiState(){
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- Deep-Link-Routen (Abteilung + Tab als URL) ----------
|
||||
|
||||
// applyUrlRoute: wertet einen Deep-Link "/<Abteilung>/<Tab>" aus der URL aus,
|
||||
// z. B. "/HLS/Auslastung" oder "/ELT/Projektübersicht". Gültige Routen liefern
|
||||
// { department, tab }, alles andere (auch file://-Pfade) liefert null.
|
||||
function applyUrlRoute(){
|
||||
try {
|
||||
const m = window.location.pathname.match(/^\/([^/]+)\/([^/]+)\/?$/);
|
||||
if(!m) return null;
|
||||
const dept = m[1];
|
||||
const tab = TAB_BY_SLUG[decodeURIComponent(m[2])];
|
||||
if(!DEPARTMENTS[dept] || !tab) return null;
|
||||
return { department: dept, tab };
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// updateRouteUrl: schreibt Abteilung + aktiven Tab als sprechende URL in die
|
||||
// Adresszeile (z. B. "/HLS/Auslastung"), ohne die Seite neu zu laden. Nur über
|
||||
// HTTP (nicht per file://) und nur bei bekannter Abteilung/Tab. Keine Rückgabe.
|
||||
function updateRouteUrl(dept, tab){
|
||||
try {
|
||||
if(!window.location.protocol || window.location.protocol.indexOf('http') !== 0) return;
|
||||
const slug = TAB_SLUGS[tab];
|
||||
if(!slug || !DEPARTMENTS[dept]) return;
|
||||
window.history.replaceState(null, '', '/' + dept + '/' + slug);
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
// ---------- Kollabierbarer Header ----------
|
||||
|
||||
// HEADER_COLLAPSED_KEY: LocalStorage-Key für den Einklapp-Zustand des Header-Menüs
|
||||
|
||||
Reference in new issue
Block a user