Widget:Pamela
From Whitespace (Hackerspace Gent)
(Difference between revisions)
| Line 18: | Line 18: | ||
function ProcessRequest() | function ProcessRequest() | ||
{ | { | ||
| − | if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 ) | + | var macs, i; |
| − | + | ||
| − | if ( xmlHttp.responseText | + | if ( !(xmlHttp.readyState == 4 && xmlHttp.status == 200)) |
| − | + | return; | |
| − | + | if ( xmlHttp.responseText == "Not found" ) | |
| − | + | return; | |
| − | } | + | |
| + | macs = eval ( "(" + xmlHttp.responseText + ")" ); | ||
| + | for (i = 0; i < macs.length; i++) { | ||
| + | if (macs[i].indexOf('(')) == -1) { | ||
| + | document.getElementById('openbanner').style.display = 'block'; | ||
| + | break; | ||
| + | } | ||
} | } | ||
| + | document.getElementById( "pamelaWidget" ).innerHTML = "According to <a href='http://0x20.be/Pamela'>Pamela</a> there are " + macs.length + " devices active in the space: " + macs.join( ", " ); | ||
| + | } | ||
} | } | ||