2026-05-28 16:26:59 -05:00
|
|
|
function loadHTML(file, elementId) {
|
|
|
|
|
fetch(file)
|
|
|
|
|
.then(r => r.text())
|
|
|
|
|
.then(html => {
|
|
|
|
|
document.getElementById(elementId).innerHTML = html;
|
|
|
|
|
if (elementId === 'header') highlightActiveNav();
|
|
|
|
|
})
|
|
|
|
|
.catch(err => console.error('Error loading:', file, err));
|
|
|
|
|
}
|
2026-05-28 15:58:00 -05:00
|
|
|
|
2026-05-28 16:26:59 -05:00
|
|
|
function highlightActiveNav() {
|
|
|
|
|
const current = location.pathname.split('/').pop() || 'index.html';
|
|
|
|
|
document.querySelectorAll('#header a[href]').forEach(link => {
|
|
|
|
|
if (link.getAttribute('href') === `/${current}`) {
|
|
|
|
|
link.classList.add('active');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadHTML('/header.html', 'header');
|
|
|
|
|
loadHTML('/footer.html', 'footer');
|