aboutsummaryrefslogtreecommitdiffstats
path: root/view
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2025-05-15 07:41:22 +0000
committerMario <mario@mariovavti.com>2025-05-15 07:41:22 +0000
commitdceaee691f036128f8f4c28287a3c725599f1d69 (patch)
treee78310d43aa66e8e308c91ea4a028fc8d413b042 /view
parent7cf380e39084cdc8e850fd23ef2996962717b616 (diff)
downloadvolse-hubzilla-dceaee691f036128f8f4c28287a3c725599f1d69.tar.gz
volse-hubzilla-dceaee691f036128f8f4c28287a3c725599f1d69.tar.bz2
volse-hubzilla-dceaee691f036128f8f4c28287a3c725599f1d69.zip
no need to scroll to toplevels
Diffstat (limited to 'view')
-rw-r--r--view/js/main.js50
1 files changed, 26 insertions, 24 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 761a6b504..7043c8577 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -956,41 +956,43 @@ function updateRelativeTime(selector) {
}
function scrollToItem() {
- // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode
+ // auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode
- if (justifiedGalleryActive) return;
+ if (justifiedGalleryActive) return;
- let submid = ((bParam_mid.length) ? bParam_mid : 'abcdefg');
+ let submid = ((bParam_mid.length) ? bParam_mid : 'abcdefg');
- // Select all thread wrappers
- let threadWrappers = document.querySelectorAll('.thread-wrapper');
+ // Select all thread wrappers
+ let threadWrappers = document.querySelectorAll('.thread-wrapper');
- threadWrappers.forEach(thread => {
- // Get the 'data-b64mids' attribute and check if it contains submid
- let b64mids = thread.dataset.b64mids;
+ threadWrappers.forEach(thread => {
+ // Get the 'data-b64mids' attribute and check if it contains submid
+ let b64mids = thread.dataset.b64mids;
- if (b64mids && b64mids.includes(submid)) {
- // Handle collapsed comments if any
- let collapsedComments = document.querySelectorAll('.collapsed-comments');
- if (collapsedComments.length) {
- let scrollToId = collapsedComments[0].id.substring(19);
- showHideComments(scrollToId);
- }
+ if (b64mids && b64mids.includes(submid)) {
+ // Handle collapsed comments if any
+ let collapsedComments = document.querySelectorAll('.collapsed-comments');
+ if (collapsedComments.length) {
+ let scrollToId = collapsedComments[0].id.substring(19);
+ showHideComments(scrollToId);
+ }
- collapseHeight();
+ collapseHeight();
- // Scroll to the target element
- let navHeight = document.querySelector('nav') ? document.querySelector('nav').offsetHeight : 0;
- window.scrollTo({
- top: getOffsetTopRelativeToBody(thread) - navHeight,
- behavior: 'smooth'
- });
+ if (!thread.classList.contains('toplevel_item')) {
+ // Scroll to the target element
+ let navHeight = document.getElementById('navbar-top') ? document.getElementById('navbar-top').offsetHeight : 0;
+ window.scrollTo({
+ top: getOffsetTopRelativeToBody(thread) - navHeight,
+ behavior: 'smooth'
+ });
+ }
let id = thread.id.replace('thread-wrapper-', '');
let content = document.getElementById('wall-item-content-wrapper-' + id);
content.classList.add('item-highlight-fade');
- }
- });
+ }
+ });
}
function getOffsetTopRelativeToBody(element) {