Mercurial > xmpp-account-manager
diff nickname.js @ 15:3eed9fe0bd7c
End spinners with either a green ✔ or a red ✘.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 22 Dec 2018 18:38:27 +0100 |
parents | aedf80eefc19 |
children | 45bd945c5722 |
line wrap: on
line diff
--- a/nickname.js +++ b/nickname.js @@ -8,7 +8,7 @@ function initNickname(connection) { .c('pubsub', {xmlns: 'http://jabber.org/protocol/pubsub'}) .c('items', {node: 'http://jabber.org/protocol/nick'}); connection.sendIQ(iq, onNickname, onNicknameRetrievalError.bind(null, 'PubSub query failed.')); - spinner_img.hidden = false; + displaySpinner(spinner_img); function onNickname(result_iq) { @@ -18,13 +18,13 @@ function initNickname(connection) { const id = item.getAttributeNS(null, 'id'); const nick = parseXPath(item, './nickname:nick'); nick_input.value = nick.textContent; - spinner_img.hidden = true; + hideSpinner(spinner_img); } function onNicknameRetrievalError(string) { console.log('Failed to retrieve nickname: ' + string); - spinner_img.hidden = true; + hideSpinner(spinner_img); } nick_input.addEventListener('blur', function (evt) { @@ -35,18 +35,18 @@ function initNickname(connection) { .c('nick', {xmlns: 'http://jabber.org/protocol/nick'}) .t(nick_input.value); connection.sendIQ(iq, onNicknameChanged, onNicknameChangeError); - spinner_img.hidden = false; + displaySpinner(spinner_img); }); - function onNicknameChanged(iq) + function onNicknameChanged(result_iq) { - console.log("onNicknameChanged", iq); - spinner_img.hidden = true; + console.log("Nickname successfully changed."); + spinnerOk(spinner_img); } function onNicknameChangeError(iq) { console.log("onNicknameChangeError", iq); - spinner_img.hidden = true; + spinnerError(spinner_img); } }