mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
fix(in-app-menu): remove unused observer
This commit is contained in:
@ -7,9 +7,6 @@ import { createPanel } from './menu/panel';
|
||||
import { ElementFromFile } from '../utils';
|
||||
import { isEnabled } from '../../config/plugins';
|
||||
|
||||
type ElectronCSSStyleDeclaration = CSSStyleDeclaration & { webkitAppRegion: 'drag' | 'no-drag' };
|
||||
type ElectronHTMLElement = HTMLElement & { style: ElectronCSSStyleDeclaration };
|
||||
|
||||
function $<E extends Element = Element>(selector: string) {
|
||||
return document.querySelector<E>(selector);
|
||||
}
|
||||
@ -68,7 +65,6 @@ export default () => {
|
||||
|
||||
// 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', () => {
|
||||
setupSearchOpenObserver();
|
||||
const htmlHeadStyle = $('head > div > style');
|
||||
if (htmlHeadStyle) {
|
||||
// HACK: This is a hack to remove the scrollbar width
|
||||
@ -76,16 +72,3 @@ export default () => {
|
||||
}
|
||||
}, { once: true, passive: true });
|
||||
};
|
||||
|
||||
function setupSearchOpenObserver() {
|
||||
const searchOpenObserver = new MutationObserver((mutations) => {
|
||||
const navBarBackground = $<ElectronHTMLElement>('#nav-bar-background');
|
||||
if (navBarBackground) {
|
||||
navBarBackground.style.webkitAppRegion = (mutations[0].target as HTMLElement & { opened: boolean }).opened ? 'no-drag' : 'drag';
|
||||
}
|
||||
});
|
||||
const searchBox = $('ytmusic-search-box');
|
||||
if (searchBox) {
|
||||
searchOpenObserver.observe(searchBox, { attributeFilter: ['opened'] });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user