mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
show volume hud in videoplayer if available
This commit is contained in:
@ -17,9 +17,9 @@ module.exports = (options) => {
|
||||
}
|
||||
|
||||
ipcRenderer.on("did-finish-load", () => {
|
||||
injectVolumeHud();
|
||||
// if hideVideo is disabled
|
||||
if ($("#main-panel")?.computedStyleMap().get("display").value !== "none") {
|
||||
const noVid = $("#main-panel")?.computedStyleMap().get("display").value === "none";
|
||||
injectVolumeHud(noVid);
|
||||
if (!noVid) {
|
||||
setupVideoPlayerOnwheel(options);
|
||||
}
|
||||
});
|
||||
@ -27,11 +27,20 @@ module.exports = (options) => {
|
||||
firstRun(options);
|
||||
};
|
||||
|
||||
function injectVolumeHud() {
|
||||
function injectVolumeHud(noVid) {
|
||||
if (noVid) {
|
||||
const position = "top: 18px; right: 60px; z-index: 999; position: absolute;";
|
||||
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1.5s";
|
||||
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1s";
|
||||
|
||||
$(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend",
|
||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
||||
} else {
|
||||
const position = `top: 10px; left: 10px; z-index: 999; position: absolute;`;
|
||||
const mainStyle = "font-size: xxx-large; padding: 10px; transition: opacity 0.6s; webkit-text-stroke: 1px black; font-weight: 600;";
|
||||
|
||||
$("#song-video").insertAdjacentHTML('afterend',
|
||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
||||
}
|
||||
}
|
||||
|
||||
let hudFadeTimeout;
|
||||
|
||||
Reference in New Issue
Block a user