From 2231e2a3456743fa50f8ca546b36b67e1ac0f4cd Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 18 Aug 2021 02:13:05 -0400 Subject: Keep showing control bar button if hovered --- src/js-components/skipButtonControlBar.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/js-components/skipButtonControlBar.ts b/src/js-components/skipButtonControlBar.ts index b46f9147..d2d8d2d2 100644 --- a/src/js-components/skipButtonControlBar.ts +++ b/src/js-components/skipButtonControlBar.ts @@ -36,6 +36,8 @@ export class SkipButtonControlBar { this.container.appendChild(this.skipIcon); this.container.appendChild(this.textContainer); this.container.addEventListener("click", () => this.onClick()); + this.container.addEventListener("mouseenter", () => this.stopTimer()); + this.container.addEventListener("mouseleave", () => this.startTimer()); } attachToPage(): void { @@ -53,7 +55,15 @@ export class SkipButtonControlBar { this.container.classList.remove("hidden"); this.textContainer.innerText = getSkippingText([segment], false); + this.startTimer(); + } + + stopTimer(): void { if (this.timeout) clearTimeout(this.timeout); + } + + startTimer() { + this.stopTimer(); this.timeout = setTimeout(() => this.disable(), Config.config.skipNoticeDuration * 1000); } -- cgit v1.2.3