summaryrefslogtreecommitdiffstats
path: root/js/settings.js
blob: fda9ea52240bb7c29f4dd202391361a105f828f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 });
});