From 75ba34ef8c5818ce2e6bb5bd52f7fc1230c12016 Mon Sep 17 00:00:00 2001 From: campbell-m <87438215+campbell-m@users.noreply.github.com> Date: Mon, 10 Jun 2024 17:09:50 +0100 Subject: [PATCH 1/2] Fix bug causing automatic scrolling to the current slot to happen after an automatic refresh even when the user has deliberately scrolled back to the top. See also GitHub Issue #3216. --- web/js/refresh.js.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/js/refresh.js.php b/web/js/refresh.js.php index ebae4eccd4..9c55246fa1 100644 --- a/web/js/refresh.js.php +++ b/web/js/refresh.js.php @@ -595,9 +595,14 @@ function getIndices(slots, time) { var bottom = $('.dwm_main thead tr:first th:first').outerHeight(); $('.dwm_main thead tr:nth-child(2) th').css('top', bottom + 'px'); - scrollToCurrentSlot(); - }).trigger('tableload'); + + scrollToCurrentSlot(); + }); From 1a3299ec11e240ec93ce149fc09d3e27308ba0a4 Mon Sep 17 00:00:00 2001 From: campbell-m <87438215+campbell-m@users.noreply.github.com> Date: Mon, 10 Jun 2024 17:15:22 +0100 Subject: [PATCH 2/2] Simplify code --- web/js/refresh.js.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/web/js/refresh.js.php b/web/js/refresh.js.php index 9c55246fa1..6e46d5cb2b 100644 --- a/web/js/refresh.js.php +++ b/web/js/refresh.js.php @@ -21,27 +21,17 @@ var intervalId; function scrollToCurrentSlot() { var table = $('.dwm_main'); var timelineVertical = table.find('thead').data('timeline-vertical'); var container = table.parent(); - var scroll, scrollTo, scrollable; + var scrollTo, scrollable; - if (timelineVertical) - { - scroll = container.scrollLeft(); - scrollable = container.isHScrollable(); - } - else - { - scroll = container.scrollTop(); - scrollable = container.isVScrollable(); - } + scrollable = (timelineVertical) ? container.isHScrollable() : container.isVScrollable(); - if ((scroll === 0) && scrollable) + if (scrollable) { var slots = table.find('thead').data('slots'); var nowSlotIndices = Timeline.search(slots);