diff options
author | Ajay <[email protected]> | 2023-09-17 12:12:00 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2023-09-17 12:12:00 -0400 |
commit | 42f59898f3696eac1181cc31f06bb2dd10775763 (patch) | |
tree | 8515cb8feedce9e742f617683a72bcbe9cb284f8 | |
parent | 8ab126f502c8920de141b4681d1714cdc57b1c3a (diff) | |
download | SponsorBlock-42f59898f3696eac1181cc31f06bb2dd10775763.tar.gz SponsorBlock-42f59898f3696eac1181cc31f06bb2dd10775763.zip |
Add end button for all segments
-rw-r--r-- | src/components/SponsorTimeEditComponent.tsx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/components/SponsorTimeEditComponent.tsx b/src/components/SponsorTimeEditComponent.tsx index 801e8952..474a2fd3 100644 --- a/src/components/SponsorTimeEditComponent.tsx +++ b/src/components/SponsorTimeEditComponent.tsx @@ -288,11 +288,10 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo </span> ): ""} - {(!isNaN(segment[1]) && ![ActionType.Poi, ActionType.Full].includes(sponsorTime.actionType)) - && sponsorTime.actionType === ActionType.Chapter ? ( + {(!isNaN(segment[1]) && ![ActionType.Poi, ActionType.Full].includes(sponsorTime.actionType)) ? ( <span id={"sponsorTimePreviewButton" + this.idSuffix} className="sponsorTimeEditButton" - onClick={(e) => this.previewTime(e.ctrlKey, e.shiftKey)}> + onClick={(e) => this.previewTime(e.ctrlKey, e.shiftKey, true)}> {chrome.i18n.getMessage("End")} </span> ): ""} @@ -630,7 +629,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo : CompileConfig.categorySupport[category]?.[0] ?? ActionType.Skip } - previewTime(ctrlPressed = false, shiftPressed = false): void { + previewTime(ctrlPressed = false, shiftPressed = false, skipToEndTime = false): void { const sponsorTimes = this.props.contentContainer().sponsorTimesSubmitting; const index = this.props.index; let seekTime = 2; @@ -639,13 +638,11 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo const startTime = sponsorTimes[index].segment[0]; const endTime = sponsorTimes[index].segment[1]; - const isChapter = sponsorTimes[index].actionType === ActionType.Chapter; // If segment starts at 0:00, start playback at the end of the segment - const skipToEndTime = startTime === 0 || isChapter; - const skipTime = skipToEndTime ? endTime : (startTime - (seekTime * this.props.contentContainer().v.playbackRate)); + const skipTime = (startTime === 0 || skipToEndTime) ? endTime : (startTime - (seekTime * this.props.contentContainer().v.playbackRate)); - this.props.contentContainer().previewTime(skipTime, !isChapter); + this.props.contentContainer().previewTime(skipTime, !skipToEndTime); } inspectTime(): void { |