/** * assets/js/header.js * ES Module — gestion simple du thème * Les contrôleurs Stimulus gèrent les interactions interactives */ // Fonction pour appliquer le fond d'écran function applyBackground() { const body = document.getElementById('page-body'); if (!body) return; const theme = document.documentElement.getAttribute('data-theme') || 'light'; const bg = theme === 'dark' ? body.dataset.bgDark : body.dataset.bgLight; if (bg) { body.style.backgroundImage = `url('${bg}')`; } } // Appliquer le fond au chargement applyBackground(); // Réappliquer après navigation Turbo document.addEventListener('turbo:load', () => { applyBackground(); });