X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=gallery%2Fgallery.js;h=08299aa6a588e244100ceedb1f9643da97e7bbff;hb=3c10a0f3519355ee651d04bf2972bd31298eff18;hp=10128ff480510b8e0519e4ae00cc6b15bea20321;hpb=72c8bf9993215da78476fa918af09e12b297a34c;p=dygraphs.git diff --git a/gallery/gallery.js b/gallery/gallery.js index 10128ff..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); @@ -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