const menulogo = getID("menu-logo") const usersettingsBtn = getID("user-settings-button") menu.style.display = "none" menulogo.addEventListener("click", () => { const menu = getID("menu") if(menu.style.display == "block") { menu.style.display = "none" } else { menu.style.display = "block" } }) usersettingsBtn.addEventListener("click", () => { const View = new ViewWindow({ title: ` Mon Compte`, width: "600px", height: "650px" }) View.setContent(`
Mes informations
Nom d'utilisateur
Nom d'affichage
Mot de passe
Photo de profil
Mes permissions
" + permValue + "
") }) usSettingsPermissions.innerHTML = permValid.join("") }) usSettingsSave.addEventListener("click", () => { const request = post(`US_EDIT_PERSONNAL`, {username: actualUsername, newusername: usSettingsUsername.value, display_name: usSettingsDisplayname.value, password: usSettingsPassword.value, picture: usSettingsPicture.files[0]}) request.then((answer) => { if(answer == "ALREADY_EXIST") { returnInfo.err("L'utilisateur existe déjà !") } else if(answer == "USERNAME_MISSING") { returnInfo.err("Le nom d'utilisateur est manquant !") } else if(answer == "DISPLAY_NAME_MISSING") { returnInfo.err("Le nom d'affichage est manquant !") } else if(answer == "PASSWORD_MISSING") { returnInfo.err("Le mot de passe est manquant !") } else { View.destroy() loadUserInfo() } }) }) }) document.addEventListener("click", (e) => { if(e.target != menulogo) { menu.style.display = "none" } })