mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 04:57:09 +03:00
make skip notice countdown customisable
This commit is contained in:
@@ -390,6 +390,12 @@
|
||||
"minDurationDescription": {
|
||||
"message": "Segments shorter than the set value will not be skipped or show in the player."
|
||||
},
|
||||
"skipNoticeDuration": {
|
||||
"message": "Skip notice duration (seconds):"
|
||||
},
|
||||
"skipNoticeDurationDescription": {
|
||||
"message": "The skip notice will stay on screen for at least this long. For manual skipping, it may be visible for longer."
|
||||
},
|
||||
"shortCheck": {
|
||||
"message": "The following submission is shorter than your minimum duration option. This could mean that this is already submitted, and just being ignored due to this option. Are you sure you would like to submit?"
|
||||
},
|
||||
|
||||
@@ -155,6 +155,20 @@
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div option-type="number-change" sync-option="skipNoticeDuration">
|
||||
<label class="number-container">
|
||||
<input type="number" step="0.1" min="1">
|
||||
</label>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div class="small-description">__MSG_skipNoticeDurationDescription__</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div option-type="number-change" sync-option="minDuration">
|
||||
<label class="number-container">
|
||||
<input type="number" step="0.1" min="0">
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user