mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix: detect the upgrade btn using the icon (#2364)
This commit is contained in:
@ -172,10 +172,19 @@ async function onApiLoaded() {
|
||||
|
||||
// Remove upgrade button
|
||||
if (window.mainConfig.get('options.removeUpgradeButton')) {
|
||||
const itemsSelector = 'ytmusic-guide-section-renderer #items';
|
||||
let selector = 'ytmusic-guide-entry-renderer:last-child';
|
||||
|
||||
const upgradeBtnIcon = document.querySelector<SVGGElement>('iron-iconset-svg[name="yt-sys-icons"] #youtube_music_monochrome');
|
||||
if (upgradeBtnIcon) {
|
||||
const path = upgradeBtnIcon.firstChild as SVGPathElement;
|
||||
const data = path.getAttribute('d')!.substring(0, 15);
|
||||
selector = `ytmusic-guide-entry-renderer:has(> tp-yt-paper-item > yt-icon path[d^="${data}"])`;
|
||||
}
|
||||
|
||||
const styles = document.createElement('style');
|
||||
styles.innerHTML = `ytmusic-guide-section-renderer #items ytmusic-guide-entry-renderer:last-child {
|
||||
display: none;
|
||||
}`;
|
||||
styles.textContent = `${itemsSelector} ${selector} { display: none; }`;
|
||||
|
||||
document.head.appendChild(styles);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user