aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2022-10-05 01:02:37 -0400
committerGitHub <[email protected]>2022-10-05 01:02:37 -0400
commiteb8a0ae3074baa4072b28f271c204f58e1ea2b20 (patch)
tree9148b7838cb55d98f4e61023de44fed621b3bf5b /src
parent36efe139ba2f689d3af0210cd3e1497bfb606e57 (diff)
parent5296c437cc6457150edee445f078748062035326 (diff)
downloadSponsorBlock-eb8a0ae3074baa4072b28f271c204f58e1ea2b20.tar.gz
SponsorBlock-eb8a0ae3074baa4072b28f271c204f58e1ea2b20.zip
Merge pull request #1498 from mchangrh/1496-fix
fix #1496
Diffstat (limited to 'src')
-rw-r--r--src/content.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/content.ts b/src/content.ts
index e2faa8dd..a54256ae 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -385,6 +385,8 @@ function resetValues() {
}
async function videoIDChange(id): Promise<void> {
+ // don't switch to invalid value
+ if (!id && sponsorVideoID && !document?.URL?.includes("youtube.com/clip/")) return;
//if the id has not changed return unless the video element has changed
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
@@ -534,7 +536,7 @@ function durationChangeListener(): void {
function videoOnReadyListener(): void {
createPreviewBar();
updatePreviewBar();
- createButtons();
+ updateVisibilityOfPlayerControlsButton()
}
function cancelSponsorSchedule(): void {
@@ -1762,16 +1764,14 @@ function shouldSkip(segment: SponsorTime): boolean {
/** Creates any missing buttons on the YouTube player if possible. */
async function createButtons(): Promise<void> {
- if (onMobileYouTube) return;
-
controls = await utils.wait(getControls).catch();
// Add button if does not already exist in html
createButton("startSegment", "sponsorStart", () => startOrEndTimingNewSegment(), "PlayerStartIconSponsorBlocker.svg");
createButton("cancelSegment", "sponsorCancel", () => cancelCreatingSegment(), "PlayerCancelSegmentIconSponsorBlocker.svg");
createButton("delete", "clearTimes", () => clearSponsorTimes(), "PlayerDeleteIconSponsorBlocker.svg");
- createButton("submit", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker.svg");
- createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker.svg");
+ createButton("submit", "SubmitTimes", () => submitSponsorTimes(), "PlayerUploadIconSponsorBlocker.svg");
+ createButton("info", "openPopup", () => openInfoMenu(), "PlayerInfoIconSponsorBlocker.svg");
const controlsContainer = getControls();
if (Config.config.autoHideInfoButton && !onInvidious && controlsContainer
@@ -2258,7 +2258,8 @@ function getSegmentsMessage(sponsorTimes: SponsorTime[]): string {
function windowListenerHandler(event: MessageEvent): void {
const data = event.data;
const dataType = data.type;
- if (data.source !== "sponsorblock") return;
+
+ if (data.source !== "sponsorblock" || document?.URL?.includes("youtube.com/clip/")) return;
if (dataType === "navigation" && data.videoID) {
pageType = data.pageType;