mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
Show both chapter names when small chapter in big chapter
This commit is contained in:
parent
6325d3539c
commit
9f02bf4ce2
1 changed files with 10 additions and 6 deletions
|
@ -125,21 +125,25 @@ class PreviewBar {
|
|||
const [normalSegments, chapterSegments] =
|
||||
partition(this.segments.filter((s) => s.source !== SponsorSourceType.YouTube),
|
||||
(segment) => segment.actionType !== ActionType.Chapter);
|
||||
const normalSegment = this.getSmallestSegment(timeInSeconds, normalSegments);
|
||||
const chapterSegment = this.getSmallestSegment(timeInSeconds, chapterSegments);
|
||||
let mainSegment = this.getSmallestSegment(timeInSeconds, normalSegments);
|
||||
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);
|
||||
} else {
|
||||
this.categoryTooltipContainer.classList.add(TOOLTIP_VISIBLE_CLASS);
|
||||
if (normalSegment !== null && chapterSegment !== null) {
|
||||
if (mainSegment !== null && secondarySegment !== null) {
|
||||
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
|
||||
} else {
|
||||
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
|
||||
}
|
||||
|
||||
this.setTooltipTitle(normalSegment, this.categoryTooltip);
|
||||
this.setTooltipTitle(chapterSegment, this.chapterTooltip);
|
||||
this.setTooltipTitle(mainSegment, this.categoryTooltip);
|
||||
this.setTooltipTitle(secondarySegment, this.chapterTooltip);
|
||||
|
||||
// Used to prevent overlapping
|
||||
this.categoryTooltip.classList.toggle("ytp-tooltip-text-no-title", noYoutubeChapters);
|
||||
|
|
Loading…
Reference in a new issue