summaryrefslogtreecommitdiffstats
path: root/dist/js/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/settings.js')
-rw-r--r--dist/js/settings.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/dist/js/settings.js b/dist/js/settings.js
index fda9ea5..0410aeb 100644
--- a/dist/js/settings.js
+++ b/dist/js/settings.js
@@ -8,12 +8,22 @@ async function setLanguage(langCode) {
}
document.addEventListener("DOMContentLoaded", async () => {
- $(".settings-language-selector").click(function () {
- let languageToSet = $(this).attr("data-language");
+
+ $("#select-language").on("change", () => {
+ let languageToSet = $(this).find(":selected").data("language");
setLanguage(languageToSet);
});
+ localforage.getItem("chosenLang").then((value) => {
+ let selectedLanguage = value ?? "sl";
+ $(`#option-${selectedLanguage}`).attr("selected", true);
+ }).catch(() => {});
+
// Setup side menu
const menus = document.querySelectorAll(".side-menu");
M.Sidenav.init(menus, { edge: "right", draggable: true });
+
+ // Setup language select dropdown
+ var elems = document.querySelectorAll('select');
+ M.FormSelect.init(elems, {});
});