1/* Lädt Partials (partials/header.html, partials/footer.html) per fetch 2 und ersetzt Platzhalter wie <div data-include="header"></div>. 3 Setzt anschlieÃend den aktiven Nav-Link, initialisiert den Sticky-FAB 4 und feuert ein "partials:loaded"-Event (nav.js hängt sich daran). */ 5(async () => { 6 // DocMedico wird jetzt von consent.js geladen (erst nach Einwilligung) 7 8 const targets = document.querySelectorAll('[data-include]'); 9 await Promise.all([...targets].map(async (el) => { 10 const name = el.dataset.include; 11 try { 12 const res = await fetch(`partials/${name}.html`, {cache: 'no-cache'}); 13 if (!res.ok) throw new Error(res.status); 14 const html = await res.text(); 15 const wrapper = document.createElement('div'); 16 wrapper.innerHTML = html; 17 el.replaceWith(...wrapper.childNodes); 18 } catch (e) { 19 console.error('Include failed:', name, e); 20 } 21 })); 22 23 // Aktiven Nav-Link anhand des aktuellen Dateinamens markieren 24 const file = location.pathname.split('/').pop() || 'index.html'; 25 document.querySelectorAll('.nav ul a').forEach(a => { 26 if (a.getAttribute('href') === file) a.classList.add('active'); 27 }); 28 29 // Sticky FAB â Scroll-to-Top-Verhalten 30 const fab = document.getElementById('stickyFab'); 31 if (fab) { 32 const updateScrollTop = () => fab.classList.toggle('show-top', window.scrollY > 300); 33 window.addEventListener('scroll', updateScrollTop, {passive:true}); 34 updateScrollTop(); 35 const topBtn = fab.querySelector('.fab-top'); 36 if (topBtn) { 37 topBtn.addEventListener('click', (e) => { 38 e.preventDefault(); 39 window.scrollTo({top:0, behavior:'smooth'}); 40 }); 41 } 42 } 43 44 // Signalisiert nav.js (und ggf. anderen), dass die Partials da sind 45 document.dispatchEvent(new CustomEvent('partials:loaded')); 46})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.