From 179c5c4cbb06ffadd6dacabca662a9849255d7bb Mon Sep 17 00:00:00 2001 From: Stefan Strigler Date: Sun, 1 Mar 2026 20:09:20 +0100 Subject: [PATCH] feat(invites: enable dark mode --- priv/mod_invites/base_min.html | 2 +- priv/mod_invites/static/invite.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/priv/mod_invites/base_min.html b/priv/mod_invites/base_min.html index 2336c88ae..b6df037f4 100644 --- a/priv/mod_invites/base_min.html +++ b/priv/mod_invites/base_min.html @@ -30,6 +30,6 @@ {% block extra_scripts %}{% endblock %} - + diff --git a/priv/mod_invites/static/invite.js b/priv/mod_invites/static/invite.js index a2f1b0bb0..b2d947135 100644 --- a/priv/mod_invites/static/invite.js +++ b/priv/mod_invites/static/invite.js @@ -1,4 +1,6 @@ (function () { + document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')); + // If QR lib loaded ok, show QR button on desktop devices if(window.QRCode) { const qrcode_opts = { @@ -9,6 +11,10 @@ document.getElementById('qr-button-container').classList.add("d-md-block"); } + const toggle_pw_button = document.getElementById('toggle-pw-button'); + if (toggle_pw_button) + toggle_pw_button.addEventListener('click', toggle_password); + // Detect current platform and show/hide appropriate clients if(window.platform) { let platform_friendly = null; @@ -95,10 +101,6 @@ } } } - const toggle_pw_button = document.getElementById('toggle-pw-button'); - if (toggle_pw_button) - toggle_pw_button.addEventListener('click', toggle_password); - })(); function toggle_password(e) {