Add a hash if one isn't already present
authorJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 8 Aug 2013 18:51:13 +0000 (11:51 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 8 Aug 2013 18:51:13 +0000 (11:51 -0700)
app/views/site/id.html.erb

index 53e177a3fb90a75f45c903f67bdc8c27820fb0c5..1b4cdf1bbb778f3bd6a76d27d543ed452c8ca1d9 100644 (file)
@@ -51,7 +51,7 @@
       // http://bl.ocks.org/jfirebaugh/5439412
       var hash = parent.OSM.formatHash({ lon: center[0], lat: center[1], zoom: zoom });
       if (hash !== parent.location.hash) {
-        parent.location.replace(parent.location.href.replace(/#.*/, hash));
+        parent.location.replace(parent.location.href.replace(/(#.*|$)/, hash));
       }
     }));