diff options
author | Ajay <[email protected]> | 2023-03-17 22:57:44 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2023-03-17 22:57:44 -0400 |
commit | 52f58b8ea481af92360c7fb783b7f44023600fdc (patch) | |
tree | df6a68b936142738866edfdf2bc32d0c9a37f354 | |
parent | 18f860c6a263161817665c315c5a047798b78c10 (diff) | |
download | SponsorBlock-52f58b8ea481af92360c7fb783b7f44023600fdc.tar.gz SponsorBlock-52f58b8ea481af92360c7fb783b7f44023600fdc.zip |
Don't trigger hover autoplay from hovering over thumbnail label
-rw-r--r-- | src/utils/thumbnails.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/utils/thumbnails.ts b/src/utils/thumbnails.ts index a0009e7c..4aec8d39 100644 --- a/src/utils/thumbnails.ts +++ b/src/utils/thumbnails.ts @@ -60,6 +60,15 @@ function createOrGetThumbnail(thumbnail: HTMLImageElement): { overlay: HTMLEleme const overlay = document.createElement("div") as HTMLElement; overlay.classList.add("sponsorThumbnailLabel"); + // Disable hover autoplay + overlay.addEventListener("pointerenter", (e) => { + e.stopPropagation(); + thumbnail.dispatchEvent(new PointerEvent("pointerleave", { bubbles: true })); + }); + overlay.addEventListener("pointerleave", (e) => { + e.stopPropagation(); + thumbnail.dispatchEvent(new PointerEvent("pointerenter", { bubbles: true })); + }); const icon = createSBIconElement(); const text = document.createElement("span"); |