Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: detect the upgrade btn using the icon #2364

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

ArjixWasTaken
Copy link
Contributor

@ArjixWasTaken ArjixWasTaken commented Aug 22, 2024

Fixes: #2363

@ArjixWasTaken
Copy link
Contributor Author

Assuming the name of the icon does not change, this should not break.
But even if it does break, it defaults back to the old way of removing the button.

(unless they decide to use an entirely different icon whilst the current one, youtube_music_monochrome, is still around)

@ArjixWasTaken
Copy link
Contributor Author

ArjixWasTaken commented Aug 22, 2024

@OpenRift412 would it be too much to ask if you could test this change?

assuming you know how to run a dev build
Actually, scratch that, you can just run

const itemsSelector = 'ytmusic-guide-section-renderer #items';
let selector = 'ytmusic-guide-entry-renderer:last-child';

const upgradeBtnIcon = document.querySelector('iron-iconset-svg[name="yt-sys-icons"] #youtube_music_monochrome');
if (upgradeBtnIcon) {
  const path = upgradeBtnIcon.firstChild;
  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.textContent = `${itemsSelector} ${selector} { display: none; }`;
document.head.appendChild(styles)

in your console after visiting https://music.youtube.com on your browser
like this

image

If it doesn't remove the Library button, then all is fine.

@OpenRift412
Copy link

OpenRift412 commented Aug 22, 2024

@OpenRift412 would it be too much to ask if you could test this change?

assuming you know how to run a dev build Actually, scratch that, you can just run

const itemsSelector = 'ytmusic-guide-section-renderer #items';
let selector = 'ytmusic-guide-entry-renderer:last-child';

const upgradeBtnIcon = document.querySelector('iron-iconset-svg[name="yt-sys-icons"] #youtube_music_monochrome');
if (upgradeBtnIcon) {
  const path = upgradeBtnIcon.firstChild;
  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.textContent = `${itemsSelector} ${selector} { display: none; }`;
document.head.appendChild(styles)

in your console after visiting https://music.youtube.com on your browser like this

image

If it doesn't remove the Library button, then all is fine.

How would I run this, exactly?

@ArjixWasTaken
Copy link
Contributor Author

ArjixWasTaken commented Aug 22, 2024

Have you heard of the chrome/Firefox dev tools?

https://developer.chrome.com/docs/devtools/console/javascript

@JellyBrick JellyBrick added the bug Something isn't working label Aug 22, 2024
@JellyBrick JellyBrick merged commit c5c1914 into th-ch:master Aug 22, 2024
6 checks passed
@ArjixWasTaken ArjixWasTaken deleted the fix/upgrade-button-removal branch August 22, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Library Not Accessible from Side Menu
3 participants