From ebd1186c5f84dd6f705447b1707079f186ea0a47 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Mon, 17 Mar 2025 02:07:50 +0300 Subject: [PATCH] Scroll to first/last changeset in history list if before/after param is given --- app/assets/javascripts/index/history.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index 372bf04f5..d37f96f06 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -159,6 +159,16 @@ OSM.History = function (map) { .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(); }); } -- 2.39.5