From: John Firebaugh Date: Thu, 8 Aug 2013 18:51:13 +0000 (-0700) Subject: Add a hash if one isn't already present X-Git-Tag: live~4838 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/dc5d88d93d4529169429c91a631b80cff7ca605a Add a hash if one isn't already present --- diff --git a/app/views/site/id.html.erb b/app/views/site/id.html.erb index 53e177a3f..1b4cdf1bb 100644 --- a/app/views/site/id.html.erb +++ b/app/views/site/id.html.erb @@ -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)); } }));