summaryrefslogtreecommitdiffstats
path: root/dist/js/settings.js
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-05-17 16:14:07 +0200
committerrstular <rok@stular.eu>2020-05-17 16:29:20 +0200
commit831563c8ecb2854ceba73c284719b7579c0a3bbc (patch)
tree597d4f2d8a184c13e05027c9ce877d203686c015 /dist/js/settings.js
parentMerge branch 'dev' of github.com:beziapp/beziapp.github.io into dev (diff)
downloadbeziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.gz
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.bz2
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.lz
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.xz
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.tar.zst
beziapp-831563c8ecb2854ceba73c284719b7579c0a3bbc.zip
Diffstat (limited to 'dist/js/settings.js')
-rw-r--r--dist/js/settings.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/dist/js/settings.js b/dist/js/settings.js
index 0410aeb..411a38e 100644
--- a/dist/js/settings.js
+++ b/dist/js/settings.js
@@ -7,6 +7,13 @@ async function setLanguage(langCode) {
});
}
+async function setTheme(targetTheme) {
+ localforage.setItem("targetTheme", targetTheme).then((value) => {
+ console.log("Theme set: " + value);
+ UIAlert(D("themeSet"), "setTheme(): themeSet");
+ });
+}
+
document.addEventListener("DOMContentLoaded", async () => {
$("#select-language").on("change", () => {
@@ -14,11 +21,21 @@ document.addEventListener("DOMContentLoaded", async () => {
setLanguage(languageToSet);
});
+ $("#select-theme").on("change", () => {
+ let themeToSet = $(this).find(":selected").data("theme");
+ setTheme(themeToSet);
+ });
+
localforage.getItem("chosenLang").then((value) => {
let selectedLanguage = value ?? "sl";
$(`#option-${selectedLanguage}`).attr("selected", true);
}).catch(() => {});
+ localforage.getItem("theme").then((value) => {
+ let selectedTheme = value ?? "sl";
+ $(`#option-${selectedTheme}`).attr("selected", true);
+ }).catch(() => {});
+
// Setup side menu
const menus = document.querySelectorAll(".side-menu");
M.Sidenav.init(menus, { edge: "right", draggable: true });