diff options
author | sijanec <anton@sijanec.eu> | 2021-05-16 16:49:09 +0200 |
---|---|---|
committer | sijanec <anton@sijanec.eu> | 2021-05-16 16:49:09 +0200 |
commit | abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab (patch) | |
tree | 297222608598dae2478c79f4e82b655c6c497292 /assets/js/settings.js | |
parent | Merge branch 'master' into dev (diff) | |
download | beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.gz beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.bz2 beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.lz beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.xz beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.tar.zst beziapp-abd9011fa84bdc1f6ee583e387d0ec686c3dc3ab.zip |
Diffstat (limited to 'assets/js/settings.js')
-rw-r--r-- | assets/js/settings.js | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/assets/js/settings.js b/assets/js/settings.js index 3106f14..2a721d7 100644 --- a/assets/js/settings.js +++ b/assets/js/settings.js @@ -14,6 +14,13 @@ async function setTheme(targetTheme) { }); } +async function setUrnikTheme(targetTheme) { + localforage.setItem("urnikTheme", targetTheme).then((value) => { + console.log("Urnik theme set" + value); + UIAlert(D("themeSet"), "setUrnikTheme(): themeSet") + }); +} + async function setErrorReporting(targetE) { localforage.setItem("errorReporting", targetE).then((value) => { console.log("ErrorReporing set: " + value); @@ -82,7 +89,9 @@ document.addEventListener("DOMContentLoaded", async () => { $("#select-errorreporting").on("change", function() { setErrorReporting($(this).find(":selected").val()); }); - + $("#select-urniktheme").on("change", function() { + setUrnikTheme($(this).find(":selected").val()); + }); localforage.getItem("chosenLang").then((value) => { let selectedLanguage = value; if(value == null || value.length < 1) { @@ -90,7 +99,12 @@ document.addEventListener("DOMContentLoaded", async () => { } $(`#option-${selectedLanguage}`).attr("selected", true); }).catch(() => {}); - + localforage.getItem("urnikTheme").then((value) => { + if (value == null || value.length < 1) { + value = "privzeta"; + } + $(`#option-${value}`).attr("selected", true); + }).catch(()=>{}); localforage.getItem("theme").then((value) => { let selectedTheme = value; if(value == null || value.length < 1) { @@ -124,6 +138,9 @@ document.addEventListener("DOMContentLoaded", async () => { var elems = document.querySelectorAll(".errorreporting-select"); M.FormSelect.init(elems, {}); + var elems = document.querySelectorAll(".urniktheme-select"); + M.FormSelect.init(elems, {}); + // Setup language select dropdown var elems = document.querySelectorAll(".lang-select"); M.FormSelect.init(elems, {}); |