diff options
author | pennae <github@quasiparticle.net> | 2022-07-23 22:41:42 +0200 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2022-07-23 23:54:19 +0200 |
commit | 9aacaaf079373f8bc25f0533d7f6218e691c5de7 (patch) | |
tree | 671d2da8348fc220df9d7b33e0a5338dc4d2d1b6 /web/js | |
parent | 2e65f3bb5e561d1d44290b42d43312b52341c45b (diff) | |
download | minor-skulk-9aacaaf079373f8bc25f0533d7f6218e691c5de7.tar.gz minor-skulk-9aacaaf079373f8bc25f0533d7f6218e691c5de7.tar.xz minor-skulk-9aacaaf079373f8bc25f0533d7f6218e691c5de7.zip |
make the main settings ui a bit nicer
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/main.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/web/js/main.js b/web/js/main.js index edb41b1..3c1f23a 100644 --- a/web/js/main.js +++ b/web/js/main.js @@ -545,19 +545,26 @@ class SettingsMain extends HTMLElement { let initProfile = async () => { let profile = await pc.getProfile(); - this.querySelector("#name").value = profile.displayName || ""; - this.querySelector("#frm-name").onsubmit = wrapHandler(async ev => { + this.querySelector("#name").innerText = profile.displayName || ""; + this.querySelector("a._change-name").onclick = wrapHandler(async ev => { ev.preventDefault(); - showMessage("Applying ...") - await pc.setDisplayName(ev.target['name'].value); - hideMessage(); + const name = prompt("please enter your new display name", profile.displayName || ""); + if (name !== null) { + showMessage("Applying ...") + await pc.setDisplayName(name); + hideMessage(); + await this._display(); + } }); this.querySelector("#avatar-img").src = profile.avatar; this.querySelector("#frm-avatar").onsubmit = wrapHandler(async ev => { ev.preventDefault(); - showMessage("Saving ...") - await pc.setAvatar(ev.target['avatar'].files[0]); - await this._display(); + ev.target['avatar'].onchange = async ev => { + showMessage("Saving ...") + await pc.setAvatar(ev.target.files[0]); + await this._display(); + }; + ev.target['avatar'].click(); }); }; |