mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Show both chapter names when small chapter in big chapter
This commit is contained in:
@@ -125,21 +125,25 @@ class PreviewBar {
|
|||||||
const [normalSegments, chapterSegments] =
|
const [normalSegments, chapterSegments] =
|
||||||
partition(this.segments.filter((s) => s.source !== SponsorSourceType.YouTube),
|
partition(this.segments.filter((s) => s.source !== SponsorSourceType.YouTube),
|
||||||
(segment) => segment.actionType !== ActionType.Chapter);
|
(segment) => segment.actionType !== ActionType.Chapter);
|
||||||
const normalSegment = this.getSmallestSegment(timeInSeconds, normalSegments);
|
let mainSegment = this.getSmallestSegment(timeInSeconds, normalSegments);
|
||||||
const chapterSegment = this.getSmallestSegment(timeInSeconds, chapterSegments);
|
let secondarySegment = this.getSmallestSegment(timeInSeconds, chapterSegments);
|
||||||
|
if (mainSegment === null && secondarySegment !== null) {
|
||||||
|
mainSegment = secondarySegment;
|
||||||
|
secondarySegment = this.getSmallestSegment(timeInSeconds, chapterSegments.filter((s) => s !== secondarySegment));
|
||||||
|
}
|
||||||
|
|
||||||
if (normalSegment === null && chapterSegment === null) {
|
if (mainSegment === null && secondarySegment === null) {
|
||||||
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 (normalSegment !== null && chapterSegment !== null) {
|
if (mainSegment !== null && secondarySegment !== null) {
|
||||||
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
|
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
|
||||||
} else {
|
} else {
|
||||||
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
|
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setTooltipTitle(normalSegment, this.categoryTooltip);
|
this.setTooltipTitle(mainSegment, this.categoryTooltip);
|
||||||
this.setTooltipTitle(chapterSegment, this.chapterTooltip);
|
this.setTooltipTitle(secondarySegment, this.chapterTooltip);
|
||||||
|
|
||||||
// Used to prevent overlapping
|
// Used to prevent overlapping
|
||||||
this.categoryTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
this.categoryTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
||||||
|
|||||||
Reference in New Issue
Block a user