mirror of
https://gh.wpcy.net/https://github.com/WP-Autoplugin/hub2wp-repo-public.git
synced 2026-04-24 16:52:49 +08:00
20 lines
No EOL
776 B
JavaScript
20 lines
No EOL
776 B
JavaScript
import { loadComponent } from './components.js';
|
|
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
// Load header and wait for it to complete
|
|
await loadComponent('header', '/components/header.html');
|
|
|
|
// Highlight active page in the navigation menu
|
|
const navLinks = document.querySelectorAll('.nav-link');
|
|
const currentPath = window.location.pathname.split('/').pop().replace('.html', '') || 'index';
|
|
navLinks.forEach(link => {
|
|
if (link.dataset.page === currentPath) {
|
|
link.classList.add('text-white', 'font-bold');
|
|
} else {
|
|
link.classList.remove('text-white', 'font-bold');
|
|
}
|
|
});
|
|
|
|
// Load footer (can load independently)
|
|
loadComponent('footer', '/components/footer.html');
|
|
}); |