From 56713421f1a1d0f312ae8df1ac042d916a7ea210 Mon Sep 17 00:00:00 2001 From: Lilia <30478020+LiliaDoe@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:09:05 -0600 Subject: [PATCH] Fix: loadFullSizeImageImageTimeout not clearing when mouse leaves image (#1516) - This fixes what #1515 was trying to fix - setLoadImage used to set loadHoveredImage within callback so timeout can be set outside of callback. This makes clearTimeout use the correct timeout ID - There is probably a smarter way of fixing this, but this works --------- Co-authored-by: Oleg Anashkin --- js/hoverzoom.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/hoverzoom.js b/js/hoverzoom.js index 6067eb30..b20fd2df 100644 --- a/js/hoverzoom.js +++ b/js/hoverzoom.js @@ -1070,8 +1070,10 @@ var hoverZoom = { // if the action key has been pressed over an image, no delay is applied const delay = actionKeyDown || explicitCall ? 0 : (isVideoLink(srcDetails.url) ? options.displayDelayVideo : options.displayDelay); + loadFullSizeImageTimeout = setTimeout(loadFullSizeImage, delay); - if (audioSrc) { + // Temporarily removing until a better fix is found: sendMessage is async so it can't be used to set local variables + /*if (audioSrc) { chrome.runtime.sendMessage({action:'isImageBanned', url:audioSrc}, function (result) { if (!result) { loadFullSizeImageTimeout = setTimeout(loadFullSizeImage, delay); @@ -1083,7 +1085,7 @@ var hoverZoom = { loadFullSizeImageTimeout = setTimeout(loadFullSizeImage, delay); } }); - } + }*/ loading = true; }