1async function cargarParciales() { 2 // 1. Cargar navbar 3 const navbarHTML = await fetch('navbar.html').then(res => res.text()); 4 document.getElementById('navbar-container').innerHTML = navbarHTML; 5 6 // 2. Cargar footer si existe 7 const footerEl = document.getElementById('footer-container'); 8 if (footerEl) { 9 const footerHTML = await fetch('footer.html').then(res => res.text()); 10 footerEl.innerHTML = footerHTML; 11 } 12 13 // 3. Esperar que los elementos navbar estén en el DOM y luego ejecutar navbar.js 14 const esperaNavbarListo = setInterval(() => { 15 const loguinLink = document.querySelector(".loguin"); 16 const logoutLink = document.querySelector(".logout"); 17 18 if (loguinLink && logoutLink) { 19 clearInterval(esperaNavbarListo); 20 21 const sesionActiva = localStorage.getItem("sesionXmatica") === "activa"; 22 23 if (sesionActiva) { 24 loguinLink.classList.add("d-none"); 25 logoutLink.classList.remove("d-none"); 26 } else { 27 loguinLink.classList.remove("d-none"); 28 logoutLink.classList.add("d-none"); 29 } 30 31 32 const accesoAdmin = document.querySelector(".acceso-admin"); 33 if (accesoAdmin && sesionActiva) { 34 accesoAdmin.style.display = "inline-block"; 35 } 36 37 } 38 }, 100); 39} 40 41// 4. Función global para cerrar sesión 42function cerrarSesion() { 43 localStorage.removeItem("sesionXmatica"); 44 localStorage.removeItem("usuarioXmatica"); 45 localStorage.removeItem("nombreXmatica"); 46 localStorage.removeItem("emailXmatica"); 47 localStorage.removeItem("LinkEstadisticas"); 48 window.location.href = "index.html"; 49 50} 51 52 53 54document.addEventListener("DOMContentLoaded", cargarParciales);
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.