From dfd82901f2bc80494c984480ff875200230c0d55 Mon Sep 17 00:00:00 2001
From: "(quasar) nebula" <towerofnix@gmail.com>
Date: Tue, 6 Apr 2021 14:33:57 -0300
Subject: only animate info card hiding if it's shown

This fixes a glitch where it'd trigger the hide animation just by
passing the cursor over the link for even an instant. Not good!
---
 static/client.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/static/client.js b/static/client.js
index fe4f5c45..d2ca95cc 100644
--- a/static/client.js
+++ b/static/client.js
@@ -239,6 +239,7 @@ const infoCard = (() => {
 
     let cancelShow = false;
     let hideTimeout = null;
+    let showing = false;
 
     container.addEventListener('mouseenter', cancelHide);
     container.addEventListener('mouseleave', readyHide);
@@ -253,6 +254,8 @@ const infoCard = (() => {
                 return;
             }
 
+            showing = true;
+
             const rect = target.getBoundingClientRect();
 
             container.style.setProperty('--primary-color', data.color);
@@ -333,10 +336,11 @@ const infoCard = (() => {
         container.classList.remove('show');
         container.classList.add('hide');
         cancelShow = true;
+        showing = false;
     }
 
     function readyHide() {
-        if (!hideTimeout) {
+        if (!hideTimeout && showing) {
             hideTimeout = setTimeout(hide, HIDE_HOVER_DELAY);
         }
     }
-- 
cgit 1.3.0-6-gf8a5