summaryrefslogtreecommitdiff
path: root/Omni/Jr/Web/Components.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-12-01 23:02:17 -0500
committerBen Sima <ben@bensima.com>2025-12-01 23:02:17 -0500
commit90b6b21990df76051a9f639cd7596ec3e93de564 (patch)
tree8365faa1e5bac59f864f5b16d24792b270add7a1 /Omni/Jr/Web/Components.hs
parent0c3b77c06028205aac0184973037355689fc3c9e (diff)
fix: lint Admin.py after refactor
Diffstat (limited to 'Omni/Jr/Web/Components.hs')
-rw-r--r--Omni/Jr/Web/Components.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/Omni/Jr/Web/Components.hs b/Omni/Jr/Web/Components.hs
index 2f885ce..ac36131 100644
--- a/Omni/Jr/Web/Components.hs
+++ b/Omni/Jr/Web/Components.hs
@@ -1730,14 +1730,22 @@ timelineScrollScript =
]
( Text.unlines
[ "(function() {",
- " if (typeof autoscrollEnabled !== 'undefined' && !autoscrollEnabled) return;",
- " var log = document.querySelector('.timeline-events');",
- " if (log) {",
- " var isNearBottom = log.scrollHeight - log.scrollTop - log.clientHeight < 100;",
- " if (isNearBottom) {",
- " log.scrollTop = log.scrollHeight;",
+ " function scrollToBottom() {",
+ " if (typeof autoscrollEnabled !== 'undefined' && !autoscrollEnabled) return;",
+ " var log = document.querySelector('.timeline-events');",
+ " if (log) {",
+ " var isNearBottom = log.scrollHeight - log.scrollTop - log.clientHeight < 100;",
+ " if (isNearBottom) {",
+ " log.scrollTop = log.scrollHeight;",
+ " }",
" }",
" }",
+ " scrollToBottom();",
+ " document.body.addEventListener('htmx:afterSwap', function(e) {",
+ " if (e.target.closest('.timeline-events') || e.target.classList.contains('timeline-events')) {",
+ " scrollToBottom();",
+ " }",
+ " });",
"})();"
]
)