Fix preview bar on mobile

Fixes #1947 and #1943
This commit is contained in:
Ajay
2024-01-14 14:03:05 -05:00
parent eede32aa7e
commit 3222afd8b4
4 changed files with 25 additions and 32 deletions

View File

@@ -224,16 +224,12 @@ class PreviewBar {
}
}
createElement(parent: HTMLElement): void {
this.parent = parent;
createElement(parent?: HTMLElement): void {
if (parent) this.parent = parent;
if (this.onMobileYouTube) {
if (parent.classList.contains("progress-bar-background")) {
parent.style.backgroundColor = "rgba(255, 255, 255, 0.3)";
parent.style.opacity = "1";
}
this.container.style.transform = "none";
this.container.style.height = "var(--yt-progress-bar-height)";
} else if (!this.onInvidious) {
this.container.classList.add("sbNotInvidious");
}

View File

@@ -3,6 +3,7 @@ import { SegmentUUID, SponsorTime } from "../types";
import { getSkippingText } from "../utils/categoryUtils";
import { AnimationUtils } from "../utils/animationUtils";
import { keybindToString } from "../../maze-utils/src/config";
import { isMobileControlsOpen } from "../utils/mobileUtils";
export interface SkipButtonControlBarProps {
skip: (segment: SponsorTime) => void;
@@ -183,10 +184,8 @@ export class SkipButtonControlBar {
}
updateMobileControls(): void {
const overlay = document.getElementById("player-control-overlay");
if (overlay && this.enabled) {
if (overlay?.classList?.contains("fadein")) {
if (this.enabled) {
if (isMobileControlsOpen()) {
this.showButton();
} else {
this.hideButton();