| // Main application script | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize tooltips | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| }); | |
| // Theme management | |
| function setTheme(theme) { | |
| document.documentElement.setAttribute('data-theme', theme); | |
| localStorage.setItem('theme', theme); | |
| } | |
| function toggleTheme() { | |
| const currentTheme = localStorage.getItem('theme') || 'light'; | |
| const newTheme = currentTheme === 'light' ? 'dark' : 'light'; | |
| setTheme(newTheme); | |
| } | |
| // Initialize theme | |
| const savedTheme = localStorage.getItem('theme') || 'light'; | |
| setTheme(savedTheme); |