hide when buttons disabled and hide chapter prefix

This commit is contained in:
Ajay Ramachandran
2021-09-29 23:13:54 -04:00
parent 22ecc05a55
commit 9ec984065e

View File

@@ -68,6 +68,7 @@ export class SkipButtonControlBar {
if (this.segment) { if (this.segment) {
this.chapterText?.classList?.add("hidden"); this.chapterText?.classList?.add("hidden");
this.container.classList.remove("hidden"); this.container.classList.remove("hidden");
this.textContainer?.classList?.remove("hidden");
this.textContainer.innerText = getSkippingText([this.segment], false) + (this.showKeybindHint ? " (" + Config.config.skipKeybind + ")" : ""); this.textContainer.innerText = getSkippingText([this.segment], false) + (this.showKeybindHint ? " (" + Config.config.skipKeybind + ")" : "");
} }
} }
@@ -84,22 +85,36 @@ export class SkipButtonControlBar {
startTimer(): void { startTimer(): void {
this.stopTimer(); this.stopTimer();
this.timeout = setTimeout(() => this.innerTextVanish(), Math.max(Config.config.skipNoticeDuration, this.duration) * 1000); this.timeout = setTimeout(() => this.disableText(), Math.max(Config.config.skipNoticeDuration, this.duration) * 1000);
} }
disable(): void { disable(): void {
this.container.classList.add("hidden"); this.container.classList.add("hidden");
this.textContainer?.classList?.remove("hidden");
this.chapterText?.classList?.remove("hidden"); this.chapterText?.classList?.remove("hidden");
this.getChapterPrefix()?.classList?.remove("hidden");
} }
toggleSkip(): void { toggleSkip(): void {
this.skip(this.segment); this.skip(this.segment);
this.innerTextVanish(); this.disableText();
} }
innerTextVanish(): void { disableText(): void {
this.textContainer.innerText = ""; if (Config.config.hideVideoPlayerControls) {
this.disable();
return;
}
this.textContainer?.classList?.add("hidden");
this.chapterText?.classList?.remove("hidden"); this.chapterText?.classList?.remove("hidden");
this.getChapterPrefix()?.classList?.add("hidden");
}
private getChapterPrefix(): HTMLElement {
return document.querySelector(".ytp-chapter-title-prefix");
} }
} }