]> git.openstreetmap.org Git - rails.git/commitdiff
Scroll to first/last changeset in history list if before/after param is given
authorAnton Khorev <tony29@yandex.ru>
Sun, 16 Mar 2025 23:07:50 +0000 (02:07 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sun, 23 Mar 2025 19:14:23 +0000 (22:14 +0300)
app/assets/javascripts/index/history.js

index 372bf04f5fd5fa6ca466bb8ae4cbb70403ad4cb6..d37f96f069da6f38e85417a9a0d95d76a7f6f8d9 100644 (file)
@@ -159,6 +159,16 @@ OSM.History = function (map) {
       .then(function (html) {
         displayFirstChangesets(html);
         enableChangesetIntersectionObserver();
       .then(function (html) {
         displayFirstChangesets(html);
         enableChangesetIntersectionObserver();
+
+        if (params.has("before")) {
+          const [firstItem] = $("#sidebar_content .changesets ol").children().first();
+          firstItem?.scrollIntoView();
+        }
+        if (params.has("after")) {
+          const [lastItem] = $("#sidebar_content .changesets ol").children().last();
+          lastItem?.scrollIntoView(false);
+        }
+
         updateMap();
       });
   }
         updateMap();
       });
   }