Error loading ${contentType}
Could not load content. Please try again.
`;
console.error('Content loading error:', error);
}
}
hubButtons.forEach(button => {
button.addEventListener('click', (e) => {
e.preventDefault();
const contentType = button.dataset.content;
hubButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
loadContent(contentType);
history.pushState({content: contentType}, '', `#${contentType}`);
});
});
window.addEventListener('popstate', (e) => {
if (e.state && e.state.content) {
const button = document.querySelector(`[data-content="${e.state.content}"]`);
if (button) button.click();
}
});
const initialContent = window.location.hash.slice(1) || 'about';
const initialButton = document.querySelector(`[data-content="${initialContent}"]`);
if (initialButton) {
initialButton.classList.add('active');
loadContent(initialContent);
}
});