fix: Fixes the video-toggle being displayed at the wrong position on fullscreen (#1218)

Co-authored-by: MiepHD <63968466+MiepHD@users.noreply.github.com>
This commit is contained in:
JellyBrick
2023-09-04 03:28:50 +09:00
parent 76a7b303fa
commit 68d985acba

View File

@ -52,7 +52,7 @@ function setup(e: CustomEvent<YoutubePlayer>) {
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<YoutubePlayer>) {
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;