aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/content.ts
diff options
context:
space:
mode:
authorAjay <[email protected]>2023-09-17 12:06:33 -0400
committerAjay <[email protected]>2023-09-17 12:06:33 -0400
commit8ab126f502c8920de141b4681d1714cdc57b1c3a (patch)
treebf330fc5007a3e38994952dc86f40f9c8a320365 /src/content.ts
parent4954abf9e385beb02ffde8b47bd5ad0a8fc5a4f5 (diff)
downloadSponsorBlock-8ab126f502c8920de141b4681d1714cdc57b1c3a.tar.gz
SponsorBlock-8ab126f502c8920de141b4681d1714cdc57b1c3a.zip
Highlight segment on hover
Diffstat (limited to 'src/content.ts')
-rw-r--r--src/content.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/content.ts b/src/content.ts
index 48fa4fcd..6b44520f 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -110,6 +110,7 @@ const skipNotices: SkipNotice[] = [];
let activeSkipKeybindElement: ToggleSkippable = null;
let retryFetchTimeout: NodeJS.Timeout = null;
let shownSegmentFailedToFetchWarning = false;
+let selectedSegment: SegmentUUID | null = null;
// JSON video info
let videoInfo: VideoInfo = null;
@@ -300,6 +301,10 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
case "reskip":
reskipSponsorTime(sponsorTimes.find((segment) => segment.UUID === request.UUID), true);
break;
+ case "selectSegment":
+ selectedSegment = request.UUID;
+ updatePreviewBar();
+ break;
case "submitVote":
vote(request.type, request.UUID).then((response) => sendResponse(response));
return true;
@@ -1369,7 +1374,8 @@ function updatePreviewBar(): void {
showLarger: segment.actionType === ActionType.Poi,
description: segment.description,
source: segment.source,
- requiredSegment: requiredSegment && (segment.UUID === requiredSegment || segment.UUID.startsWith(requiredSegment))
+ requiredSegment: requiredSegment && (segment.UUID === requiredSegment || segment.UUID.startsWith(requiredSegment)),
+ selectedSegment: selectedSegment && segment.UUID === selectedSegment
});
});
}