From 19cc42926db2d6b03be722a2ae8e12d3f9165cb3 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Fri, 13 Jun 2025 07:51:31 +0100 Subject: [PATCH] Cleanup --- www/js/lib/uiUtil.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/www/js/lib/uiUtil.js b/www/js/lib/uiUtil.js index df45bcc0..31a9aace 100644 --- a/www/js/lib/uiUtil.js +++ b/www/js/lib/uiUtil.js @@ -1630,15 +1630,10 @@ function attachArticleListEventListeners (findDirEntryCallback, appstate) { } // Set a delay before expanding (e.g., 400ms) hoverTimeout = setTimeout(function () { - // Safety check: ensure the element still has the expected children - if (element.children.length < 2) return; - var header = element.children[0]; - var content = element.children[1]; - var isExpanded = header.getAttribute('aria-expanded') === 'true'; - // Only expand if not already expanded - if (!isExpanded) { - content.classList.remove('collapsed'); - header.setAttribute('aria-expanded', 'true'); + // Only toggle if the element is not expanded + if (element.children[1] && element.children[1].classList.contains('collapsed')) { + // Expand the snippet + toggleSnippet(element, null); } }, 400); });