Sidebar: Menü ein-/ausklappbar (eingeklappt als Symbolleiste, Zustand wird gemerkt)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 15:45:55 +02:00
co-authored by Claude Opus 5.5
parent b81a7bd794
commit b6b93aa240
3 changed files with 32 additions and 0 deletions
+20
View File
@@ -154,6 +154,26 @@ $$('#sidebar .nav[data-view]').forEach((n) => n.addEventListener('click', () =>
render();
}));
// ============================================================ Einklappbares Menü (Sidebar)
(() => {
const KEY = 'mrterm.nav.collapsed';
const sb = $('#sidebar');
// Tooltips für die Symbolansicht
$$('#navMenu .nav').forEach((n) => { n.title = n.querySelector('span')?.textContent || ''; });
const apply = (collapsed) => {
sb.classList.toggle('nav-collapsed', collapsed);
$('#navToggle').title = collapsed ? 'Menü ausklappen' : 'Menü einklappen';
};
let collapsed = false;
try { collapsed = localStorage.getItem(KEY) === '1'; } catch {}
apply(collapsed);
$('#navToggle').onclick = () => {
collapsed = !collapsed;
apply(collapsed);
try { localStorage.setItem(KEY, collapsed ? '1' : '0'); } catch {}
};
})();
// ============================================================ Verzeichnisbaum (Sidebar)
const TREE_KEY = 'mrterm.tree.open';
const treeOpen = new Set((() => { try { return JSON.parse(localStorage.getItem(TREE_KEY) || '[]'); } catch { return []; } })());