feat(downloader): Add context menu button for playlists and albums (#3768)

Co-authored-by: JellyBrick <shlee1503@naver.com>
This commit is contained in:
Suffocate
2025-09-06 01:12:24 +01:00
committed by GitHub
parent f8654dfdb9
commit 555817e2f5
2 changed files with 23 additions and 2 deletions

View File

@ -22,6 +22,24 @@ export const isMusicOrVideoTrack = () => {
return false;
};
export const isAlbumOrPlaylist = () => {
for (const menuSelector of document.querySelectorAll<
HTMLAnchorElement & {
data: {
addToPlaylistEndpoint: {
playlistId: string;
};
clickTrackingParams: string;
};
}
>('tp-yt-paper-listbox #navigation-endpoint')) {
if (menuSelector?.data?.addToPlaylistEndpoint?.playlistId) {
return true;
}
}
return false;
};
export const isPlayerMenu = (menu?: HTMLElement | null) => {
return (
menu?.parentElement as