mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
Keep skip notice open for full duration of mute segments
This commit is contained in:
@@ -116,6 +116,9 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
this.unselectedColor = Config.config.colorPalette.white;
|
this.unselectedColor = Config.config.colorPalette.white;
|
||||||
this.lockedColor = Config.config.colorPalette.locked;
|
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
|
// Setup state
|
||||||
this.state = {
|
this.state = {
|
||||||
noticeTitle,
|
noticeTitle,
|
||||||
@@ -123,8 +126,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
messageOnClick: null,
|
messageOnClick: null,
|
||||||
|
|
||||||
//the countdown until this notice closes
|
//the countdown until this notice closes
|
||||||
maxCountdownTime: () => Config.config.skipNoticeDuration,
|
maxCountdownTime,
|
||||||
countdownTime: Config.config.skipNoticeDuration,
|
countdownTime: maxCountdownTime(),
|
||||||
countdownText: null,
|
countdownText: null,
|
||||||
|
|
||||||
skipButtonState: this.props.startReskip
|
skipButtonState: this.props.startReskip
|
||||||
@@ -621,12 +624,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
getUnskippedModeInfo(index: number, skipButtonState: SkipButtonState): SkipNoticeState {
|
getUnskippedModeInfo(index: number, skipButtonState: SkipButtonState): SkipNoticeState {
|
||||||
const changeCountdown = this.segments[index].actionType !== ActionType.Poi;
|
const changeCountdown = this.segments[index].actionType !== ActionType.Poi;
|
||||||
|
|
||||||
const maxCountdownTime = changeCountdown ? () => {
|
const maxCountdownTime = changeCountdown ?
|
||||||
const sponsorTime = this.segments[index];
|
this.getFullDurationCountdown(index) : this.state.maxCountdownTime;
|
||||||
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;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
skipButtonState: skipButtonState,
|
skipButtonState: skipButtonState,
|
||||||
@@ -637,6 +636,15 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
} as SkipNoticeState;
|
} 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 {
|
afterVote(segment: SponsorTime, type: number, category: Category): void {
|
||||||
const index = utils.getSponsorIndexFromUUID(this.segments, segment.UUID);
|
const index = utils.getSponsorIndexFromUUID(this.segments, segment.UUID);
|
||||||
const wikiLinkText = CompileConfig.wikiLinks[segment.category];
|
const wikiLinkText = CompileConfig.wikiLinks[segment.category];
|
||||||
|
|||||||
Reference in New Issue
Block a user