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 26, 2024
1 parent a4559f8 commit d55002d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 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,15 @@ 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";
console.log(display.clientWidth);
display.parentElement.style.minWidth = `${display.clientWidth - 11}px`;
}
}

function checkForPreloadedSegment() {
Expand Down

0 comments on commit d55002d

Please sign in to comment.