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", () => {
|
ipcRenderer.on("did-finish-load", () => {
|
||||||
injectVolumeHud();
|
const noVid = $("#main-panel")?.computedStyleMap().get("display").value === "none";
|
||||||
// if hideVideo is disabled
|
injectVolumeHud(noVid);
|
||||||
if ($("#main-panel")?.computedStyleMap().get("display").value !== "none") {
|
if (!noVid) {
|
||||||
setupVideoPlayerOnwheel(options);
|
setupVideoPlayerOnwheel(options);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -27,11 +27,20 @@ module.exports = (options) => {
|
|||||||
firstRun(options);
|
firstRun(options);
|
||||||
};
|
};
|
||||||
|
|
||||||
function injectVolumeHud() {
|
function injectVolumeHud(noVid) {
|
||||||
const position = "top: 18px; right: 60px; z-index: 999; position: absolute;";
|
if (noVid) {
|
||||||
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1.5s";
|
const position = "top: 18px; right: 60px; z-index: 999; position: absolute;";
|
||||||
$(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend",
|
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1s";
|
||||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
|
||||||
|
$(".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;
|
let hudFadeTimeout;
|
||||||
|
|||||||
Reference in New Issue
Block a user