From 42beaf698c0e99ba0e8e3522e2ee46238eb5fe56 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 17 Aug 2021 18:37:59 -0400 Subject: [PATCH] Make highlight larger on preview bar --- src/content.ts | 3 ++- src/js-components/previewBar.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/content.ts b/src/content.ts index df1fcb18..3039e730 100644 --- a/src/content.ts +++ b/src/content.ts @@ -827,7 +827,6 @@ function updatePreviewBar(): void { if (video === null) return; const previewBarSegments: PreviewBarSegment[] = []; - if (sponsorTimes) { sponsorTimes.forEach((segment) => { if (segment.hidden !== SponsorHideType.Visible) return; @@ -836,6 +835,7 @@ function updatePreviewBar(): void { segment: segment.segment as [number, number], category: segment.category, unsubmitted: false, + showLarger: utils.getCategoryActionType(segment.category) === CategoryActionType.POI }); }); } @@ -845,6 +845,7 @@ function updatePreviewBar(): void { segment: segment.segment as [number, number], category: segment.category, unsubmitted: true, + showLarger: utils.getCategoryActionType(segment.category) === CategoryActionType.POI }); }); diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index fd7476a1..c71c3c81 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -15,6 +15,7 @@ export interface PreviewBarSegment { segment: [number, number]; category: string; unsubmitted: boolean; + showLarger: boolean; } class PreviewBar { @@ -182,10 +183,10 @@ class PreviewBar { }); } - createBar({category, unsubmitted, segment}: PreviewBarSegment): HTMLLIElement { + createBar({category, unsubmitted, segment, showLarger}: PreviewBarSegment): HTMLLIElement { const bar = document.createElement('li'); bar.classList.add('previewbar'); - bar.innerHTML = ' '; + bar.innerHTML = showLarger ? '  ' : ' '; const fullCategoryName = (unsubmitted ? 'preview-' : '') + category; bar.setAttribute('sponsorblock-category', fullCategoryName);