storing rooms
authorDominique Hazaël-Massieux <dom@w3.org>
Fri, 20 Jul 2012 15:34:18 +0200
changeset 741 2289a0499dbf
parent 740 a56c7635ac0f
child 742 d958fd164272
storing rooms
node.js/public/js/map.js
--- a/node.js/public/js/map.js	Fri Jul 20 14:59:24 2012 +0200
+++ b/node.js/public/js/map.js	Fri Jul 20 15:34:18 2012 +0200
@@ -46,6 +46,7 @@
 var xlinkns = "http://www.w3.org/1999/xlink";
 var xhtmlns = "http://www.w3.org/1999/xhtml";
 var roomsCounter = {};
+var rooms = {};
 var youareherePoint = document.createElementNS(svgns, "circle");
 youareherePoint.setAttribute( "r", "2px");
 youareherePoint.setAttribute( "id", "you");
@@ -112,14 +113,14 @@
 xhr.open("GET","../locations.json", true);
 xhr.onreadystatechange = function() {
     if (4 == xhr.readyState) {
-        var json = JSON.parse(xhr.responseText);
+        rooms = JSON.parse(xhr.responseText);
         for ( var i = 0, len = Object.keys(json).length; len > i; i++ ) {
-	    if (json[i].checkedin.length) {
+	    if (rooms[i].checkedin.length) {
 		updateCounter( json[i].shortname, json[i].checkedin.length );
             } 
         }
     }
-}
+};
 xhr.send();   
 
 var tweetQueue = [];