comparison client.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 962f64b156dd
children 07543f7f5e89
comparison
equal deleted inserted replaced
14:962f64b156dd 15:3eed9fe0bd7c
73 console.log('Strophe is connecting.'); 73 console.log('Strophe is connecting.');
74 connect_button.value = 'Log out'; 74 connect_button.value = 'Log out';
75 connect_button.classList.add('disconnect'); 75 connect_button.classList.add('disconnect');
76 jid_element.disabled = true; 76 jid_element.disabled = true;
77 pass_element.disabled = true; 77 pass_element.disabled = true;
78 spinner_img.hidden = false; 78 displaySpinner(spinner_img);
79 } else if (status == Strophe.Status.CONNFAIL) { 79 } else if (status == Strophe.Status.CONNFAIL) {
80 console.log('Strophe failed to connect.'); 80 console.log('Strophe failed to connect.');
81 onDisconnected(); 81 onDisconnected();
82 } else if (status == Strophe.Status.DISCONNECTING) { 82 } else if (status == Strophe.Status.DISCONNECTING) {
83 console.log('Strophe is disconnecting.'); 83 console.log('Strophe is disconnecting.');
84 spinner_img.hidden = false; 84 displaySpinner(spinner_img);
85 } else if (status == Strophe.Status.DISCONNECTED) { 85 } else if (status == Strophe.Status.DISCONNECTED) {
86 console.log('Strophe is disconnected.'); 86 console.log('Strophe is disconnected.');
87 onDisconnected(); 87 onDisconnected();
88 } else if (status == Strophe.Status.CONNECTED) { 88 } else if (status == Strophe.Status.CONNECTED) {
89 console.log('Strophe is connected.'); 89 console.log('Strophe is connected.');
94 function onConnected() 94 function onConnected()
95 { 95 {
96 jid_element.hidden = true; 96 jid_element.hidden = true;
97 pass_element.hidden = true; 97 pass_element.hidden = true;
98 connected_div.hidden = false; 98 connected_div.hidden = false;
99 spinner_img.hidden = true; 99 hideSpinner(spinner_img);
100 initRoster(connection); 100 initRoster(connection);
101 initPEP(connection); 101 initPEP(connection);
102 initNickname(connection); 102 initNickname(connection);
103 initAvatar(connection); 103 initAvatar(connection);
104 } 104 }
109 connect_button.classList.remove('disconnect'); 109 connect_button.classList.remove('disconnect');
110 jid_element.hidden = false; 110 jid_element.hidden = false;
111 jid_element.disabled = false; 111 jid_element.disabled = false;
112 pass_element.hidden = false; 112 pass_element.hidden = false;
113 pass_element.disabled = false; 113 pass_element.disabled = false;
114 spinner_img.hidden = true; 114 hideSpinner(spinner_img);
115 connected_div.hidden = true; 115 connected_div.hidden = true;
116 let table = document.getElementById('roster-table'); 116 let table = document.getElementById('roster-table');
117 while (table.hasChildNodes()) { 117 while (table.hasChildNodes()) {
118 table.removeChild(table.lastChild); 118 table.removeChild(table.lastChild);
119 } 119 }