mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
@@ -385,6 +385,8 @@ function resetValues() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function videoIDChange(id): Promise<void> {
|
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 the id has not changed return unless the video element has changed
|
||||||
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
|
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
|
||||||
|
|
||||||
@@ -534,7 +536,7 @@ function durationChangeListener(): void {
|
|||||||
function videoOnReadyListener(): void {
|
function videoOnReadyListener(): void {
|
||||||
createPreviewBar();
|
createPreviewBar();
|
||||||
updatePreviewBar();
|
updatePreviewBar();
|
||||||
createButtons();
|
updateVisibilityOfPlayerControlsButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelSponsorSchedule(): void {
|
function cancelSponsorSchedule(): void {
|
||||||
@@ -1762,16 +1764,14 @@ function shouldSkip(segment: SponsorTime): boolean {
|
|||||||
|
|
||||||
/** Creates any missing buttons on the YouTube player if possible. */
|
/** Creates any missing buttons on the YouTube player if possible. */
|
||||||
async function createButtons(): Promise<void> {
|
async function createButtons(): Promise<void> {
|
||||||
if (onMobileYouTube) return;
|
|
||||||
|
|
||||||
controls = await utils.wait(getControls).catch();
|
controls = await utils.wait(getControls).catch();
|
||||||
|
|
||||||
// Add button if does not already exist in html
|
// Add button if does not already exist in html
|
||||||
createButton("startSegment", "sponsorStart", () => startOrEndTimingNewSegment(), "PlayerStartIconSponsorBlocker.svg");
|
createButton("startSegment", "sponsorStart", () => startOrEndTimingNewSegment(), "PlayerStartIconSponsorBlocker.svg");
|
||||||
createButton("cancelSegment", "sponsorCancel", () => cancelCreatingSegment(), "PlayerCancelSegmentIconSponsorBlocker.svg");
|
createButton("cancelSegment", "sponsorCancel", () => cancelCreatingSegment(), "PlayerCancelSegmentIconSponsorBlocker.svg");
|
||||||
createButton("delete", "clearTimes", () => clearSponsorTimes(), "PlayerDeleteIconSponsorBlocker.svg");
|
createButton("delete", "clearTimes", () => clearSponsorTimes(), "PlayerDeleteIconSponsorBlocker.svg");
|
||||||
createButton("submit", "SubmitTimes", submitSponsorTimes, "PlayerUploadIconSponsorBlocker.svg");
|
createButton("submit", "SubmitTimes", () => submitSponsorTimes(), "PlayerUploadIconSponsorBlocker.svg");
|
||||||
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker.svg");
|
createButton("info", "openPopup", () => openInfoMenu(), "PlayerInfoIconSponsorBlocker.svg");
|
||||||
|
|
||||||
const controlsContainer = getControls();
|
const controlsContainer = getControls();
|
||||||
if (Config.config.autoHideInfoButton && !onInvidious && controlsContainer
|
if (Config.config.autoHideInfoButton && !onInvidious && controlsContainer
|
||||||
@@ -2258,7 +2258,8 @@ function getSegmentsMessage(sponsorTimes: SponsorTime[]): string {
|
|||||||
function windowListenerHandler(event: MessageEvent): void {
|
function windowListenerHandler(event: MessageEvent): void {
|
||||||
const data = event.data;
|
const data = event.data;
|
||||||
const dataType = data.type;
|
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) {
|
if (dataType === "navigation" && data.videoID) {
|
||||||
pageType = data.pageType;
|
pageType = data.pageType;
|
||||||
|
|||||||
Reference in New Issue
Block a user