From 0b0234dc9916492bbc50f6a1e48b4e8bf1d6d6d7 Mon Sep 17 00:00:00 2001 From: sn0w <105451515+sn0w12@users.noreply.github.com> Date: Sat, 10 Jan 2026 00:16:09 +0100 Subject: [PATCH] Add loading state to tooltips --- web/js/textHighlight.js | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/web/js/textHighlight.js b/web/js/textHighlight.js index 61a310e..12b1cd2 100644 --- a/web/js/textHighlight.js +++ b/web/js/textHighlight.js @@ -281,17 +281,9 @@ let currentTooltipRequest = null; async function showTagTooltip(element, tag) { // Create a cancellation token for this request - const requestId = Symbol('tooltip-request'); + const requestId = Symbol("tooltip-request"); currentTooltipRequest = requestId; - const description = - (await booruApi.getTagDescription(tag)) ?? "No description available."; - - // Check if this request was cancelled while we were fetching - if (currentTooltipRequest !== requestId) { - return; - } - let tooltip = document.getElementById("tag-tooltip"); if (!tooltip) { tooltip = document.createElement("div"); @@ -316,6 +308,30 @@ async function showTagTooltip(element, tag) { tooltip.style.left = `${rect.left}px`; tooltip.style.top = `${rect.bottom + 5}px`; + // Initially set content to loading + tooltip.innerHTML = "