Features: - Complete Luftglanz drone cleaning website - AI chat assistant integrated with OpenAI API - Expert product advice for AGO Quart and Mellerud cleaning products - Formal German language support (Sie form) - Secure PHP backend for API calls - Responsive design with mobile support - Product-specific knowledge base - Safety statements from manufacturers - Multi-page integration (index, products, services, contact) Technical components: - AI chat widget (js/ai-chat.js) - Chat styling (css/components/ai-chat.css) - Backend API (ai-chat-api.php) - Product knowledge base with detailed specifications - Demo and documentation files
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
|
// Get current page path
|
|
const currentPath = window.location.pathname;
|
|
const isInPagesDirectory = currentPath.includes('/pages/');
|
|
|
|
// Handle paths based on directory
|
|
const navLinks = document.querySelectorAll('#mainNav a');
|
|
navLinks.forEach(link => {
|
|
// Get href attribute
|
|
let href = link.getAttribute('href');
|
|
|
|
// Fix paths if in pages directory
|
|
if (isInPagesDirectory && href.startsWith('index.html')) {
|
|
link.setAttribute('href', '../' + href);
|
|
} else if (isInPagesDirectory && href.startsWith('#')) {
|
|
link.setAttribute('href', '../index.html' + href);
|
|
} else if (!isInPagesDirectory && href.startsWith('pages/')) {
|
|
// No change needed for root directory links to pages
|
|
}
|
|
|
|
// Set active class based on current page
|
|
if ((currentPath.endsWith('/index.html') || currentPath.endsWith('/')) && href === 'index.html') {
|
|
link.classList.add('active');
|
|
} else if (currentPath.includes(href) && href !== 'index.html') {
|
|
link.classList.add('active');
|
|
}
|
|
});
|
|
}); |