Add first part of linear regression, and fixed hash hack so it doesn't jump.
[dygraphs.git] / gallery / gallery.js
index 10128ff..08299aa 100644 (file)
@@ -46,7 +46,7 @@ Gallery.start = function() {
       document.getElementById("title").textContent = demo.title ? demo.title : "";
       demo.innerDiv.className = "selected";
       Gallery.workareaChild.id = id;
-      location.hash = id;
+      location.hash = "g/" + id;
       Gallery.workareaChild.innerHTML='';
       if (demo.setup) {
         demo.setup(Gallery.workareaChild);
@@ -71,8 +71,10 @@ Gallery.register = function(id, demo) {
 
 Gallery.hashChange = function(event) {
   if (location.hash) {
-    var id = location.hash.substring(1) + "-toc";
-    var elem = document.getElementById(id);
-    elem.onclick();
+    if (location.hash.indexOf("#g/") == 0) {
+      var id = location.hash.substring(3) + "-toc";
+      var elem = document.getElementById(id);
+      elem.onclick();
+    }
   }
 };
\ No newline at end of file