check

Change-Id: Ic15935035fd530425976228077aad3c6f7c560af
diff --git a/gui/html/chronoshare.js b/gui/html/chronoshare.js
new file mode 100644
index 0000000..3ceb828
--- /dev/null
+++ b/gui/html/chronoshare.js
@@ -0,0 +1,65 @@
+
+  hostip = "127.0.0.1";
+        
+  var AsyncGetClosure = function AsyncGetClosure() {
+                      Closure.call(this);
+              };
+
+              AsyncGetClosure.prototype.upcall = function(kind, upcallInfo, tmp) {
+                      if (kind == Closure.UPCALL_FINAL) {
+                              // Do nothing.
+                      } else if (kind == Closure.UPCALL_CONTENT) {
+                              var content = upcallInfo.contentObject;
+      var nameStr = content.name.getName().split("/").slice(5,6);
+      
+      if (nameStr == "prefix") {
+        document.getElementById('prefixcontent').innerHTML = DataUtils.toString(content.content);
+        prefix();
+      } else if (nameStr == "link") {
+        document.getElementById('linkcontent').innerHTML = DataUtils.toString(content.content);
+        link();
+      } else {
+        var data = DataUtils.toString(content.content);
+        var obj = jQuery.parseJSON(data);
+        document.getElementById("lastupdated").innerHTML = obj.lastupdated;
+        document.getElementById("lastlog").innerHTML = obj.lastlog;
+        document.getElementById("lasttimestamp").innerHTML = obj.lasttimestamp;
+      }
+                      } else if (kind == Closure.UPCALL_INTEREST_TIMED_OUT) {
+                              console.log("Closure.upcall called with interest time out.");
+                      }
+                      return Closure.RESULT_OK;
+              };
+
+              function getStatus(name) {
+    // Template interest to get the latest content.
+    var interest = new Interest("/tmp/");
+                      interest.childSelector = 1;
+                      interest.interestLifetime = 4000;
+
+                      ndn.expressInterest(new Name("/ndn/memphis.edu/netlab/status/" + name), new AsyncGetClosure(), interest);
+  }
+
+  // Calls to get the content data.
+  function begin() {
+    getStatus("metadata");
+    getStatus("prefix");
+    getStatus("link");
+  }
+
+  var ndn;
+  $(document).ready(function() {
+    $("#all").fadeIn(500);
+    var res = detect();
+
+    if (!res) {
+      $("#base").fadeOut(50);
+      $("#nosupport").fadeIn(500);
+    }
+    else {
+      openHandle = function() { console.log("NDN established"); };
+      ndn = new NDN({host:hostip, onopen:openHandle});
+      ndn.transport.connectWebSocket(ndn);
+    }
+  });
+