diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index ca17e2eb..4f397399 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -209,23 +209,17 @@ class PreviewBar { bar.style.position = "absolute"; const duration = segment[1] - segment[0]; - if (segment[1] - segment[0] > 0) bar.style.width = `calc(${this.timeToPercentage(segment[1] - segment[0])}${this.chapterFilter(barSegment) ? '- 2px' : ''})`; + if (segment[1] - segment[0] > 0) bar.style.width = `calc(${this.timeToPercentage(segment[1] - segment[0])}${this.chapterFilter(barSegment) ? ' - 2px' : ''})`; bar.style.left = this.timeToPercentage(Math.min(this.videoDuration - Math.max(0, duration), segment[0])); return bar; } createChaptersBar(segments: PreviewBarSegment[]): void { - //
- // set specific width (use calc(% - 4px)) - - // TODO: run this only once, then just update it in another function - const progressBar = document.querySelector('.ytp-progress-bar') as HTMLElement; const chapterBar = document.querySelector(".ytp-chapters-container:not(.sponsorBlockChapterBar)") as HTMLElement; if (!progressBar || !chapterBar) return; - if (segments === this.chaptersBarSegments) return; this.customChaptersBar?.remove(); if (segments?.length <= 0) {