From f0ca8b9ec6bbf50f160079a22be76001dbbfb407 Mon Sep 17 00:00:00 2001 From: bruno Date: Wed, 28 Oct 2026 22:59:11 -0400 Subject: [PATCH] =?UTF-8?q?Page=20Projets=20:=20copie=20URL=20dans=20le=20?= =?UTF-8?q?menu=20=E2=8B=AF=20+=20refonte=20th=C3=A8me=20barre=20Fusion/Sp?= =?UTF-8?q?ark=20(#44,=20#45)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/nav.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/static/js/nav.js b/static/js/nav.js index 29e2622..59bc0d7 100644 --- a/static/js/nav.js +++ b/static/js/nav.js @@ -34,6 +34,26 @@ if (window.innerWidth > 900) closeDrawer(); }); + /* Bascule Dark/Light (#52) : le choix est mémorisé et + l'amorce de _header.html l'a déjà appliqué avant le rendu. + Ici, on ne fait que synchroniser le libellé et le clic. */ + var themeBtn = document.getElementById('theme-toggle'); + function syncThemeBtn(theme) { + if (!themeBtn) return; + var light = theme === 'light'; + themeBtn.textContent = light ? '🌙 Mode sombre' : '☀️ Mode clair'; + themeBtn.setAttribute('aria-pressed', light ? 'true' : 'false'); + } + if (themeBtn) { + syncThemeBtn(document.documentElement.getAttribute('data-theme') || 'dark'); + themeBtn.addEventListener('click', function () { + var next = document.documentElement.getAttribute('data-theme') === 'light' ? 'dark' : 'light'; + document.documentElement.setAttribute('data-theme', next); + try { localStorage.setItem('kanbante-theme', next); } catch (e) { /* non-fatal */ } + syncThemeBtn(next); + }); + } + if (collapseBtn) { collapseBtn.addEventListener('click', function () { var collapsed = document.body.classList.toggle('sidebar-collapsed');