From 130a21409cf96708e3d012033c2bcdc60e95c2b4 Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Sun, 23 Feb 2025 20:53:41 -0500 Subject: [PATCH] Fix animated player duplicates --- src/index.js | 1 - src/utils.js | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index d882452..ba2c1e0 100644 --- a/src/index.js +++ b/src/index.js @@ -4,7 +4,6 @@ export async function initialize() { /* Listen for messages from the background script */ chrome.runtime.onMessage.addListener((message, sendResponse) => { if (message.type === "navigation") { - sendResponse({ status: "ok" }); appendAccessibilityInfo(); } }); diff --git a/src/utils.js b/src/utils.js index 627050e..6619042 100644 --- a/src/utils.js +++ b/src/utils.js @@ -28,7 +28,9 @@ export function appendAccessibilityInfo() { ".github-a11y-heading-prefix, .github-a11y-img-caption" ).length > 0) return - commentBody.querySelectorAll("img").forEach(function (image) { + [...commentBody.querySelectorAll("img")] + .filter(el => !el.closest('animated-image')) + .forEach(function (image) { const parentNodeName = image.parentElement.nodeName; if (parentNodeName === "A" || parentNodeName === "P") { const parent = image.closest("a") || image.closest("p");