aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/js-components/skipButtonControlBar.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/js-components/skipButtonControlBar.ts')
-rw-r--r--src/js-components/skipButtonControlBar.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/js-components/skipButtonControlBar.ts b/src/js-components/skipButtonControlBar.ts
index 9a8af4ec..37a5d409 100644
--- a/src/js-components/skipButtonControlBar.ts
+++ b/src/js-components/skipButtonControlBar.ts
@@ -18,6 +18,7 @@ export class SkipButtonControlBar {
showKeybindHint = true;
timeout: NodeJS.Timeout;
+ duration = 0;
skip: (segment: SponsorTime) => void;
@@ -42,6 +43,10 @@ export class SkipButtonControlBar {
this.container.addEventListener("mouseleave", () => this.startTimer());
}
+ getElement(): HTMLElement {
+ return this.container;
+ }
+
attachToPage(): void {
const leftControlsContainer = document.querySelector(".ytp-left-controls");
this.chapterText = document.querySelector(".ytp-chapter-container");
@@ -51,7 +56,8 @@ export class SkipButtonControlBar {
}
}
- enable(segment: SponsorTime): void {
+ enable(segment: SponsorTime, duration?: number): void {
+ if (duration) this.duration = duration;
this.segment = segment;
this.refreshText();
@@ -78,7 +84,7 @@ export class SkipButtonControlBar {
startTimer(): void {
this.stopTimer();
- this.timeout = setTimeout(() => this.disable(), Config.config.skipNoticeDuration * 1000);
+ this.timeout = setTimeout(() => this.disable(), Math.max(Config.config.skipNoticeDuration, this.duration) * 1000);
}
disable(): void {