/** * ๐Ÿงญ NEXT-GEN SIDEBAR COMPONENT ๐Ÿงญ * ================================= * Rendert eine saubere, linksbรผndige Sidebar-Navigation * fรผr das Hauptportal und alle 27 Kapitel-Seiten. */ (function () { const LEHRPFADE = [ { id: "lehrpfad_1", title: "๐ŸŒฑ 1. Grundlagen", badge: "G01โ€“G10", 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: "๐Ÿ—๏ธ 2. OOP Einstieg", badge: "00โ€“06", items: [ { id: "00_fehlersuche_und_grundlagen", num: "00", icon: "๐Ÿ”", title: "Fehlersuche & Debug", 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: "๐Ÿš€ 3. Fortgeschritten", badge: "07โ€“16", 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() { const prefix = detectRootPrefix(); const currentPath = window.location.pathname; // Wrap existing body content in .app-main if not wrapped yet if (!document.querySelector(".app-main")) { const mainWrapper = document.createElement("div"); mainWrapper.className = "app-main"; while (document.body.firstChild) { mainWrapper.appendChild(document.body.firstChild); } document.body.appendChild(mainWrapper); } // Check if sidebar already exists if (document.querySelector(".app-sidebar")) return; // 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. Mobile Drawer Toggle Button const toggleBtn = document.createElement("button"); toggleBtn.type = "button"; toggleBtn.className = "sidebar-mobile-toggle"; toggleBtn.innerHTML = "โ˜ฐ Menรผ"; document.body.appendChild(toggleBtn); // 2. Mobile Overlay const overlay = document.createElement("div"); overlay.className = "sidebar-overlay"; document.body.appendChild(overlay); // 3. Sidebar Element const sidebar = document.createElement("aside"); sidebar.className = "app-sidebar"; let navSectionsHtml = ""; 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 += ` ${item.icon} ${item.num}. ${item.title} ${isSolved ? 'โœ…' : ''} `; }); navSectionsHtml += ` `; }); sidebar.innerHTML = `
๐Ÿ  Startseite ๐Ÿ“– Tutorial & Workflow ๐Ÿ† Zertifikate
`; document.body.prepend(sidebar); // Toggle Handler 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); })();