mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 14:07:13 +03:00
@@ -16,8 +16,6 @@ export interface NoticeProps {
|
|||||||
timed?: boolean,
|
timed?: boolean,
|
||||||
idSuffix?: string,
|
idSuffix?: string,
|
||||||
|
|
||||||
videoSpeed?: () => number,
|
|
||||||
|
|
||||||
fadeIn?: boolean,
|
fadeIn?: boolean,
|
||||||
startFaded?: boolean,
|
startFaded?: boolean,
|
||||||
firstColumn?: React.ReactElement,
|
firstColumn?: React.ReactElement,
|
||||||
@@ -51,7 +49,6 @@ export interface NoticeState {
|
|||||||
|
|
||||||
class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
||||||
countdownInterval: NodeJS.Timeout;
|
countdownInterval: NodeJS.Timeout;
|
||||||
intervalVideoSpeed: number;
|
|
||||||
|
|
||||||
idSuffix: string;
|
idSuffix: string;
|
||||||
|
|
||||||
@@ -259,10 +256,6 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
|||||||
|
|
||||||
const countdownTime = Math.min(this.state.countdownTime - 1, this.state.maxCountdownTime());
|
const countdownTime = Math.min(this.state.countdownTime - 1, this.state.maxCountdownTime());
|
||||||
|
|
||||||
if (this.props.videoSpeed && this.intervalVideoSpeed != this.props.videoSpeed()) {
|
|
||||||
this.setupInterval();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (countdownTime <= 0) {
|
if (countdownTime <= 0) {
|
||||||
//remove this from setInterval
|
//remove this from setInterval
|
||||||
clearInterval(this.countdownInterval);
|
clearInterval(this.countdownInterval);
|
||||||
@@ -325,10 +318,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
|||||||
setupInterval(): void {
|
setupInterval(): void {
|
||||||
if (this.countdownInterval) clearInterval(this.countdownInterval);
|
if (this.countdownInterval) clearInterval(this.countdownInterval);
|
||||||
|
|
||||||
const intervalDuration = this.props.videoSpeed ? 1000 / this.props.videoSpeed() : 1000;
|
this.countdownInterval = setInterval(this.countdown.bind(this), 1000);
|
||||||
this.countdownInterval = setInterval(this.countdown.bind(this), intervalDuration);
|
|
||||||
|
|
||||||
if (this.props.videoSpeed) this.intervalVideoSpeed = this.props.videoSpeed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetCountdown(): void {
|
resetCountdown(): void {
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
|| (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAutoSkip && this.autoSkip)}
|
|| (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAutoSkip && this.autoSkip)}
|
||||||
timed={true}
|
timed={true}
|
||||||
maxCountdownTime={this.state.maxCountdownTime}
|
maxCountdownTime={this.state.maxCountdownTime}
|
||||||
videoSpeed={() => this.contentContainer().v?.playbackRate}
|
|
||||||
style={noticeStyle}
|
style={noticeStyle}
|
||||||
biggerCloseButton={this.contentContainer().onMobileYouTube}
|
biggerCloseButton={this.contentContainer().onMobileYouTube}
|
||||||
ref={this.noticeRef}
|
ref={this.noticeRef}
|
||||||
|
|||||||
Reference in New Issue
Block a user