mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 06:57:09 +03:00
make skip notice countdown customisable
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as React from "react";
|
||||
import Config from "../config";
|
||||
|
||||
export interface NoticeProps {
|
||||
noticeTitle: string,
|
||||
@@ -42,7 +43,7 @@ class NoticeComponent extends React.Component<NoticeProps, NoticeState> {
|
||||
|
||||
const maxCountdownTime = () => {
|
||||
if (this.props.maxCountdownTime) return this.props.maxCountdownTime();
|
||||
else return 4;
|
||||
else return Config.config.skipNoticeDuration;
|
||||
};
|
||||
|
||||
//the id for the setInterval running the countdown
|
||||
|
||||
@@ -98,8 +98,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
messageOnClick: null,
|
||||
|
||||
//the countdown until this notice closes
|
||||
maxCountdownTime: () => 4,
|
||||
countdownTime: 4,
|
||||
maxCountdownTime: () => Config.config.skipNoticeDuration,
|
||||
countdownTime: Config.config.skipNoticeDuration,
|
||||
countdownText: null,
|
||||
|
||||
unskipText: chrome.i18n.getMessage("unskip"),
|
||||
@@ -418,7 +418,7 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
const sponsorTime = this.segments[index];
|
||||
const duration = Math.round((sponsorTime.segment[1] - this.contentContainer().v.currentTime) * (1 / this.contentContainer().v.playbackRate));
|
||||
|
||||
return Math.max(duration, 4);
|
||||
return Math.max(duration, Config.config.skipNoticeDuration);
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -437,8 +437,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
||||
unskipText: chrome.i18n.getMessage("unskip"),
|
||||
unskipCallback: this.unskip.bind(this),
|
||||
|
||||
maxCountdownTime: () => 4,
|
||||
countdownTime: 4
|
||||
maxCountdownTime: () => Config.config.skipNoticeDuration,
|
||||
countdownTime: Config.config.skipNoticeDuration
|
||||
};
|
||||
|
||||
// See if the title should be changed
|
||||
|
||||
Reference in New Issue
Block a user