/** * ๐งญ NEXT-GEN SIDEBAR NAVIGATION & APP LAYOUT ๐งญ * =============================================== * Erzeugt eine moderne, responsive Sidebar auf der linken Seite * fรผr das Hauptportal und alle 27 Kapitel-Seiten. */ (function () { const LEHRPFADE = [ { id: "lehrpfad_1", title: "๐ฑ Lehrpfad 1: Grundlagen", badge: "G01โG10", color: "#059669", items: [ { id: "01_erste_schritte_taschenrechner", num: "G01", icon: "๐งฎ", title: "Taschenrechner", path: "lehrpfad_1_grundlagen/01_erste_schritte_taschenrechner/index.html" }, { id: "02_variablen_und_datentypen", num: "G02", icon: "๐ฆ", title: "Variablen & Typen", path: "lehrpfad_1_grundlagen/02_variablen_und_datentypen/index.html" }, { id: "03_ein_und_ausgabe", num: "G03", icon: "๐ฌ", title: "Ein- & Ausgabe", path: "lehrpfad_1_grundlagen/03_ein_und_ausgabe/index.html" }, { id: "04_verzweigungen_und_bedingungen", num: "G04", icon: "๐ฆ", title: "Bedingungen (if)", path: "lehrpfad_1_grundlagen/04_verzweigungen_und_bedingungen/index.html" }, { id: "05_schleifen_und_wiederholungen", num: "G05", icon: "๐ก", title: "Schleifen (for/while)", path: "lehrpfad_1_grundlagen/05_schleifen_und_wiederholungen/index.html" }, { id: "06_funktionen_und_module", num: "G06", icon: "๐ช", title: "Funktionen & Module", path: "lehrpfad_1_grundlagen/06_funktionen_und_module/index.html" }, { id: "07_listen_und_sequenzen", num: "G07", icon: "๐", title: "Listen & Sequenzen", path: "lehrpfad_1_grundlagen/07_listen_und_sequenzen/index.html" }, { id: "08_textverarbeitung_und_strings", num: "G08", icon: "๐ค", title: "String-Methoden", path: "lehrpfad_1_grundlagen/08_textverarbeitung_und_strings/index.html" }, { id: "09_dictionaries_und_sets", num: "G09", icon: "๐๏ธ", title: "Dicts & Sets", path: "lehrpfad_1_grundlagen/09_dictionaries_und_sets/index.html" }, { id: "10_comprehensions_datum_algorithmen", num: "G10", icon: "๐", title: "Comprehensions", path: "lehrpfad_1_grundlagen/10_comprehensions_datum_algorithmen/index.html" }, ] }, { id: "lehrpfad_2", title: "๐๏ธ Lehrpfad 2: OOP Einstieg", badge: "00โ06", color: "#4f46e5", items: [ { id: "00_fehlersuche_und_grundlagen", num: "00", icon: "๐", title: "Fehlersuche & Debugging", path: "lehrpfad_2_oop_einstieg/00_fehlersuche_und_grundlagen/index.html" }, { id: "01_einstieg_klassen", num: "01", icon: "๐๏ธ", title: "Einstieg in Klassen", path: "lehrpfad_2_oop_einstieg/01_einstieg_klassen/index.html" }, { id: "02_init_und_self", num: "02", icon: "โ๏ธ", title: "Konstruktor & self", path: "lehrpfad_2_oop_einstieg/02_init_und_self/index.html" }, { id: "03_methoden_und_verhalten", num: "03", icon: "๐๏ธ", title: "Methoden & Verhalten", path: "lehrpfad_2_oop_einstieg/03_methoden_und_verhalten/index.html" }, { id: "04_str_und_darstellung", num: "04", icon: "๐งพ", title: "__str__ Darstellung", path: "lehrpfad_2_oop_einstieg/04_str_und_darstellung/index.html" }, { id: "04b_umstieg_vscode", num: "04b", icon: "๐ป", title: "VS Code Setup", path: "lehrpfad_2_oop_einstieg/04b_umstieg_vscode/index.html" }, { id: "04c_git_und_versionskontrolle", num: "04c", icon: "๐ฟ", title: "Git-Versionskontrolle", path: "lehrpfad_2_oop_einstieg/04c_git_und_versionskontrolle/index.html" }, { id: "05_objekte_kombinieren", num: "05", icon: "๐ต", title: "Objekte kombinieren", path: "lehrpfad_2_oop_einstieg/05_objekte_kombinieren/index.html" }, { id: "06_abschlussprojekt_tamagotchi", num: "06", icon: "๐ฅ", title: "Projekt: Tamagotchi", path: "lehrpfad_2_oop_einstieg/06_abschlussprojekt_tamagotchi/index.html" }, ] }, { id: "lehrpfad_3", title: "๐ Lehrpfad 3: Fortgeschritten", badge: "07โ16", color: "#7c3aed", items: [ { id: "07_referenzen_und_speicher", num: "07", icon: "๐ง ", title: "Referenzen & Speicher", path: "lehrpfad_3_fortgeschrittenes_oop/07_referenzen_und_speicher/index.html" }, { id: "08_operator_overloading_dunder", num: "08", icon: "โ", title: "Operator Overloading", path: "lehrpfad_3_fortgeschrittenes_oop/08_operator_overloading_dunder/index.html" }, { id: "09_eigene_unit_tests_schreiben", num: "09", icon: "๐งช", title: "Unit Tests & TDD", path: "lehrpfad_3_fortgeschrittenes_oop/09_eigene_unit_tests_schreiben/index.html" }, { id: "10_vererbung_und_super", num: "10", icon: "๐งฌ", title: "Vererbung & super()", path: "lehrpfad_3_fortgeschrittenes_oop/10_vererbung_und_super/index.html" }, { id: "11_polymorphie_und_interfaces", num: "11", icon: "๐ญ", title: "Polymorphie", path: "lehrpfad_3_fortgeschrittenes_oop/11_polymorphie_und_interfaces/index.html" }, { id: "12_exceptions_und_fehlerbehandlung", num: "12", icon: "๐ก๏ธ", title: "Exceptions & Fehler", path: "lehrpfad_3_fortgeschrittenes_oop/12_exceptions_und_fehlerbehandlung/index.html" }, { id: "13_persistenz_json_und_csv", num: "13", icon: "๐พ", title: "Persistenz (JSON/CSV)", path: "lehrpfad_3_fortgeschrittenes_oop/13_persistenz_json_und_csv/index.html" }, { id: "14_gui_mit_tkinter", num: "14", icon: "๐ฅ๏ธ", title: "Desktop-GUIs (Tkinter)", path: "lehrpfad_3_fortgeschrittenes_oop/14_gui_mit_tkinter/index.html" }, { id: "15_parameter_und_container", num: "15", icon: "๐", title: "Container & *args", path: "lehrpfad_3_fortgeschrittenes_oop/15_parameter_und_container/index.html" }, { id: "16_master_abschlussprojekt", num: "16", icon: "๐", title: "Master-Abschlussprojekt", path: "lehrpfad_3_fortgeschrittenes_oop/16_master_abschlussprojekt/index.html" }, ] } ]; function detectRootPrefix() { const p = window.location.pathname; if (p.includes("/lehrpfad_1_grundlagen/") || p.includes("/lehrpfad_2_oop_einstieg/") || p.includes("/lehrpfad_3_fortgeschrittenes_oop/")) { return "../../"; } return "./"; } function initSidebar() { if (document.querySelector(".app-sidebar")) return; const prefix = detectRootPrefix(); const currentPath = window.location.pathname; const isRoot = prefix === "./"; // Gamification Data const gData = window.GAMIFICATION_DATA || { xp: 0, level: 1, titel: "Code-Kรผken ๐ฃ", geloeste_kapitel: [] }; const solvedSet = new Set(gData.geloeste_kapitel || []); // 1. Erstelle Drawer-Toggle Button fรผr Mobile const toggleBtn = document.createElement("button"); toggleBtn.type = "button"; toggleBtn.className = "sidebar-mobile-toggle"; toggleBtn.innerHTML = "โฐ Menรผ"; document.body.prepend(toggleBtn); // 2. Erstelle Overlay fรผr Mobile const overlay = document.createElement("div"); overlay.className = "sidebar-overlay"; document.body.prepend(overlay); // 3. Erstelle Sidebar Container const sidebar = document.createElement("aside"); sidebar.className = "app-sidebar"; let tracksHtml = ""; LEHRPFADE.forEach(track => { let itemsHtml = ""; track.items.forEach(item => { const fullLink = prefix + item.path; const isActive = currentPath.includes(item.id); const isSolved = solvedSet.has(item.path.replace("/index.html", "")); itemsHtml += ` ${isSolved ? '' : ''} `; }); tracksHtml += `
`; }); sidebar.innerHTML = ` `; document.body.prepend(sidebar); // Toggle Events toggleBtn.addEventListener("click", () => { sidebar.classList.toggle("open"); overlay.classList.toggle("active"); }); overlay.addEventListener("click", () => { sidebar.classList.remove("open"); overlay.classList.remove("active"); }); } document.addEventListener("DOMContentLoaded", initSidebar); })();