Mercurial > prosody-modules
comparison mod_admin_web/admin_web/www_files/js/main.js @ 1117:d643c385d3f6
mod_admin_web: Provide some information about the TLS layer
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Mon, 22 Jul 2013 23:23:02 +0200 |
parents | 83f56d3a07f5 |
children | 1630c6ed3814 |
comparison
equal
deleted
inserted
replaced
1116:2345a30dd8b4 | 1117:d643c385d3f6 |
---|---|
24 function rawOutput(data) { | 24 function rawOutput(data) { |
25 log('SENT: ' + data); | 25 log('SENT: ' + data); |
26 } | 26 } |
27 | 27 |
28 function _cbNewS2S(e) { | 28 function _cbNewS2S(e) { |
29 var items, entry, tmp, retract, id, jid; | 29 var items, item, entry, tmp, retract, id, jid, infos, info, metadata; |
30 items = e.getElementsByTagName('item'); | 30 items = e.getElementsByTagName('item'); |
31 for (i = 0; i < items.length; i++) { | 31 for (i = 0; i < items.length; i++) { |
32 id = items[i].attributes.getNamedItem('id').value; | 32 item = items[i]; |
33 jid = items[i].getElementsByTagName('session')[0].attributes.getNamedItem('jid').value; | 33 id = item.attributes.getNamedItem('id').value; |
34 jid = item.getElementsByTagName('session')[0].attributes.getNamedItem('jid').value; | |
35 infos = item.getElementsByTagName('info'); | |
34 | 36 |
35 entry = $('<li id="' + id + '">' + jid + '</li>'); | 37 entry = $('<li id="' + id + '">' + jid + '</li>'); |
36 if (tmp = items[i].getElementsByTagName('encrypted')[0]) { | 38 if (tmp = item.getElementsByTagName('encrypted')[0]) { |
37 if (tmp.getElementsByTagName('valid')[0]) { | 39 if (tmp.getElementsByTagName('valid')[0]) { |
38 entry.append('<img src="images/secure.png" title="encrypted (certificate valid)" alt=" (secure) (encrypted)" />'); | 40 entry.append('<img src="images/secure.png" title="encrypted (certificate valid)" alt=" (secure) (encrypted)" />'); |
39 } else { | 41 } else { |
40 entry.append('<img src="images/encrypted.png" title="encrypted (certificate invalid)" alt=" (encrypted)" />'); | 42 entry.append('<img src="images/encrypted.png" title="encrypted (certificate invalid)" alt=" (encrypted)" />'); |
41 } | 43 } |
42 } | 44 } |
43 if (items[i].getElementsByTagName('compressed')[0]) { | 45 if (item.getElementsByTagName('compressed')[0]) { |
44 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />'); | 46 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />'); |
45 } | 47 } |
48 metadata = $('<ul/>').css('display', 'none'); | |
49 entry.on('click', function() { | |
50 $(this).find("ul").slideToggle(); | |
51 }); | |
52 metadata.appendTo(entry); | |
53 for (j = 0; j < infos.length; j++) { | |
54 info = infos[j]; | |
55 metadata.append('<li><b>' + info.attributes.getNamedItem('name').value + ':</b> ' + info.innerHTML + '</li>'); | |
56 } | |
57 if (infos.length == 0) | |
58 metadata.append('<li>No information available</li>'); | |
46 | 59 |
47 if (items[i].getElementsByTagName('out')[0]) { | 60 if (items[i].getElementsByTagName('out')[0]) { |
48 entry.appendTo('#s2sout'); | 61 entry.appendTo('#s2sout'); |
49 } else { | 62 } else { |
50 entry.appendTo('#s2sin'); | 63 entry.appendTo('#s2sin'); |
57 } | 70 } |
58 return true; | 71 return true; |
59 } | 72 } |
60 | 73 |
61 function _cbNewC2S(e) { | 74 function _cbNewC2S(e) { |
62 var items, entry, retract, id, jid; | 75 var items, item, entry, retract, id, jid, infos, info, metadata; |
63 items = e.getElementsByTagName('item'); | 76 items = e.getElementsByTagName('item'); |
64 for (i = 0; i < items.length; i++) { | 77 for (i = 0; i < items.length; i++) { |
65 id = items[i].attributes.getNamedItem('id').value; | 78 item = items[i]; |
66 jid = items[i].getElementsByTagName('session')[0].attributes.getNamedItem('jid').value; | 79 id = item.attributes.getNamedItem('id').value; |
80 jid = item.getElementsByTagName('session')[0].attributes.getNamedItem('jid').value; | |
81 infos = item.getElementsByTagName('info'); | |
67 entry = $('<li id="' + id + '">' + jid + '</li>'); | 82 entry = $('<li id="' + id + '">' + jid + '</li>'); |
68 if (items[i].getElementsByTagName('encrypted')[0]) { | 83 if (item.getElementsByTagName('encrypted')[0]) { |
69 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />'); | 84 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />'); |
70 } | 85 } |
71 if (items[i].getElementsByTagName('compressed')[0]) { | 86 if (item.getElementsByTagName('compressed')[0]) { |
72 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />'); | 87 entry.append('<img src="images/compressed.png" title="compressed" alt=" (compressed)" />'); |
73 } | 88 } |
89 metadata = $('<ul/>').css('display', 'none'); | |
90 entry.on('click', function() { | |
91 $(this).find("ul").slideToggle(); | |
92 }); | |
93 metadata.appendTo(entry); | |
94 for (j = 0; j < infos.length; j++) { | |
95 info = infos[j]; | |
96 metadata.append('<li><b>' + info.attributes.getNamedItem('name').value + ':</b> ' + info.innerHTML + '</li>'); | |
97 } | |
98 if (infos.length == 0) | |
99 metadata.append('<li>No information available</li>'); | |
74 entry.appendTo('#c2s'); | 100 entry.appendTo('#c2s'); |
75 } | 101 } |
76 retract = e.getElementsByTagName('retract')[0]; | 102 retract = e.getElementsByTagName('retract')[0]; |
77 if (retract) { | 103 if (retract) { |
78 id = retract.attributes.getNamedItem('id').value; | 104 id = retract.attributes.getNamedItem('id').value; |