X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=gallery%2Fgallery.js;h=08299aa6a588e244100ceedb1f9643da97e7bbff;hb=3c10a0f3519355ee651d04bf2972bd31298eff18;hp=dc508130b9463e1f880300ae74bf13cee463227e;hpb=c1f22b5a5d4ffbf25a75fc567232e65381c1938b;p=dygraphs.git diff --git a/gallery/gallery.js b/gallery/gallery.js index dc50813..08299aa 100644 --- a/gallery/gallery.js +++ b/gallery/gallery.js @@ -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); @@ -70,7 +70,11 @@ Gallery.register = function(id, demo) { }; Gallery.hashChange = function(event) { - var id = location.hash.substring(1) + "-toc"; - var elem = document.getElementById(id); - elem.onclick(); + if (location.hash) { + 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