Skip to content

Commit

Permalink
Fix skip time overlapping with chapter titles
Browse files Browse the repository at this point in the history
  • Loading branch information
hanydd committed Jan 27, 2024
1 parent a4559f8 commit 5b895aa
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2553,8 +2553,7 @@ function showTimeWithoutSkips(skippedDuration: number): void {
}

// Video player time display
const displayClass = ".bpx-player-ctrl-time-label"
const display = document.querySelector(displayClass);
const display = document.querySelector(".bpx-player-ctrl-time-label") as HTMLDivElement;
if (!display) return;

const durationID = "sponsorBlockDurationAfterSkips";
Expand All @@ -2569,7 +2568,14 @@ function showTimeWithoutSkips(skippedDuration: number): void {

const durationAfterSkips = getFormattedTime(getVideo()?.duration - skippedDuration);

duration.innerText = (durationAfterSkips == null || skippedDuration <= 0) ? "" : " (" + durationAfterSkips + ")";
if (durationAfterSkips != null && skippedDuration > 0) {
duration.innerText = " (" + durationAfterSkips + ")";

// some hacks to change the min-width of the time control area,
// so it won't overlap with chapters on the right
display.style.width = "auto";
display.parentElement.style.minWidth = `${display.clientWidth - 11}px`;
}
}

function checkForPreloadedSegment() {
Expand Down

0 comments on commit 5b895aa

Please sign in to comment.