Difference between revisions of "Widget:Pamela"

From Whitespace (Hackerspace Gent)
Jump to: navigation, search
m
Line 25: Line 25:
 
         return;
 
         return;
  
     macs = eval ( "(" + xmlHttp.responseText + ")" );
+
     var macs = eval ( "(" + xmlHttp.responseText + ")" );
     var isOpen = false;
+
     var people = [];
 +
    var services = [];
 +
 
 
     for (i = macs.length -1; i >= 0; i--) {
 
     for (i = macs.length -1; i >= 0; i--) {
 
         if (macs[i].indexOf('(') == -1) {
 
         if (macs[i].indexOf('(') == -1) {
             isOpen = true;
+
             people.push(macs[i]);
             break;
+
        }
 +
        else {
 +
             services.push('<span style="color:darkgray">' + macs[i] + '</span>');
 
         }
 
         }
 
     }
 
     }
     document.getElementById('openbanner').style.display = isOpen ? 'block' : 'none';
+
 
     document.getElementById( "pamelaWidget" ).innerHTML = "According to <a href='" + window.location.protocol + "//0x20.be/Pamela'>Pamela</a> there are " + macs.length + " devices active in the space: " + macs.join( ", " );
+
     document.getElementById('openbanner').style.display = people.length > 0 ? 'block' : 'none';
 +
     document.getElementById( "pamelaWidget" ).innerHTML = "According to <a href='" + window.location.protocol + "//0x20.be/Pamela'>Pamela</a> there are " + macs.length + " devices active in the space: " + people.concat(services).join( ", " );
 
}
 
}
  

Revision as of 18:13, 20 December 2010