]> git.openstreetmap.org Git - rails.git/commitdiff
Position on notes correctly when a link to a comment is loaded
authorTom Hughes <tom@compton.nu>
Wed, 4 Dec 2013 08:41:56 +0000 (08:41 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 4 Dec 2013 08:41:56 +0000 (08:41 +0000)
Links to note comments in the RSS feed have a #id on the end to
position on the right comment, so don't let those hash strings
stop the map from panning to the note.

Fixes #603.

app/assets/javascripts/index/note.js.erb

index aa746265cb409ed595228b97cc040bb88c3f5577..2a2599a3ca3140267b0453e018c3617814686e65 100644 (file)
@@ -64,7 +64,7 @@ OSM.Note = function (map) {
     var data = $('.details').data(),
       latLng = data.coordinates.split(',');
 
-    if (!window.location.hash) {
+    if (!window.location.hash || window.location.hash.match(/^#?c[0-9]+$/)) {
       OSM.router.moveListenerOff();
       map.once('moveend', OSM.router.moveListenerOn);
       map.getZoom() > 15 ? map.panTo(latLng) : map.setView(latLng, 16);