diff options
Diffstat (limited to 'public/static/js')
-rw-r--r-- | public/static/js/collapse.js | 13 |
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/... |