diff options
author | Ajay <[email protected]> | 2023-10-31 01:16:36 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2023-10-31 01:16:36 -0400 |
commit | 6f54c8a7313e3d7afc15830065b5dc73f143657f (patch) | |
tree | 4c0d5e8e4377248607c7084146ab7e9210b37749 /src | |
parent | ca7eb50a824231146e1c290fad2a77c1c5792ca6 (diff) | |
download | SponsorBlock-6f54c8a7313e3d7afc15830065b5dc73f143657f.tar.gz SponsorBlock-6f54c8a7313e3d7afc15830065b5dc73f143657f.zip |
Make highlight bigger on timeline when skip to highlight button hovered
Diffstat (limited to 'src')
-rw-r--r-- | src/content.ts | 9 | ||||
-rw-r--r-- | src/js-components/skipButtonControlBar.ts | 17 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/content.ts b/src/content.ts index de537005..03afcb16 100644 --- a/src/content.ts +++ b/src/content.ts @@ -302,8 +302,7 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo reskipSponsorTime(sponsorTimes.find((segment) => segment.UUID === request.UUID), true); break; case "selectSegment": - selectedSegment = request.UUID; - updatePreviewBar(); + selectSegment(request.UUID); break; case "submitVote": vote(request.type, request.UUID).then((response) => sendResponse(response)); @@ -1071,6 +1070,7 @@ function setupSkipButtonControlBar() { openNotice: true, forceAutoSkip: true }), + selectSegment, onMobileYouTube: isOnMobileYouTube() }); } @@ -1349,6 +1349,11 @@ function updatePreviewBarPositionMobile(parent: HTMLElement) { } } +function selectSegment(UUID: SegmentUUID): void { + selectedSegment = UUID; + updatePreviewBar(); +} + function updatePreviewBar(): void { if (previewBar === null) return; diff --git a/src/js-components/skipButtonControlBar.ts b/src/js-components/skipButtonControlBar.ts index a4cf31a5..b14eed18 100644 --- a/src/js-components/skipButtonControlBar.ts +++ b/src/js-components/skipButtonControlBar.ts @@ -1,11 +1,12 @@ import Config from "../config"; -import { SponsorTime } from "../types"; +import { SegmentUUID, SponsorTime } from "../types"; import { getSkippingText } from "../utils/categoryUtils"; import { AnimationUtils } from "../utils/animationUtils"; import { keybindToString } from "../../maze-utils/src/config"; export interface SkipButtonControlBarProps { skip: (segment: SponsorTime) => void; + selectSegment: (UUID: SegmentUUID) => void; onMobileYouTube: boolean; } @@ -54,8 +55,18 @@ export class SkipButtonControlBar { this.container.appendChild(this.skipIcon); this.container.appendChild(this.textContainer); this.container.addEventListener("click", () => this.toggleSkip()); - this.container.addEventListener("mouseenter", () => this.stopTimer()); - this.container.addEventListener("mouseleave", () => this.startTimer()); + this.container.addEventListener("mouseenter", () => { + this.stopTimer(); + + if (this.segment) { + props.selectSegment(this.segment.UUID); + } + }); + this.container.addEventListener("mouseleave", () => { + this.startTimer(); + + props.selectSegment(null); + }); if (this.onMobileYouTube) { this.container.addEventListener("touchstart", (e) => this.handleTouchStart(e)); this.container.addEventListener("touchmove", (e) => this.handleTouchMove(e)); |