summaryrefslogtreecommitdiffstats
path: root/js/settings.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/settings.js')
-rw-r--r--js/settings.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/settings.js b/js/settings.js
new file mode 100644
index 0000000..41c9df1
--- /dev/null
+++ b/js/settings.js
@@ -0,0 +1,17 @@
+// settings.js -- TODO
+
+async function setLanguage(langCode) {
+ localforage.setItem("chosenLang", langCode).then( () => {
+ UIAlert(D("languageSet"), "setLanguage(): languageSet");
+ });
+}
+
+document.addEventListener("DOMContentLoaded", async () => {
+ $(document).on("click",".settings-language-selector", 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 });
+});