mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
fixes scrollbar position relative to navbar depending on player-page-open
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
const { remote, ipcRenderer } = require("electron");
|
const { remote, ipcRenderer } = require("electron");
|
||||||
|
|
||||||
const customTitlebar = require("custom-electron-titlebar");
|
const customTitlebar = require("custom-electron-titlebar");
|
||||||
|
function $(selector) { return document.querySelector(selector); }
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
const bar = new customTitlebar.Titlebar({
|
const bar = new customTitlebar.Titlebar({
|
||||||
@ -13,4 +14,19 @@ module.exports = () => {
|
|||||||
ipcRenderer.on("updateMenu", function (_event, showMenu) {
|
ipcRenderer.on("updateMenu", function (_event, showMenu) {
|
||||||
bar.updateMenu(showMenu ? remote.Menu.getApplicationMenu() : null);
|
bar.updateMenu(showMenu ? remote.Menu.getApplicationMenu() : null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Increases the right margin of Navbar background when the scrollbar is visible to avoid blocking it (z-index doesn't affect it)
|
||||||
|
document.addEventListener('apiLoaded', () => {
|
||||||
|
setNavbarMargin()
|
||||||
|
const playPageObserver = new MutationObserver(() => {
|
||||||
|
setNavbarMargin();
|
||||||
|
});
|
||||||
|
playPageObserver.observe($('ytmusic-app-layout'), { attributeFilter: ['player-page-open_', 'playerPageOpen_'] })
|
||||||
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function setNavbarMargin() {
|
||||||
|
$('ytmusic-app-layout').playerPageOpen_ ?
|
||||||
|
$('#nav-bar-background').style.right = '0px' :
|
||||||
|
$('#nav-bar-background').style.right = '12px';
|
||||||
|
}
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
font-size: 14px !important;
|
font-size: 14px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fixes scrollbar positioning relative to nav bar + its opacity */
|
/* fixes nav-bar-background opacity bug and allows clicking scrollbar through it */
|
||||||
#nav-bar-background {
|
#nav-bar-background {
|
||||||
right: 15px !important;
|
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove window dragging for nav bar (conflict with titlebar drag) */
|
/* remove window dragging for nav bar (conflict with titlebar drag) */
|
||||||
|
|||||||
Reference in New Issue
Block a user