Skip to content

Commit

Permalink
Fix control buttons loaded too soon
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Jan 20, 2024
1 parent 2f6902a commit 676bbf0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,7 @@ async function createButtons(): Promise<void> {
controls = await utils.wait(getControls).catch();

// Add button if does not already exist in html
await utils.wait(() => getControls().childElementCount > 4); // wait for controls buttons to be loaded
createButton("startSegment", "sponsorStart", () => startOrEndTimingNewSegment(), "PlayerStartIconSponsorBlocker.svg");
createButton("cancelSegment", "sponsorCancel", () => cancelCreatingSegment(), "PlayerCancelSegmentIconSponsorBlocker.svg");
createButton("delete", "clearTimes", () => clearSponsorTimes(), "PlayerDeleteIconSponsorBlocker.svg");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/pageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getControls(): HTMLElement {
}

export function isInPreviewPlayer(element: Element): boolean {
return !!element.closest("#inline-preview-player");
return !!element.closest(".v-recommend-inline-player");
}

export function isVisible(element: HTMLElement): boolean {
Expand Down

0 comments on commit 676bbf0

Please sign in to comment.