mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Keep showing control bar button if hovered
This commit is contained in:
@@ -36,6 +36,8 @@ export class SkipButtonControlBar {
|
|||||||
this.container.appendChild(this.skipIcon);
|
this.container.appendChild(this.skipIcon);
|
||||||
this.container.appendChild(this.textContainer);
|
this.container.appendChild(this.textContainer);
|
||||||
this.container.addEventListener("click", () => this.onClick());
|
this.container.addEventListener("click", () => this.onClick());
|
||||||
|
this.container.addEventListener("mouseenter", () => this.stopTimer());
|
||||||
|
this.container.addEventListener("mouseleave", () => this.startTimer());
|
||||||
}
|
}
|
||||||
|
|
||||||
attachToPage(): void {
|
attachToPage(): void {
|
||||||
@@ -53,7 +55,15 @@ export class SkipButtonControlBar {
|
|||||||
this.container.classList.remove("hidden");
|
this.container.classList.remove("hidden");
|
||||||
this.textContainer.innerText = getSkippingText([segment], false);
|
this.textContainer.innerText = getSkippingText([segment], false);
|
||||||
|
|
||||||
|
this.startTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
stopTimer(): void {
|
||||||
if (this.timeout) clearTimeout(this.timeout);
|
if (this.timeout) clearTimeout(this.timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
startTimer() {
|
||||||
|
this.stopTimer();
|
||||||
this.timeout = setTimeout(() => this.disable(), Config.config.skipNoticeDuration * 1000);
|
this.timeout = setTimeout(() => this.disable(), Config.config.skipNoticeDuration * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user