Mercurial > prosody-modules
comparison mod_admin_web/admin_web/www_files/js/main.js @ 306:c152ab024d1a
mod_admin_web: Show whether connection is encrypted/compressed
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Mon, 27 Dec 2010 21:34:41 +0100 |
parents | 50abf9922e6e |
children | eeef1fa57f88 |
comparison
equal
deleted
inserted
replaced
305:4c3abf1a9b5a | 306:c152ab024d1a |
---|---|
23 function rawOutput(data) { | 23 function rawOutput(data) { |
24 log('SENT: ' + data); | 24 log('SENT: ' + data); |
25 } | 25 } |
26 | 26 |
27 function _cbNewS2S(e) { | 27 function _cbNewS2S(e) { |
28 var items, retract, id, jid; | 28 var items, entry, retract, id, jid; |
29 items = e.getElementsByTagName('item'); | 29 items = e.getElementsByTagName('item'); |
30 for (i = 0; i < items.length; i++) { | 30 for (i = 0; i < items.length; i++) { |
31 id = items[i].attributes['id'].value; | 31 id = items[i].attributes['id'].value; |
32 jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value; | 32 jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value; |
33 | |
34 entry = $('<li id="' + id + '">' + jid + '</li>'); | |
35 if (e.getElementsByTagName('encrypted')[0]) { | |
36 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />'); | |
37 } | |
38 if (e.getElementsByTagName('compressed')[0]) { | |
39 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />'); | |
40 } | |
41 | |
33 if (items[i].getElementsByTagName('out')[0]) { | 42 if (items[i].getElementsByTagName('out')[0]) { |
34 $('#s2sout').append('<li id="' + id + '">' + jid + '</li>'); | 43 entry.appendTo('#s2sout'); |
35 } else { | 44 } else { |
36 $('#s2sin').append('<li id="' + id + '">' + jid + '</li>'); | 45 entry.appendTo('#s2sin'); |
37 } | 46 } |
38 } | 47 } |
39 retract = e.getElementsByTagName('retract')[0]; | 48 retract = e.getElementsByTagName('retract')[0]; |
40 if (retract) { | 49 if (retract) { |
41 id = retract.attributes['id'].value; | 50 id = retract.attributes['id'].value; |
43 } | 52 } |
44 return true; | 53 return true; |
45 } | 54 } |
46 | 55 |
47 function _cbNewC2S(e) { | 56 function _cbNewC2S(e) { |
48 var items, retract, id, jid; | 57 var items, entry, retract, id, jid; |
49 items = e.getElementsByTagName('item'); | 58 items = e.getElementsByTagName('item'); |
50 for (i = 0; i < items.length; i++) { | 59 for (i = 0; i < items.length; i++) { |
51 id = items[i].attributes['id'].value; | 60 id = items[i].attributes['id'].value; |
52 jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value; | 61 jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value; |
53 $('#c2s').append('<li id="' + id + '">' + jid + '</li>'); | 62 entry = $('<li id="' + id + '">' + jid + '</li>'); |
63 if (e.getElementsByTagName('encrypted')[0]) { | |
64 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />'); | |
65 } | |
66 if (e.getElementsByTagName('compressed')[0]) { | |
67 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />'); | |
68 } | |
69 entry.appendTo('#c2s'); | |
54 } | 70 } |
55 retract = e.getElementsByTagName('retract')[0]; | 71 retract = e.getElementsByTagName('retract')[0]; |
56 if (retract) { | 72 if (retract) { |
57 id = retract.attributes['id'].value; | 73 id = retract.attributes['id'].value; |
58 $('#' + id).remove(); | 74 $('#' + id).remove(); |