Skip to content

Commit

Permalink
Fix: loadFullSizeImageImageTimeout not clearing when mouse leaves ima…
Browse files Browse the repository at this point in the history
…ge (#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 <[email protected]>
  • Loading branch information
LiliaDoe and extesy authored Dec 31, 2024
1 parent 4cb6b61 commit 5671342
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/hoverzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -1083,7 +1085,7 @@ var hoverZoom = {
loadFullSizeImageTimeout = setTimeout(loadFullSizeImage, delay);
}
});
}
}*/

loading = true;
}
Expand Down

0 comments on commit 5671342

Please sign in to comment.