mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix precise-volume hud positioning
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
const { ElementFromFile, templatePath } = require("../utils");
|
||||
|
||||
const { setOptions } = require("../../config/plugins");
|
||||
const { setOptions, isEnabled } = require("../../config/plugins");
|
||||
|
||||
const moveVolumeHud = isEnabled("precise-volume") ? require("../precise-volume/front").moveVolumeHud : ()=>{};
|
||||
|
||||
function $(selector) { return document.querySelector(selector); }
|
||||
|
||||
@ -39,7 +41,7 @@ function setup(e) {
|
||||
changeDisplay(e.target.checked);
|
||||
setOptions("video-toggle", options);
|
||||
})
|
||||
|
||||
|
||||
video.addEventListener('srcChanged', videoStarted);
|
||||
|
||||
observeThumbnail();
|
||||
@ -89,13 +91,6 @@ function forcePlaybackMode() {
|
||||
playbackModeObserver.observe(player, { attributeFilter: ["playback-mode"] });
|
||||
}
|
||||
|
||||
// if precise volume plugin is enabled, move its hud to be on top of the video
|
||||
function moveVolumeHud(showVideo) {
|
||||
const volumeHud = $('#volumeHud');
|
||||
if (volumeHud)
|
||||
volumeHud.style.top = showVideo ? `${(player.clientHeight - video.clientHeight) / 2}px` : 0;
|
||||
}
|
||||
|
||||
function observeThumbnail() {
|
||||
const playbackModeObserver = new MutationObserver(mutations => {
|
||||
if (!player.videoMode_) return;
|
||||
|
||||
Reference in New Issue
Block a user