summaryrefslogtreecommitdiffstats
path: root/dist/js/settings.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dist/js/settings.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/dist/js/settings.js b/dist/js/settings.js
new file mode 100644
index 0000000..fda9ea5
--- /dev/null
+++ b/dist/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 });
+});