diff options
author | Ajay Ramachandran <[email protected]> | 2021-06-25 12:32:27 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2021-06-25 12:32:27 -0400 |
commit | 38bc6e2b1c0ac54de10f0f947fc3c9d10847ca4b (patch) | |
tree | 98db7577de827a730ead7177478666a5f9b132f4 /src | |
parent | 31855f75018b4f7246442b27baf48b3c1c8b68f2 (diff) | |
download | SponsorBlock-38bc6e2b1c0ac54de10f0f947fc3c9d10847ca4b.tar.gz SponsorBlock-38bc6e2b1c0ac54de10f0f947fc3c9d10847ca4b.zip |
make skip notice countdown customisable
Diffstat (limited to 'src')
-rw-r--r-- | src/components/NoticeComponent.tsx | 3 | ||||
-rw-r--r-- | src/components/SkipNoticeComponent.tsx | 10 | ||||
-rw-r--r-- | src/config.ts | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/components/NoticeComponent.tsx b/src/components/NoticeComponent.tsx index ee9f5e58..38638de2 100644 --- a/src/components/NoticeComponent.tsx +++ b/src/components/NoticeComponent.tsx @@ -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 diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx index 74a26872..1582c2c9 100644 --- a/src/components/SkipNoticeComponent.tsx +++ b/src/components/SkipNoticeComponent.tsx @@ -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 diff --git a/src/config.ts b/src/config.ts index 75392f98..5f8a66f8 100644 --- a/src/config.ts +++ b/src/config.ts @@ -33,6 +33,7 @@ interface SBConfig { supportInvidious: boolean, serverAddress: string, minDuration: number, + skipNoticeDuration: number, audioNotificationOnSkip, checkForUnlistedVideos: boolean, testingServer: boolean, @@ -171,6 +172,7 @@ const Config: SBObject = { supportInvidious: false, serverAddress: CompileConfig.serverAddress, minDuration: 0, + skipNoticeDuration: 4, audioNotificationOnSkip: false, checkForUnlistedVideos: false, testingServer: false, |