diff --git a/public/_locales b/public/_locales index 0285b879..89f31bcf 160000 --- a/public/_locales +++ b/public/_locales @@ -1 +1 @@ -Subproject commit 0285b87951827abe87cd5f7fe4032a1389b0954a +Subproject commit 89f31bcf2db2b906cf16dec760bb4de52b46aaca diff --git a/src/popup/SegmentListComponent.tsx b/src/popup/SegmentListComponent.tsx index 1194f422..4bf438b6 100644 --- a/src/popup/SegmentListComponent.tsx +++ b/src/popup/SegmentListComponent.tsx @@ -58,35 +58,37 @@ export const SegmentListComponent = (props: SegmentListComponentProps) => { } }; - const segmentsWithNesting: segmentWithNesting[] = [] - let nbTrailingNonChapters = 0 - function nestChapters(segments: segmentWithNesting[], seg: SponsorTime, topLevel?:boolean){ - if (seg.actionType === ActionType.Chapter - && segments.length) - { + const segmentsWithNesting: segmentWithNesting[] = []; + let nbTrailingNonChapters = 0; + function nestChapters(segments: segmentWithNesting[], seg: SponsorTime, topLevel?: boolean) { + if (seg.actionType === ActionType.Chapter && segments.length) { // trailing non-chapters can only exist at top level const lastElement = segments[segments.length - (topLevel ? nbTrailingNonChapters + 1 : 1)] if (lastElement.actionType === ActionType.Chapter - && lastElement.segment[0] <= seg.segment[0] - && lastElement.segment[1] >= seg.segment[1]) { + && lastElement.segment[0] <= seg.segment[0] + && lastElement.segment[1] >= seg.segment[1]) { if (lastElement.innerChapters){ nestChapters(lastElement.innerChapters, seg); } else { lastElement.innerChapters = [seg]; } - } - else { - if (topLevel){nbTrailingNonChapters = 0} + } else { + if (topLevel) { + nbTrailingNonChapters = 0; + } + segments.push(seg); } } else { - if (seg.actionType !== ActionType.Chapter){nbTrailingNonChapters++} + if (seg.actionType !== ActionType.Chapter) { + nbTrailingNonChapters++; + } segments.push(seg); } } - props.segments.forEach((seg) => {nestChapters(segmentsWithNesting, {...seg}, true)}) + props.segments.forEach((seg) => nestChapters(segmentsWithNesting, {...seg}, true)); return (