comparison roster.js @ 34:45bd945c5722

Change all blur events to change, prevents a stanza when no change occured.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 23 Dec 2018 20:31:02 +0100
parents 5e97e1808a35
children c2e2b107c7c1
comparison
equal deleted inserted replaced
33:038cab68fa3a 34:45bd945c5722
26 td.appendChild(a); 26 td.appendChild(a);
27 tr.appendChild(td); 27 tr.appendChild(td);
28 td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td'); 28 td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td');
29 const input = document.createElementNS('http://www.w3.org/1999/xhtml', 'input'); 29 const input = document.createElementNS('http://www.w3.org/1999/xhtml', 'input');
30 input.value = name; 30 input.value = name;
31 input.onblur = function (evt) { 31 input.addEventListener('change', function (evt) {
32 const iq = $iq({type: 'set'}) 32 const iq = $iq({type: 'set'})
33 .c('query', {xmlns: NS.roster}) 33 .c('query', {xmlns: NS.roster})
34 .c('item', {jid: jid, name: evt.target.value}); 34 .c('item', {jid: jid, name: evt.target.value});
35 for (let group of groups) 35 for (let group of groups)
36 iq.c('group').t(group.textContent).up(); 36 iq.c('group').t(group.textContent).up();
37 connection.sendIQ(iq, onRosterSet, onRosterSetError.bind(null, 'Roster set failed.')); 37 connection.sendIQ(iq, onRosterSet, onRosterSetError.bind(null, 'Roster set failed.'));
38 }; 38 });
39 td.appendChild(input); 39 td.appendChild(input);
40 tr.appendChild(td); 40 tr.appendChild(td);
41 td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td'); 41 td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td');
42 td.textContent = subscription; 42 td.textContent = subscription;
43 tr.appendChild(td); 43 tr.appendChild(td);