summaryrefslogtreecommitdiff
path: root/public/static/js
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-12-03 12:07:07 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-12-03 12:07:07 +0100
commita702051aef4b32fca7fd516a34415fcbb1e8c871 (patch)
treec5aa171840e44874484d1fe6d0d7e190070aab5d /public/static/js
parenta36801c967c790ed10d7d074af12f9832a42aa50 (diff)
Move theme switcher to bottom; add 'use device theme'
Diffstat (limited to 'public/static/js')
-rw-r--r--public/static/js/collapse.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js
index 2beead1..30e111e 100644
--- a/public/static/js/collapse.js
+++ b/public/static/js/collapse.js
@@ -4,6 +4,19 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
+function setLang(lang) {
+ document.cookie = 'lang=' + lang;
+ location.reload();
+}
+
+function setTheme(theme) {
+ localStorage.setItem('theme', theme);
+ if (!otherTheme.hasOwnProperty(theme)) {
+ theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
+ }
+ addStyleSheet(theme, 'theme');
+}
+
function reload_app() {
// TODO use a variable instead of window.location.href, as
// window.location.href may be /z/...