changeset 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 038cab68fa3a
children 084202870d76
files mam.js nickname.js roster.js vcard.js
diffstat 4 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mam.js
+++ b/mam.js
@@ -74,8 +74,8 @@ function initMAM(connection) {
     }
 
     prefs_default.addEventListener('change', submitPrefs);
-    prefs_always.addEventListener('blur', submitPrefs);
-    prefs_never.addEventListener('blur', submitPrefs);
+    prefs_always.addEventListener('change', submitPrefs);
+    prefs_never.addEventListener('change', submitPrefs);
 
     function onPrefsSet(iq)
     {
--- a/nickname.js
+++ b/nickname.js
@@ -27,7 +27,7 @@ function initNickname(connection) {
         hideSpinner(spinner_img);
     }
 
-    nick_input.addEventListener('blur', function (evt) {
+    nick_input.addEventListener('change', function (evt) {
         const iq = $iq({type: 'set'})
             .c('pubsub', {xmlns: 'http://jabber.org/protocol/pubsub'})
                 .c('publish', {node: 'http://jabber.org/protocol/nick'})
--- a/roster.js
+++ b/roster.js
@@ -28,14 +28,14 @@ function initRoster(connection) {
             td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td');
             const input = document.createElementNS('http://www.w3.org/1999/xhtml', 'input');
             input.value = name;
-            input.onblur = function (evt) {
+            input.addEventListener('change', function (evt) {
                 const iq = $iq({type: 'set'})
                     .c('query', {xmlns: NS.roster})
                         .c('item', {jid: jid, name: evt.target.value});
                 for (let group of groups)
                     iq.c('group').t(group.textContent).up();
                 connection.sendIQ(iq, onRosterSet, onRosterSetError.bind(null, 'Roster set failed.'));
-            };
+            });
             td.appendChild(input);
             tr.appendChild(td);
             td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td');
--- a/vcard.js
+++ b/vcard.js
@@ -69,8 +69,8 @@ function initVCard(connection) {
         displaySpinner(spinner_img);
     }
 
-    vcard_fn.addEventListener('blur', setVCard4);
-    vcard_email.addEventListener('blur', setVCard4);
+    vcard_fn.addEventListener('change', setVCard4);
+    vcard_email.addEventListener('change', setVCard4);
     vcard_bday.addEventListener('change', setVCard4);
 
     function onVCard4Changed(result_iq)