mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-03-16 16:22:08 +03:00
Add option to not render as chapters
This commit is contained in:
@@ -10,6 +10,7 @@ interface SBConfig {
|
||||
/* Contains unsubmitted segments that the user has created. */
|
||||
unsubmittedSegments: Record<string, SponsorTime[]>,
|
||||
defaultCategory: Category,
|
||||
renderAsChapters: boolean,
|
||||
whitelistedChannels: string[],
|
||||
forceChannelCheck: boolean,
|
||||
minutesSaved: number,
|
||||
@@ -127,6 +128,7 @@ const Config: SBObject = {
|
||||
lastIsVipUpdate: 0,
|
||||
unsubmittedSegments: {},
|
||||
defaultCategory: "chooseACategory" as Category,
|
||||
renderAsChapters: true,
|
||||
whitelistedChannels: [],
|
||||
forceChannelCheck: false,
|
||||
minutesSaved: 0,
|
||||
|
||||
@@ -226,7 +226,10 @@ class PreviewBar {
|
||||
|
||||
bar.style.position = "absolute";
|
||||
const duration = Math.min(segment[1], this.videoDuration) - segment[0];
|
||||
if (duration > 0) bar.style.width = `calc(${this.timeToPercentage(segment[1] - segment[0])}${this.chapterFilter(barSegment) ? ' - 2px' : ''})`;
|
||||
if (duration > 0) {
|
||||
bar.style.width = `calc(${this.timeToPercentage(segment[1] - segment[0])}${
|
||||
Config.config.renderAsChapters && this.chapterFilter(barSegment) ? ' - 2px' : ''})`;
|
||||
}
|
||||
|
||||
const time = segment[1] ? Math.min(this.videoDuration, segment[0]) : segment[0];
|
||||
bar.style.left = this.timeToPercentage(time);
|
||||
@@ -240,6 +243,10 @@ class PreviewBar {
|
||||
if (!progressBar || !chapterBar) return;
|
||||
|
||||
this.customChaptersBar?.remove();
|
||||
if (!Config.config.renderAsChapters) {
|
||||
chapterBar.style.removeProperty("display");
|
||||
return;
|
||||
}
|
||||
|
||||
// Merge overlapping chapters
|
||||
const filteredSegments = segments?.filter((segment) => this.chapterFilter(segment));
|
||||
|
||||
Reference in New Issue
Block a user