From b13caa4c5105c92a23799ed62c3e134b8c5343ec Mon Sep 17 00:00:00 2001 From: Giorgio Gilestro Date: Wed, 27 May 2026 20:41:31 +0200 Subject: [PATCH] ui: name the theme-toggle handler instead of an inline IIFE The theme toggle's onclick attribute held a 140-character inline IIFE that was hard to read amongst the other named-function handlers in the same header. Promoted it to cassandraToggleTheme() alongside cassandraSetTone / cassandraSetLang. --- app/templates/base.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/templates/base.html b/app/templates/base.html index 29c8290..d972043 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -135,6 +135,13 @@ }); }; + window.cassandraToggleTheme = function () { + var d = document.documentElement; + var t = d.dataset.theme === 'light' ? 'dark' : 'light'; + d.dataset.theme = t; + try { localStorage.setItem('cassandra.theme', t); } catch (e) {} + }; + window.cassandraSetLang = async function (newLang) { var pill = document.getElementById('lang-toggle'); if (!pill) return; @@ -204,7 +211,7 @@ onclick="cassandraSetTone('INTERMEDIATE')">Intermediate {% set cu = request.state.current_user if request.state and request.state.current_user is defined else None %}