Mercurial > prosody-modules
comparison mod_admin_web/admin_web/www_files/js/main.js @ 614:40ab83736f6e
mod_admin_web: Correctly access items in NamedNodeMaps
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Tue, 14 Feb 2012 21:21:40 +0100 |
parents | 1c2fc3b845f2 |
children | fa996cfec6da |
comparison
equal
deleted
inserted
replaced
613:b5a8e8492570 | 614:40ab83736f6e |
---|---|
27 | 27 |
28 function _cbNewS2S(e) { | 28 function _cbNewS2S(e) { |
29 var items, entry, tmp, retract, id, jid; | 29 var items, entry, tmp, retract, id, jid; |
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['id'].value; | 32 id = items[i].attributes.getNamedItem('id').value; |
33 jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value; | 33 jid = items[i].getElementsByTagName('session')[0].attributes.getNamedItem('jid').value; |
34 | 34 |
35 entry = $('<li id="' + id + '">' + jid + '</li>'); | 35 entry = $('<li id="' + id + '">' + jid + '</li>'); |
36 if (tmp = items[i].getElementsByTagName('encrypted')[0]) { | 36 if (tmp = items[i].getElementsByTagName('encrypted')[0]) { |
37 if (tmp.getElementsByTagName('valid')[0]) { | 37 if (tmp.getElementsByTagName('valid')[0]) { |
38 entry.append('<img src="images/secure.png" title="encrypted (certificate valid)" alt=" (secure) (encrypted)" />'); | 38 entry.append('<img src="images/secure.png" title="encrypted (certificate valid)" alt=" (secure) (encrypted)" />'); |
50 entry.appendTo('#s2sin'); | 50 entry.appendTo('#s2sin'); |
51 } | 51 } |
52 } | 52 } |
53 retract = e.getElementsByTagName('retract')[0]; | 53 retract = e.getElementsByTagName('retract')[0]; |
54 if (retract) { | 54 if (retract) { |
55 id = retract.attributes['id'].value; | 55 id = retract.attributes.getNamedItem('id').value; |
56 $('#' + id).remove(); | 56 $('#' + id).remove(); |
57 } | 57 } |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 function _cbNewC2S(e) { | 61 function _cbNewC2S(e) { |
62 var items, entry, retract, id, jid; | 62 var items, entry, retract, id, jid; |
63 items = e.getElementsByTagName('item'); | 63 items = e.getElementsByTagName('item'); |
64 for (i = 0; i < items.length; i++) { | 64 for (i = 0; i < items.length; i++) { |
65 id = items[i].attributes['id'].value; | 65 id = items[i].attributes.getNamedItem('id').value; |
66 jid = items[i].getElementsByTagName('session')[0].attributes['jid'].value; | 66 jid = items[i].getElementsByTagName('session')[0].attributes.getNamedItem('jid').value; |
67 entry = $('<li id="' + id + '">' + jid + '</li>'); | 67 entry = $('<li id="' + id + '">' + jid + '</li>'); |
68 if (items[i].getElementsByTagName('encrypted')[0]) { | 68 if (items[i].getElementsByTagName('encrypted')[0]) { |
69 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />'); | 69 entry.append('<img src="images/encrypted.png" title="encrypted" alt=" (encrypted)" />'); |
70 } | 70 } |
71 if (items[i].getElementsByTagName('compressed')[0]) { | 71 if (items[i].getElementsByTagName('compressed')[0]) { |
73 } | 73 } |
74 entry.appendTo('#c2s'); | 74 entry.appendTo('#c2s'); |
75 } | 75 } |
76 retract = e.getElementsByTagName('retract')[0]; | 76 retract = e.getElementsByTagName('retract')[0]; |
77 if (retract) { | 77 if (retract) { |
78 id = retract.attributes['id'].value; | 78 id = retract.attributes.getNamedItem('id').value; |
79 $('#' + id).remove(); | 79 $('#' + id).remove(); |
80 } | 80 } |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 function _cbAdminSub(e) { | 84 function _cbAdminSub(e) { |
85 var node = e.getElementsByTagName('items')[0].attributes['node'].value; | 85 var node = e.getElementsByTagName('items')[0].attributes.getNamedItem('node').value; |
86 if (node == Strophe.NS.C2SSTREAM) { | 86 if (node == Strophe.NS.C2SSTREAM) { |
87 _cbNewC2S(e); | 87 _cbNewC2S(e); |
88 } else if (node == Strophe.NS.S2SSTREAM) { | 88 } else if (node == Strophe.NS.S2SSTREAM) { |
89 _cbNewS2S(e); | 89 _cbNewS2S(e); |
90 } | 90 } |