From 7c77d348a28bfe36cd2cec763c69ee5ec34cfcd3 Mon Sep 17 00:00:00 2001 From: HatemMn <19950216+HatemMn@users.noreply.github.com> Date: Fri, 24 Jul 2026 17:37:56 +0200 Subject: [PATCH] fix:fix --- js/mermaid-init.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/mermaid-init.js b/js/mermaid-init.js index 0469ff1..3873b4c 100644 --- a/js/mermaid-init.js +++ b/js/mermaid-init.js @@ -3,8 +3,8 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. (() => { - const darkThemes = ['ayu', 'navy', 'coal']; - const lightThemes = ['light', 'rust']; + const darkThemes = ['navy']; + const lightThemes = ['light']; const classList = document.getElementsByTagName('html')[0].classList; @@ -22,7 +22,9 @@ // Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page for (const darkTheme of darkThemes) { - document.getElementById(darkTheme).addEventListener('click', () => { + const btn = document.getElementById(darkTheme); + if (!btn) continue; + btn.addEventListener('click', () => { if (lastThemeWasLight) { window.location.reload(); } @@ -30,7 +32,9 @@ } for (const lightTheme of lightThemes) { - document.getElementById(lightTheme).addEventListener('click', () => { + const btn = document.getElementById(lightTheme); + if (!btn) continue; + btn.addEventListener('click', () => { if (!lastThemeWasLight) { window.location.reload(); }