aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay Ramachandran <[email protected]>2021-08-18 02:13:05 -0400
committerAjay Ramachandran <[email protected]>2021-08-18 02:13:05 -0400
commit2231e2a3456743fa50f8ca546b36b67e1ac0f4cd (patch)
tree966d861a34356a485e8ec1fa69548708f95b8fd2
parente126b59078b18624915dcf8213fa4132fc0e0580 (diff)
downloadSponsorBlock-2231e2a3456743fa50f8ca546b36b67e1ac0f4cd.tar.gz
SponsorBlock-2231e2a3456743fa50f8ca546b36b67e1ac0f4cd.zip
Keep showing control bar button if hovered
-rw-r--r--src/js-components/skipButtonControlBar.ts10
1 files changed, 10 insertions, 0 deletions
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);
}