comparison pep.js @ 46:af2874ff7234

mathieui: Ask the user for confirmation before deleting PEP nodes or contacts.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 23 May 2020 19:01:23 +0200
parents c2e2b107c7c1
children 010b905a74d4
comparison
equal deleted inserted replaced
45:8b69b3a1ef8e 46:af2874ff7234
63 const button = document.createElementNS('http://www.w3.org/1999/xhtml', 'button'); 63 const button = document.createElementNS('http://www.w3.org/1999/xhtml', 'button');
64 button.classList.add('btn'); 64 button.classList.add('btn');
65 button.classList.add('btn-danger'); 65 button.classList.add('btn-danger');
66 button.textContent = '✕'; 66 button.textContent = '✕';
67 button.onclick = function (evt) { 67 button.onclick = function (evt) {
68 const really = confirm('Do you really want to remove the node ' + node + '?');
69 if (!really)
70 return;
68 const iq = $iq({type: 'set'}) 71 const iq = $iq({type: 'set'})
69 .c('pubsub', {xmlns: NS.pubsub_owner}) 72 .c('pubsub', {xmlns: NS.pubsub_owner})
70 .c('delete', {node: node}); 73 .c('delete', {node: node});
71 connection.sendIQ(iq, onNodeDeleted.bind(node), onNodeDeletionError.bind(node, 'PEP node deletion failed.')); 74 connection.sendIQ(iq, onNodeDeleted.bind(node), onNodeDeletionError.bind(node, 'PEP node deletion failed.'));
72 }; 75 };