Skip to content

Commit

Permalink
Fix offset with chapters on hover preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Dec 24, 2024
1 parent 091d67e commit 16f2497
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion public/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ div:hover > #previewbar.sbNotInvidious {
display: none !important;
}

.ytp-tooltip.sponsorCategoryTooltipVisible {
.ytp-tooltip.sponsorCategoryTooltipVisible:not(.sponsorTooltipHasYTChapters) {
transform: translateY(-1em) !important;
}

Expand Down
5 changes: 5 additions & 0 deletions src/js-components/previewBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ class PreviewBar {
// Hide original tooltip if some chapter has been filtered out
originalTooltip.style.display = "none";
noYoutubeChapters = true;

originalTooltip.classList.add("sponsorTooltipHasYTChapters");
} else {
originalTooltip.classList.remove("sponsorTooltipHasYTChapters");
}

if (mainSegment === null && secondarySegment === null) {
Expand All @@ -163,6 +167,7 @@ class PreviewBar {
this.categoryTooltipContainer.classList.add(TOOLTIP_VISIBLE_CLASS);
if (mainSegment !== null && secondarySegment !== null) {
this.categoryTooltipContainer.classList.add("sponsorTwoTooltips");
originalTooltip.classList.remove("sponsorTooltipHasYTChapters");
} else {
this.categoryTooltipContainer.classList.remove("sponsorTwoTooltips");
}
Expand Down

0 comments on commit 16f2497

Please sign in to comment.