Skip to content

Commit 33c9392

Browse files
committed
Show the category name on hover on new YouTube player layout
1 parent f4d2558 commit 33c9392

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/js-components/previewBar.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class PreviewBar {
131131
// global chapter tooltip or duration tooltip
132132
// YT, Vorapis, unknown, YTTV
133133
const tooltipTextWrapper = document.querySelector(".ytp-tooltip-text-wrapper, .ytp-progress-tooltip-text-container, .yssi-slider .ys-seek-details .time-info-bar") ?? document.querySelector("#progress-bar-container.ytk-player > #hover-time-info");
134-
const originalTooltip = tooltipTextWrapper.querySelector(".ytp-tooltip-title:not(.sponsorCategoryTooltip), .ytp-progress-tooltip-text:not(.sponsorCategoryTooltip), .current-time:not(.sponsorCategoryTooltip)") as HTMLElement;
134+
const originalTooltip = (tooltipTextWrapper.querySelector(".ytp-tooltip-progress-bar-pill-title") ??
135+
tooltipTextWrapper.querySelector(".ytp-tooltip-title:not(.sponsorCategoryTooltip), .ytp-progress-tooltip-text:not(.sponsorCategoryTooltip), .current-time:not(.sponsorCategoryTooltip)")) as HTMLElement;
135136
if (!tooltipTextWrapper || !tooltipTextWrapper.parentElement) return;
136137

137138
// Grab the tooltip from the text wrapper as the tooltip doesn't have its classes on init
@@ -258,6 +259,21 @@ class PreviewBar {
258259
}
259260

260261
tooltip.style.removeProperty("display");
262+
263+
// For July 2025 test layout
264+
if (document.querySelector(".ytp-delhi-modern")) {
265+
tooltip.style.display = "inline-block";
266+
267+
// Class gets added back, so grab the top value for when the class is removed
268+
tooltip.style.removeProperty("top");
269+
tooltip.classList.remove("ytp-tooltip-text-no-title");
270+
271+
if (tooltip === this.chapterTooltip) {
272+
tooltip.style.top = `calc(${window.getComputedStyle(tooltip).getPropertyValue("top")} + 5px)`;
273+
} else {
274+
tooltip.style.top = window.getComputedStyle(tooltip).getPropertyValue("top");
275+
}
276+
}
261277
} else {
262278
tooltip.style.display = "none";
263279
}

0 commit comments

Comments
 (0)