aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
m---------maze-utils0
-rw-r--r--src/content.ts8
-rw-r--r--src/render/CategoryPill.tsx4
3 files changed, 8 insertions, 4 deletions
diff --git a/maze-utils b/maze-utils
-Subproject 6770087140715ab4f7d298add61770da63157b7
+Subproject 7a49dc6d5e77e53c6f4c57299012134bd0d7f50
diff --git a/src/content.ts b/src/content.ts
index 222f9514..2cb5f6a2 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -35,7 +35,7 @@ import { ChapterVote } from "./render/ChapterVote";
import { openWarningDialog } from "./utils/warnings";
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
-import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube, getLastNonInlineVideoID, triggerVideoIDChange, triggerVideoElementChange, getIsInline, getCurrentTime, setCurrentTime, getVideoDuration, verifyCurrentTime } from "../maze-utils/src/video";
+import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube, getLastNonInlineVideoID, triggerVideoIDChange, triggerVideoElementChange, getIsInline, getCurrentTime, setCurrentTime, getVideoDuration, verifyCurrentTime, waitForVideo } from "../maze-utils/src/video";
import { Keybind, StorageChangesObject, isSafari, keybindEquals, keybindToString } from "../maze-utils/src/config";
import { findValidElement } from "../maze-utils/src/dom"
import { getHash, HashedValue } from "../maze-utils/src/hash";
@@ -1230,7 +1230,7 @@ async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
if (!getVideo()) {
//there is still no video here
- await waitFor(() => getVideo(), 5000, 10);
+ await waitForVideo();
}
startSkipScheduleCheckingForStartSponsors();
@@ -1375,7 +1375,9 @@ function startSkipScheduleCheckingForStartSponsors() {
const fullVideoSegment = sponsorTimes.filter((time) => time.actionType === ActionType.Full)[0];
if (fullVideoSegment) {
- categoryPill?.setSegment(fullVideoSegment);
+ waitFor(() => categoryPill).then(() => {
+ categoryPill?.setSegment(fullVideoSegment);
+ });
}
if (startingSegmentTime !== -1) {
diff --git a/src/render/CategoryPill.tsx b/src/render/CategoryPill.tsx
index 20923fba..3a11e09c 100644
--- a/src/render/CategoryPill.tsx
+++ b/src/render/CategoryPill.tsx
@@ -43,7 +43,7 @@ export class CategoryPill {
}
private async attachToPageInternal(): Promise<void> {
- let referenceNode =
+ let referenceNode =
await waitFor(() => getYouTubeTitleNode());
// Experimental YouTube layout with description on right
@@ -119,6 +119,8 @@ export class CategoryPill {
}
async setSegment(segment: SponsorTime): Promise<void> {
+ await waitFor(() => this.ref.current);
+
if (this.ref.current?.state?.segment !== segment) {
const newState = {
segment,