diff --git a/src/zotero_kb/templates/index.html b/src/zotero_kb/templates/index.html index 863f321..6b0ede0 100644 --- a/src/zotero_kb/templates/index.html +++ b/src/zotero_kb/templates/index.html @@ -492,6 +492,9 @@ loadingCollectionKey: null, nextCollectionItemsRequestToken: 0, activeCollectionItemsRequestToken: 0, + hoveredItemKey: null, + hoverTimerId: null, + previewItemKey: null, }; const elements = { @@ -514,6 +517,7 @@ windowCollectionStatus: document.getElementById("window-collection-status"), windowCollectionTree: document.getElementById("window-collection-tree"), windowCollectionItems: document.getElementById("window-collection-items"), + previewPopover: document.getElementById("item-preview-popover"), currentProjectLabel: document.getElementById("current-project-label"), cardList: document.getElementById("card-list"), cardDetail: document.getElementById("card-detail"), @@ -667,6 +671,20 @@ persistWindowSessionState(); } + function cancelAbstractPreview() { + if (state.hoverTimerId !== null) { + window.clearTimeout(state.hoverTimerId); + state.hoverTimerId = null; + } + state.hoveredItemKey = null; + state.previewItemKey = null; + elements.previewPopover.hidden = true; + elements.previewPopover.setAttribute("aria-hidden", "true"); + elements.previewPopover.textContent = ""; + elements.previewPopover.style.top = ""; + elements.previewPopover.style.left = ""; + } + function setStatus(target, message, isError = false) { target.textContent = message || ""; target.classList.toggle("error", Boolean(isError));