aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
m---------maze-utils0
-rw-r--r--src/components/SkipNoticeComponent.tsx3
-rw-r--r--src/components/SponsorTimeEditComponent.tsx9
-rw-r--r--src/components/SubmissionNoticeComponent.tsx7
-rw-r--r--src/content.ts1
-rw-r--r--src/render/GenericNotice.tsx3
-rw-r--r--src/types.ts1
7 files changed, 13 insertions, 11 deletions
diff --git a/maze-utils b/maze-utils
-Subproject 42888f800e38213f5e5d79dda953e790ada502e
+Subproject 4983281b05635362f587e030ae81ef4b60fe9de
diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx
index 0a351c6c..2a1292a3 100644
--- a/src/components/SkipNoticeComponent.tsx
+++ b/src/components/SkipNoticeComponent.tsx
@@ -15,6 +15,7 @@ import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
import { generateUserID } from "../../maze-utils/src/setup";
import { keybindToString } from "../../maze-utils/src/config";
import { getFormattedTime } from "../../maze-utils/src/formating";
+import { getVideo } from "../../maze-utils/src/video";
enum SkipButtonState {
Undo, // Unskip
@@ -685,7 +686,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
getFullDurationCountdown(index: number): () => number {
return () => {
const sponsorTime = this.segments[index];
- const duration = Math.round((sponsorTime.segment[1] - this.contentContainer().v.currentTime) * (1 / this.contentContainer().v.playbackRate));
+ const duration = Math.round((sponsorTime.segment[1] - getVideo().currentTime) * (1 / getVideo().playbackRate));
return Math.max(duration, Config.config.skipNoticeDuration);
};
diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx
index 527dbbe2..f5ff47e7 100644
--- a/src/components/SponsorTimeEditComponent.tsx
+++ b/src/components/SponsorTimeEditComponent.tsx
@@ -9,6 +9,7 @@ import { DEFAULT_CATEGORY } from "../utils/categoryUtils";
import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
import { asyncRequestToServer } from "../utils/requests";
import { defaultPreviewTime } from "../utils/constants";
+import { getVideo } from "../../maze-utils/src/video";
export interface SponsorTimeEditProps {
index: number;
@@ -401,7 +402,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
checkToShowFullVideoWarning(): void {
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
const segmentDuration = sponsorTime.segment[1] - sponsorTime.segment[0];
- const videoPercentage = segmentDuration / this.props.contentContainer().v.duration;
+ const videoPercentage = segmentDuration / getVideo().duration;
if (videoPercentage > 0.6 && !this.fullVideoWarningShown
&& (sponsorTime.category === "sponsor" || sponsorTime.category === "selfpromo" || sponsorTime.category === "chooseACategory")) {
@@ -553,7 +554,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
}
setTimeToEnd(): void {
- this.setTimeTo(1, this.props.contentContainer().v.duration);
+ this.setTimeTo(1, getVideo().duration);
}
/**
@@ -640,7 +641,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
sponsorTimesSubmitting[this.props.index].segment[0] = startTime;
}
} else if (this.state.sponsorTimeEdits[1] === null && category === "outro" && !sponsorTimesSubmitting[this.props.index].segment[1]) {
- sponsorTimesSubmitting[this.props.index].segment[1] = this.props.contentContainer().v.duration;
+ sponsorTimesSubmitting[this.props.index].segment[1] = getVideo().duration;
this.props.contentContainer().updateEditButtonsOnPlayer();
}
@@ -683,7 +684,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
const endTime = sponsorTimes[index].segment[1];
// If segment starts at 0:00, start playback at the end of the segment
- const skipTime = (startTime === 0 || skipToEndTime) ? endTime : (startTime - (seekTime * this.props.contentContainer().v.playbackRate));
+ const skipTime = (startTime === 0 || skipToEndTime) ? endTime : (startTime - (seekTime * getVideo().playbackRate));
this.props.contentContainer().previewTime(skipTime, !skipToEndTime);
}
diff --git a/src/components/SubmissionNoticeComponent.tsx b/src/components/SubmissionNoticeComponent.tsx
index 63bac370..6ecd0e84 100644
--- a/src/components/SubmissionNoticeComponent.tsx
+++ b/src/components/SubmissionNoticeComponent.tsx
@@ -9,6 +9,7 @@ import NoticeTextSelectionComponent from "./NoticeTextSectionComponent";
import SponsorTimeEditComponent from "./SponsorTimeEditComponent";
import { getGuidelineInfo } from "../utils/constants";
import { exportTimes } from "../utils/exporter";
+import { getVideo } from "../../maze-utils/src/video";
export interface SubmissionNoticeProps {
// Contains functions and variables from the content script needed by the skip notice
@@ -66,7 +67,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
this.forceUpdate();
});
- this.videoObserver.observe(this.contentContainer().v, {
+ this.videoObserver.observe(getVideo(), {
attributes: true
});
@@ -131,7 +132,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
{/* Sponsor Time List */}
<tr id={"sponsorSkipNoticeMiddleRow" + this.state.idSuffix}
className="sponsorTimeMessagesRow"
- style={{maxHeight: (this.contentContainer().v?.offsetHeight - 200) + "px"}}
+ style={{maxHeight: (getVideo()?.offsetHeight - 200) + "px"}}
onMouseDown={(e) => e.stopPropagation()}>
<td style={{width: "100%"}}>
{this.getSponsorTimeMessages()}
@@ -283,7 +284,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
categoryChangeListener(index: number, category: Category): void {
const dialogWidth = this.noticeRef?.current?.getElement()?.current?.offsetWidth;
if (category !== "chooseACategory" && Config.config.showCategoryGuidelines
- && this.contentContainer().v.offsetWidth > dialogWidth * 2) {
+ && getVideo().offsetWidth > dialogWidth * 2) {
const options = {
title: chrome.i18n.getMessage(`category_${category}`),
textBoxes: getGuidelineInfo(category),
diff --git a/src/content.ts b/src/content.ts
index fa06b25f..7519d7d3 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -177,7 +177,6 @@ const skipNoticeContentContainer: ContentContainer = () => ({
sponsorTimes,
sponsorTimesSubmitting,
skipNotices,
- v: getVideo(),
sponsorVideoID: getVideoID(),
reskipSponsorTime,
updatePreviewBar,
diff --git a/src/render/GenericNotice.tsx b/src/render/GenericNotice.tsx
index d1a4443c..bbac6c94 100644
--- a/src/render/GenericNotice.tsx
+++ b/src/render/GenericNotice.tsx
@@ -8,6 +8,7 @@ const utils = new Utils();
import { ContentContainer } from "../types";
import NoticeTextSelectionComponent from "../components/NoticeTextSectionComponent";
import { ButtonListener } from "../../maze-utils/src/components/component-types";
+import { getVideo } from "../../maze-utils/src/video";
export interface TextBox {
icon: string;
@@ -75,7 +76,7 @@ export default class GenericNotice {
{options.textBoxes?.length > 0 ?
<tr id={"sponsorSkipNoticeMiddleRow" + this.idSuffix}
className="sponsorTimeMessagesRow"
- style={{maxHeight: this.contentContainer ? (this.contentContainer().v.offsetHeight - 200) + "px" : null}}>
+ style={{maxHeight: getVideo() ? (getVideo().offsetHeight - 200) + "px" : null}}>
<td style={{width: "100%"}}>
{this.getMessageBoxes(this.idSuffix, options.textBoxes)}
</td>
diff --git a/src/types.ts b/src/types.ts
index 460a308d..fdaee7b8 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -10,7 +10,6 @@ export interface ContentContainer {
sponsorTimes: SponsorTime[];
sponsorTimesSubmitting: SponsorTime[];
skipNotices: SkipNotice[];
- v: HTMLVideoElement;
sponsorVideoID;
reskipSponsorTime: (segment: SponsorTime, forceSeek?: boolean) => void;
updatePreviewBar: () => void;