mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
parent
fd5ab9f153
commit
84a234f9b6
1 changed files with 8 additions and 7 deletions
|
@ -381,21 +381,21 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
||||||
}
|
}
|
||||||
|
|
||||||
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
|
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
|
||||||
this.handleReplacingLostTimes(event.target.value as Category, sponsorTime.actionType);
|
this.handleReplacingLostTimes(event.target.value as Category, sponsorTime.actionType, sponsorTime);
|
||||||
this.saveEditTimes();
|
this.saveEditTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
actionTypeSelectionChange(event: React.ChangeEvent<HTMLSelectElement>): void {
|
actionTypeSelectionChange(event: React.ChangeEvent<HTMLSelectElement>): void {
|
||||||
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
|
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
|
||||||
|
|
||||||
this.handleReplacingLostTimes(sponsorTime.category, event.target.value as ActionType);
|
this.handleReplacingLostTimes(sponsorTime.category, event.target.value as ActionType, sponsorTime);
|
||||||
this.saveEditTimes();
|
this.saveEditTimes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleReplacingLostTimes(category: Category, actionType: ActionType): void {
|
private handleReplacingLostTimes(category: Category, actionType: ActionType, segment: SponsorTime): void {
|
||||||
if (CompileConfig.categorySupport[category]?.includes(ActionType.Poi)) {
|
if (CompileConfig.categorySupport[category]?.includes(ActionType.Poi)) {
|
||||||
if (this.previousSkipType !== ActionType.Poi) {
|
if (this.previousSkipType !== ActionType.Poi) {
|
||||||
this.timesBeforeChanging = [null, utils.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[1])];
|
this.timesBeforeChanging = [null, segment.segment[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setTimeTo(1, null);
|
this.setTimeTo(1, null);
|
||||||
|
@ -410,12 +410,13 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
||||||
} else if (CompileConfig.categorySupport[category]?.length === 1
|
} else if (CompileConfig.categorySupport[category]?.length === 1
|
||||||
&& CompileConfig.categorySupport[category]?.[0] === ActionType.Full) {
|
&& CompileConfig.categorySupport[category]?.[0] === ActionType.Full) {
|
||||||
if (this.previousSkipType !== ActionType.Full) {
|
if (this.previousSkipType !== ActionType.Full) {
|
||||||
this.timesBeforeChanging = [utils.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[0]), utils.getFormattedTimeToSeconds(this.state.sponsorTimeEdits[1])];
|
this.timesBeforeChanging = [...segment.segment];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.previousSkipType = ActionType.Full;
|
this.previousSkipType = ActionType.Full;
|
||||||
} else if (CompileConfig.categorySupport[category]?.includes(ActionType.Skip)
|
} else if ((category === "chooseACategory" || (CompileConfig.categorySupport[category]?.includes(ActionType.Skip)
|
||||||
&& ![ActionType.Poi, ActionType.Full].includes(this.getNextActionType(category, actionType)) && this.previousSkipType !== ActionType.Skip) {
|
&& ![ActionType.Poi, ActionType.Full].includes(this.getNextActionType(category, actionType))))
|
||||||
|
&& this.previousSkipType !== ActionType.Skip) {
|
||||||
if (this.timesBeforeChanging[0]) {
|
if (this.timesBeforeChanging[0]) {
|
||||||
this.setTimeTo(0, this.timesBeforeChanging[0]);
|
this.setTimeTo(0, this.timesBeforeChanging[0]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue