mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 01:01:55 +01:00
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into chapters
This commit is contained in:
commit
cf3b3c5c48
3 changed files with 15 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "__MSG_fullName__",
|
||||
"short_name": "SponsorBlock",
|
||||
"version": "4.1.3",
|
||||
"version": "4.1.4",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_Description__",
|
||||
"homepage_url": "https://sponsor.ajay.app",
|
||||
|
|
|
@ -416,21 +416,21 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||
}
|
||||
|
||||
const sponsorTime = this.props.contentContainer().sponsorTimesSubmitting[this.props.index];
|
||||
this.handleReplacingLostTimes(chosenCategory, sponsorTime.actionType);
|
||||
this.handleReplacingLostTimes(chosenCategory, sponsorTime.actionType, sponsorTime);
|
||||
this.saveEditTimes();
|
||||
}
|
||||
|
||||
actionTypeSelectionChange(event: React.ChangeEvent<HTMLSelectElement>): void {
|
||||
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();
|
||||
}
|
||||
|
||||
private handleReplacingLostTimes(category: Category, actionType: ActionType): void {
|
||||
private handleReplacingLostTimes(category: Category, actionType: ActionType, segment: SponsorTime): void {
|
||||
if (CompileConfig.categorySupport[category]?.includes(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);
|
||||
|
@ -445,12 +445,13 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||
} else if (CompileConfig.categorySupport[category]?.length === 1
|
||||
&& CompileConfig.categorySupport[category]?.[0] === 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;
|
||||
} else if (CompileConfig.categorySupport[category]?.includes(ActionType.Skip)
|
||||
&& ![ActionType.Poi, ActionType.Full].includes(this.getNextActionType(category, actionType)) && this.previousSkipType !== 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) {
|
||||
if (this.timesBeforeChanging[0]) {
|
||||
this.setTimeTo(0, this.timesBeforeChanging[0]);
|
||||
}
|
||||
|
|
|
@ -767,7 +767,7 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
|
|||
// Hide all submissions smaller than the minimum duration
|
||||
if (Config.config.minDuration !== 0) {
|
||||
for (const segment of sponsorTimes) {
|
||||
const duration = segment[1] - segment[0];
|
||||
const duration = segment.segment[1] - segment.segment[0];
|
||||
if (duration > 0 && duration < Config.config.minDuration) {
|
||||
segment.hidden = SponsorHideType.MinimumDuration;
|
||||
}
|
||||
|
@ -1947,6 +1947,11 @@ async function sendSubmitMessage() {
|
|||
sponsorTimesSubmitting = [];
|
||||
|
||||
updatePreviewBar();
|
||||
|
||||
const fullVideoSegment = sponsorTimes.filter((time) => time.actionType === ActionType.Full)[0];
|
||||
if (fullVideoSegment) {
|
||||
categoryPill?.setSegment(fullVideoSegment);
|
||||
}
|
||||
} else {
|
||||
// Show that the upload failed
|
||||
playerButtons.submit.button.style.animation = "unset";
|
||||
|
|
Loading…
Reference in a new issue