mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
Merge pull request #645 from Araxeus/fix-volumeHud-position-on-miniplayer
[Precise-Volume] fix volumeHud position in miniplayer
This commit is contained in:
@ -1,9 +1,15 @@
|
|||||||
|
const { injectCSS } = require("../utils");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is used to determine if plugin is actually active
|
This is used to determine if plugin is actually active
|
||||||
(not if its only enabled in options)
|
(not if its only enabled in options)
|
||||||
*/
|
*/
|
||||||
let enabled = false;
|
let enabled = false;
|
||||||
|
|
||||||
module.exports = () => enabled = true;
|
module.exports = (win) => {
|
||||||
|
enabled = true;
|
||||||
|
injectCSS(win.webContents, path.join(__dirname, "volume-hud.css"));
|
||||||
|
}
|
||||||
|
|
||||||
module.exports.enabled = () => enabled;
|
module.exports.enabled = () => enabled;
|
||||||
|
|||||||
@ -45,23 +45,21 @@ function firstRun(options) {
|
|||||||
|
|
||||||
// Change options from renderer to keep sync
|
// Change options from renderer to keep sync
|
||||||
ipcRenderer.on("setOptions", (_event, newOptions = {}) => {
|
ipcRenderer.on("setOptions", (_event, newOptions = {}) => {
|
||||||
for (option in newOptions) {
|
Object.assign(options, newOptions)
|
||||||
options[option] = newOptions[option];
|
|
||||||
}
|
|
||||||
setMenuOptions("precise-volume", options);
|
setMenuOptions("precise-volume", options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function injectVolumeHud(noVid) {
|
function injectVolumeHud(noVid) {
|
||||||
if (noVid) {
|
if (noVid) {
|
||||||
const position = "top: 18px; right: 60px; z-index: 999; position: absolute;";
|
const position = "top: 18px; right: 60px;";
|
||||||
const mainStyle = "font-size: xx-large; padding: 10px; transition: opacity 1s; pointer-events: none;";
|
const mainStyle = "font-size: xx-large;";
|
||||||
|
|
||||||
$(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend",
|
$(".center-content.ytmusic-nav-bar").insertAdjacentHTML("beforeend",
|
||||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
||||||
} else {
|
} else {
|
||||||
const position = `top: 10px; left: 10px; z-index: 999; position: absolute;`;
|
const position = `top: 10px; left: 10px;`;
|
||||||
const mainStyle = "font-size: xxx-large; padding: 10px; transition: opacity 0.6s; webkit-text-stroke: 1px black; font-weight: 600; pointer-events: none;";
|
const mainStyle = "font-size: xxx-large; webkit-text-stroke: 1px black; font-weight: 600;";
|
||||||
|
|
||||||
$("#song-video").insertAdjacentHTML('afterend',
|
$("#song-video").insertAdjacentHTML('afterend',
|
||||||
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
`<span id="volumeHud" style="${position + mainStyle}"></span>`)
|
||||||
|
|||||||
11
plugins/precise-volume/volume-hud.css
Normal file
11
plugins/precise-volume/volume-hud.css
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#volumeHud {
|
||||||
|
z-index: 999;
|
||||||
|
position: absolute;
|
||||||
|
transition: opacity 0.6s;
|
||||||
|
pointer-events: none;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ytmusic-player[player-ui-state_="MINIPLAYER"] #volumeHud {
|
||||||
|
top: 0 !important;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user