diff options
Diffstat (limited to 'assets/js/settings.js')
-rw-r--r-- | assets/js/settings.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/assets/js/settings.js b/assets/js/settings.js new file mode 100644 index 0000000..fda9ea5 --- /dev/null +++ b/assets/js/settings.js @@ -0,0 +1,19 @@ +// settings.js -- TODO + +async function setLanguage(langCode) { + localforage.setItem("chosenLang", langCode).then((value) => { + console.log("Language set: " + value); + UIAlert(D("languageSet"), "setLanguage(): languageSet"); + }); +} + +document.addEventListener("DOMContentLoaded", async () => { + $(".settings-language-selector").click(function () { + let languageToSet = $(this).attr("data-language"); + setLanguage(languageToSet); + }); + + // Setup side menu + const menus = document.querySelectorAll(".side-menu"); + M.Sidenav.init(menus, { edge: "right", draggable: true }); +}); |