Difference between revisions of "Widget:Pamela"

From Whitespace (Hackerspace Gent)
Jump to: navigation, search
Line 10: Line 10:
 
function LoadPamelaCountWidget()
 
function LoadPamelaCountWidget()
 
{
 
{
     var Url = window.location.protocol + "//0x20.be/pam/macs";
+
     var Url = window.location.protocol + "//0x20.be/pam/data";
  
 
     xmlHttp = new XMLHttpRequest();
 
     xmlHttp = new XMLHttpRequest();
Line 22: Line 22:
 
function ProcessRequest()
 
function ProcessRequest()
 
{
 
{
     var macs, i;
+
     var data, i;
 
     var pamTalkPeople = ['is nobody', 'is one person', 'are two people', 'are three people', 'are four people', 'are five people'];
 
     var pamTalkPeople = ['is nobody', 'is one person', 'are two people', 'are three people', 'are four people', 'are five people'];
 
     var pamTalkMachines = ['are no machines', 'is one machine', 'are two machines', 'are three machines', 'are four machines', 'are five machines'];
 
     var pamTalkMachines = ['are no machines', 'is one machine', 'are two machines', 'are three machines', 'are four machines', 'are five machines'];
Line 31: Line 31:
 
         return;
 
         return;
  
     var macs = eval ( "(" + xmlHttp.responseText + ")" );
+
     var data = eval ( "(" + xmlHttp.responseText + ")" );
  
 
     var people = [];
 
     var people = [];
Line 37: Line 37:
 
     var entities = [];
 
     var entities = [];
  
     for (i = macs.length -1; i >= 0; i--) {
+
     for (i = data.length -1; i >= 0; i--) {
         if (macs[i].indexOf('(') != -1) {
+
         if (data[i].indexOf('(') != -1) {
             services.push('<span style="color:darkgray">' + macs[i] + '</span>');
+
             services.push('<span style="color:darkgray">' + data[i] + '</span>');
 
         }
 
         }
         else if (macs[i].split( ':' ).length == 6) {
+
         else if (data[i].split( ':' ).length == 6) {
             entities.push(macs[i]);
+
             entities.push(data[i]);
 
         }
 
         }
 
// Hack please remove once the pamela db has been fixed
 
// Hack please remove once the pamela db has been fixed
         else if (macs[i] == 'the cable guy') {
+
         else if (data[i] == 'the cable guy') {
             services.push('<span style="color:darkgray">' + macs[i] + '</span>');
+
             services.push('<span style="color:darkgray">' + data[i] + '</span>');
 
         }
 
         }
 
// End of code to remove
 
// End of code to remove
 
         else {
 
         else {
             people.unshift('<a href="' + window.location.protocol + '//0x20.be/' + macs[i] + '">' + macs[i] + '</a>');
+
             people.unshift('<a href="' + window.location.protocol + '//0x20.be/' + data[i] + '">' + data[i] + '</a>');
 
         }
 
         }
 
     }
 
     }
Line 56: Line 56:
 
     document.getElementById('openbanner').style.display = people.length > 0 ? 'block' : 'none';
 
     document.getElementById('openbanner').style.display = people.length > 0 ? 'block' : 'none';
  
     if ( macs.length > 0 ) {
+
     if ( data.length > 0 ) {
 
var msg = "";
 
var msg = "";
  

Revision as of 00:45, 13 February 2011

The space is open!

Loading Pamela...