mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
Don't display existing chapters twice
This commit is contained in:
@@ -1085,7 +1085,8 @@ function updatePreviewBar(): void {
|
|||||||
actionType: segment.actionType,
|
actionType: segment.actionType,
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: segment.actionType === ActionType.Poi,
|
showLarger: segment.actionType === ActionType.Poi,
|
||||||
description: segment.description
|
description: segment.description,
|
||||||
|
source: segment.source,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1097,7 +1098,8 @@ function updatePreviewBar(): void {
|
|||||||
actionType: segment.actionType,
|
actionType: segment.actionType,
|
||||||
unsubmitted: true,
|
unsubmitted: true,
|
||||||
showLarger: segment.actionType === ActionType.Poi,
|
showLarger: segment.actionType === ActionType.Poi,
|
||||||
description: segment.description
|
description: segment.description,
|
||||||
|
source: segment.source
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ https://github.com/videosegments/videosegments/commits/f1e111bdfe231947800c6efdd
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import { ActionType, Category, SegmentContainer, SponsorTime } from "../types";
|
import { ActionType, Category, SegmentContainer, SponsorSourceType, SponsorTime } from "../types";
|
||||||
import Utils from "../utils";
|
import Utils from "../utils";
|
||||||
import { partition } from "../utils/arrayUtils";
|
import { partition } from "../utils/arrayUtils";
|
||||||
import { GenericUtils } from "../utils/genericUtils";
|
import { GenericUtils } from "../utils/genericUtils";
|
||||||
@@ -22,6 +22,7 @@ export interface PreviewBarSegment {
|
|||||||
unsubmitted: boolean;
|
unsubmitted: boolean;
|
||||||
showLarger: boolean;
|
showLarger: boolean;
|
||||||
description: string;
|
description: string;
|
||||||
|
source: SponsorSourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ChapterGroup extends SegmentContainer {
|
interface ChapterGroup extends SegmentContainer {
|
||||||
@@ -120,7 +121,9 @@ class PreviewBar {
|
|||||||
if (timeInSeconds === null) return;
|
if (timeInSeconds === null) return;
|
||||||
|
|
||||||
// Find the segment at that location, using the shortest if multiple found
|
// Find the segment at that location, using the shortest if multiple found
|
||||||
const [normalSegments, chapterSegments] = partition(this.segments, (segment) => segment.actionType !== ActionType.Chapter)
|
const [normalSegments, chapterSegments] =
|
||||||
|
partition(this.segments.filter((s) => s.source !== SponsorSourceType.YouTube),
|
||||||
|
(segment) => segment.actionType !== ActionType.Chapter);
|
||||||
const normalSegment = this.getSmallestSegment(timeInSeconds, normalSegments);
|
const normalSegment = this.getSmallestSegment(timeInSeconds, normalSegments);
|
||||||
const chapterSegment = this.getSmallestSegment(timeInSeconds, chapterSegments);
|
const chapterSegment = this.getSmallestSegment(timeInSeconds, chapterSegments);
|
||||||
|
|
||||||
@@ -128,7 +131,7 @@ class PreviewBar {
|
|||||||
this.categoryTooltipContainer.classList.remove(TOOLTIP_VISIBLE_CLASS);
|
this.categoryTooltipContainer.classList.remove(TOOLTIP_VISIBLE_CLASS);
|
||||||
} else {
|
} else {
|
||||||
this.categoryTooltipContainer.classList.add(TOOLTIP_VISIBLE_CLASS);
|
this.categoryTooltipContainer.classList.add(TOOLTIP_VISIBLE_CLASS);
|
||||||
if (noYoutubeChapters && normalSegment !== null && chapterSegment !== null) {
|
if (normalSegment !== null && chapterSegment !== null) {
|
||||||
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
|
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
|
||||||
} else {
|
} else {
|
||||||
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
|
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
|
||||||
|
|||||||
Reference in New Issue
Block a user