mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 06:27:14 +03:00
fix embeds not being detected correctly
- add awaiter for key element - refresh ID with segments if videoID is invalid
This commit is contained in:
@@ -100,7 +100,10 @@ const playerButtons: Record<string, {button: HTMLButtonElement, image: HTMLImage
|
|||||||
// Direct Links after the config is loaded
|
// Direct Links after the config is loaded
|
||||||
utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document)));
|
utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYouTubeVideoID(document)));
|
||||||
// wait for hover preview to appear, and refresh attachments if ever found
|
// 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();
|
addPageListeners();
|
||||||
addHotkeyListener();
|
addHotkeyListener();
|
||||||
|
|
||||||
@@ -206,6 +209,9 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
|
|||||||
submitSponsorTimes();
|
submitSponsorTimes();
|
||||||
break;
|
break;
|
||||||
case "refreshSegments":
|
case "refreshSegments":
|
||||||
|
// update video on refresh if videoID invalid
|
||||||
|
if (!sponsorVideoID) videoIDChange(getYouTubeVideoID(document));
|
||||||
|
// fetch segments
|
||||||
sponsorsLookup(false).then(() => sendResponse({
|
sponsorsLookup(false).then(() => sendResponse({
|
||||||
found: sponsorDataFound,
|
found: sponsorDataFound,
|
||||||
status: lastResponseStatus,
|
status: lastResponseStatus,
|
||||||
|
|||||||
Reference in New Issue
Block a user