From 68d985acba0b792680b0fb306bb7df4110dd27ab Mon Sep 17 00:00:00 2001 From: JellyBrick Date: Mon, 4 Sep 2023 03:28:50 +0900 Subject: [PATCH] fix: Fixes the video-toggle being displayed at the wrong position on fullscreen (#1218) Co-authored-by: MiepHD <63968466+MiepHD@users.noreply.github.com> --- plugins/video-toggle/front.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/video-toggle/front.ts b/plugins/video-toggle/front.ts index 839b899f..bac2d9da 100644 --- a/plugins/video-toggle/front.ts +++ b/plugins/video-toggle/front.ts @@ -52,7 +52,7 @@ function setup(e: CustomEvent) { player = $('ytmusic-player') as typeof player; video = $('video') as HTMLVideoElement; - ($('#main-panel') as HTMLVideoElement).append(switchButtonDiv); + ($('#player') as HTMLVideoElement).prepend(switchButtonDiv); if (options.hideVideo) { ($('.video-switch-button-checkbox') as HTMLInputElement).checked = false; @@ -62,6 +62,11 @@ function setup(e: CustomEvent) { video.style.height = 'auto'; } + //Prevents bubbling to the player which causes it to stop or resume + switchButtonDiv.addEventListener('click', (e) => { + e.stopPropagation(); + }); + // Button checked = show video switchButtonDiv.addEventListener('change', (e) => { const target = e.target as HTMLInputElement;