aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2022-06-30 17:39:34 -0400
committerGitHub <[email protected]>2022-06-30 17:39:34 -0400
commit98f776fa3a0280098812e0cdc911e10eb395b065 (patch)
tree07d32f843e34a4c20825c7478dfd46ca2f534286
parent67b510e628382d619d7b509ab42d1458ce269f99 (diff)
parent75f426f45687b560dec843956ef89b583484fb05 (diff)
downloadSponsorBlock-98f776fa3a0280098812e0cdc911e10eb395b065.tar.gz
SponsorBlock-98f776fa3a0280098812e0cdc911e10eb395b065.zip
Merge pull request #1387 from mchangrh/await-embed
fix embeds not being detected correctly
-rw-r--r--src/content.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/content.ts b/src/content.ts
index e97d5309..2ed30119 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -100,7 +100,10 @@ const playerButtons: Record<string, {button: HTMLButtonElement, image: HTMLImage
// Direct Links after the config is loaded
utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document)));
// wait for hover preview to appear, and refresh attachments if ever found
-window.addEventListener("DOMContentLoaded", () => utils.waitForElement(".ytp-inline-preview-ui").then(() => refreshVideoAttachments()));
+window.addEventListener("DOMContentLoaded", () => {
+ utils.waitForElement(".ytp-inline-preview-ui").then(() => refreshVideoAttachments())
+ utils.waitForElement("[data-sessionlink='feature=player-title']").then(() => videoIDChange(getYouTubeVideoID(document)))
+});
addPageListeners();
addHotkeyListener();
@@ -206,6 +209,9 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
submitSponsorTimes();
break;
case "refreshSegments":
+ // update video on refresh if videoID invalid
+ if (!sponsorVideoID) videoIDChange(getYouTubeVideoID(document));
+ // fetch segments
sponsorsLookup(false).then(() => sendResponse({
found: sponsorDataFound,
status: lastResponseStatus,