From cda57e2d2b72c6ffbc13b0fd7a48142f2cb1767a Mon Sep 17 00:00:00 2001 From: Ajay Date: Mon, 25 Jul 2022 16:03:08 -0400 Subject: [PATCH] Make title link selector more specific Co-authored-by: Michael C --- src/content.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content.ts b/src/content.ts index 86f51a50..6f104f52 100644 --- a/src/content.ts +++ b/src/content.ts @@ -99,7 +99,7 @@ const playerButtons: Record Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document))); // wait for hover preview to appear, and refresh attachments if ever found utils.waitForElement(".ytp-inline-preview-ui").then(() => refreshVideoAttachments()) -utils.waitForElement("[data-sessionlink='feature=player-title']").then(() => videoIDChange(getYouTubeVideoID(document))) +utils.waitForElement("a.ytp-title-link[data-sessionlink='feature=player-title']").then(() => videoIDChange(getYouTubeVideoID(document)).then()) addPageListeners(); addHotkeyListener(); @@ -1077,7 +1077,7 @@ function getYouTubeVideoID(document: Document, url?: string): string | boolean { function getYouTubeVideoIDFromDocument(hideIcon = true): string | boolean { // get ID from document (channel trailer / embedded playlist) - const element = video?.parentElement?.parentElement?.querySelector("[data-sessionlink='feature=player-title']"); + const element = video?.parentElement?.parentElement?.querySelector("a.ytp-title-link[data-sessionlink='feature=player-title']"); const videoURL = element?.getAttribute("href"); if (videoURL) { onInvidious = hideIcon;