summaryrefslogtreecommitdiffstats
path: root/assets/js/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/settings.js')
-rw-r--r--assets/js/settings.js21
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, {});