// Theme toggle functionality document.addEventListener('DOMContentLoaded', () => { // Check for saved theme preference or use dark mode as default const savedTheme = localStorage.getItem('theme') || 'dark'; document.documentElement.classList.add(savedTheme); // Replace feather icons feather.replace(); // Add smooth scroll to all anchor links document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); }); }); // Add active state to current page in sidebar document.querySelectorAll('custom-sidebar a').forEach(link => { if (link.href === window.location.href) { link.classList.add('active'); } }); }); // Function to toggle theme function toggleTheme() { const html = document.documentElement; if (html.classList.contains('dark')) { html.classList.remove('dark'); localStorage.setItem('theme', 'light'); } else { html.classList.add('dark'); localStorage.setItem('theme', 'dark'); } } // Sample function to handle form submissions function handleFormSubmit(event) { event.preventDefault(); // Add your form handling logic here console.log('Form submitted'); } // Initialize all tooltips function initTooltips() { const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl); }); }