aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-04-22 02:41:27 -0400
committerAjay <[email protected]>2022-04-22 02:41:27 -0400
commit9e02e35c4d2cddc47f21091de071579dfa0e9410 (patch)
tree936016a7bc323c7c0915bb24cb42d4783466cea1
parentd7e67fb3976238912d5492e882a9f97e695de8b5 (diff)
downloadSponsorBlock-9e02e35c4d2cddc47f21091de071579dfa0e9410.tar.gz
SponsorBlock-9e02e35c4d2cddc47f21091de071579dfa0e9410.zip
Keep skip notice open for full duration of mute segments
-rw-r--r--src/components/SkipNoticeComponent.tsx24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/components/SkipNoticeComponent.tsx b/src/components/SkipNoticeComponent.tsx
index 8a96bede..f3627f06 100644
--- a/src/components/SkipNoticeComponent.tsx
+++ b/src/components/SkipNoticeComponent.tsx
@@ -116,6 +116,9 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
this.unselectedColor = Config.config.colorPalette.white;
this.lockedColor = Config.config.colorPalette.locked;
+ const isMuteSegment = this.segments[0].actionType === ActionType.Mute;
+ const maxCountdownTime = isMuteSegment ? this.getFullDurationCountdown(0) : () => Config.config.skipNoticeDuration;
+
// Setup state
this.state = {
noticeTitle,
@@ -123,8 +126,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
messageOnClick: null,
//the countdown until this notice closes
- maxCountdownTime: () => Config.config.skipNoticeDuration,
- countdownTime: Config.config.skipNoticeDuration,
+ maxCountdownTime,
+ countdownTime: maxCountdownTime(),
countdownText: null,
skipButtonState: this.props.startReskip
@@ -621,12 +624,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
getUnskippedModeInfo(index: number, skipButtonState: SkipButtonState): SkipNoticeState {
const changeCountdown = this.segments[index].actionType !== ActionType.Poi;
- const maxCountdownTime = changeCountdown ? () => {
- 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, Config.config.skipNoticeDuration);
- } : this.state.maxCountdownTime;
+ const maxCountdownTime = changeCountdown ?
+ this.getFullDurationCountdown(index) : this.state.maxCountdownTime;
return {
skipButtonState: skipButtonState,
@@ -637,6 +636,15 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
} as SkipNoticeState;
}
+ 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));
+
+ return Math.max(duration, Config.config.skipNoticeDuration);
+ };
+ }
+
afterVote(segment: SponsorTime, type: number, category: Category): void {
const index = utils.getSponsorIndexFromUUID(this.segments, segment.UUID);
const wikiLinkText = CompileConfig.wikiLinks[segment.category];