mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Fix start time messing up when end time too far in preview bar
This commit is contained in:
@@ -197,10 +197,10 @@ class PreviewBar {
|
|||||||
if (!this.onMobileYouTube) bar.style.opacity = Config.config.barTypes[fullCategoryName]?.opacity;
|
if (!this.onMobileYouTube) bar.style.opacity = Config.config.barTypes[fullCategoryName]?.opacity;
|
||||||
|
|
||||||
bar.style.position = "absolute";
|
bar.style.position = "absolute";
|
||||||
const duration = segment[1] - segment[0];
|
const duration = Math.min(segment[1], this.videoDuration) - segment[0];
|
||||||
if (segment[1] - segment[0] > 0) bar.style.width = this.timeToPercentage(segment[1] - segment[0]);
|
if (duration > 0) bar.style.width = this.timeToPercentage(duration);
|
||||||
|
|
||||||
const time = segment[1] ? Math.min(this.videoDuration - Math.max(0, duration), segment[0]) : segment[0];
|
const time = segment[1] ? Math.min(this.videoDuration, segment[0]) : segment[0];
|
||||||
bar.style.left = this.timeToPercentage(time);
|
bar.style.left = this.timeToPercentage(time);
|
||||||
|
|
||||||
return bar;
|
return bar;
|
||||||
|
|||||||
Reference in New Issue
Block a user