Difference between revisions of "Widget:Pamela"

From Whitespace (Hackerspace Gent)
Jump to: navigation, search
Line 1: Line 1:
<includeonly><div id="pamelaWidget">Loading <a href='http://0x20.be/Pamela'>Pamela</a>...</div><script type="text/javascript">var xmlHttp = null;
+
<includeonly>
 +
<div id="pamelaWidget">Loading <a href='http://0x20.be/Pamela'>Pamela</a>...</div>
 +
<script type="text/javascript">
 +
var xmlHttp = null;
  
function LoadPameleCountWidget()
+
function LoadPamelaCountWidget()
 
{
 
{
 
     var Url = "http://0x20.be/pam/macs";
 
     var Url = "http://0x20.be/pam/macs";
  
     xmlHttp = new XMLHttpRequest();  
+
     xmlHttp = new XMLHttpRequest();
 
     xmlHttp.onreadystatechange = ProcessRequest;
 
     xmlHttp.onreadystatechange = ProcessRequest;
 
     xmlHttp.open( "GET", Url, true );
 
     xmlHttp.open( "GET", Url, true );
 
     xmlHttp.send( null );
 
     xmlHttp.send( null );
  
     setTimeout( function() { LoadPameleCountWidget(); }, 60000 );
+
     setTimeout( function() { LoadPamelaCountWidget(); }, 60000 );
 
}
 
}
  
function ProcessRequest()  
+
function ProcessRequest()
 
{
 
{
     if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 )  
+
     if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 )
 
     {
 
     {
         if ( xmlHttp.responseText != "Not found" )  
+
         if ( xmlHttp.responseText != "Not found" )
 
         {
 
         {
 
             var macs = eval ( "(" + xmlHttp.responseText + ")" );
 
             var macs = eval ( "(" + xmlHttp.responseText + ")" );
           
 
 
             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( ", " );
 
             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( ", " );
         }                  
+
         }      
 
     }
 
     }
 
}
 
}
  
LoadPameleCountWidget();</script></includeonly>
+
LoadPamelaCountWidget();
 +
</script>
 +
</includeonly>

Revision as of 22:24, 19 December 2010