mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Hide login elements
This commit is contained in:
@ -1,15 +1,37 @@
|
|||||||
function removeLoginElements() {
|
function removeLoginElements() {
|
||||||
const elementsToRemove = [
|
const elementsToRemove = [
|
||||||
".sign-in-link.ytmusic-nav-bar",
|
".sign-in-link.ytmusic-nav-bar",
|
||||||
'.ytmusic-pivot-bar-renderer[tab-id="FEmusic_liked"]'
|
'.ytmusic-pivot-bar-renderer[tab-id="FEmusic_liked"]',
|
||||||
];
|
];
|
||||||
|
|
||||||
elementsToRemove.forEach(selector => {
|
elementsToRemove.forEach((selector) => {
|
||||||
const node = document.querySelector(selector);
|
const node = document.querySelector(selector);
|
||||||
if (node) {
|
if (node) {
|
||||||
node.remove();
|
node.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Remove the library button
|
||||||
|
const libraryIconPath =
|
||||||
|
"M16,6v2h-2v5c0,1.1-0.9,2-2,2s-2-0.9-2-2s0.9-2,2-2c0.37,0,0.7,0.11,1,0.28V6H16z M18,20H4V6H3v15h15V20z M21,3H6v15h15V3z M7,4h13v13H7V4z";
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
menuEntries = document.querySelectorAll(
|
||||||
|
"#items ytmusic-guide-entry-renderer"
|
||||||
|
);
|
||||||
|
menuEntries.forEach((item) => {
|
||||||
|
const icon = item.querySelector("path");
|
||||||
|
if (icon) {
|
||||||
|
observer.disconnect();
|
||||||
|
if (icon.getAttribute("d") === libraryIconPath) {
|
||||||
|
item.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
observer.observe(document.documentElement, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = removeLoginElements;
|
module.exports = removeLoginElements;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
.ytmusic-pivot-bar-renderer[tab-id="FEmusic_liked"],
|
.ytmusic-pivot-bar-renderer[tab-id="FEmusic_liked"],
|
||||||
|
ytmusic-guide-signin-promo-renderer,
|
||||||
|
a[href="/music_premium"],
|
||||||
.sign-in-link {
|
.sign-in-link {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user