]> git.openstreetmap.org Git - rails.git/commitdiff
Set map hashes on place history pagination links
authorAnton Khorev <tony29@yandex.ru>
Wed, 2 Apr 2025 05:32:56 +0000 (08:32 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 2 Apr 2025 05:32:56 +0000 (08:32 +0300)
app/assets/javascripts/index/history.js

index 50d3f70b9f1e332ddab03aab08ee4f4ec9eb7f78..4a1c05e4ed46abe48ab30cbe893dfcedd8700d2d 100644 (file)
@@ -104,6 +104,10 @@ OSM.History = function (map) {
 
   function displayFirstChangesets(html) {
     $("#sidebar_content .changesets").html(html);
+
+    if (location.pathname === "/history") {
+      setPaginationMapHashes();
+    }
   }
 
   function displayMoreChangesets(div, html) {
@@ -130,6 +134,19 @@ OSM.History = function (map) {
       nextNewList.children().appendTo(oldList);
       nextNewList.remove();
     }
+
+    if (location.pathname === "/history") {
+      setPaginationMapHashes();
+    }
+  }
+
+  function setPaginationMapHashes() {
+    $("#sidebar .pagination a").each(function () {
+      $(this).prop("hash", OSM.formatHash({
+        center: map.getCenter(),
+        zoom: map.getZoom()
+      }));
+    });
   }
 
   function loadFirstChangesets() {