fix: Chart playlist icon

This commit is contained in:
khanhas 2020-08-06 04:24:44 +10:00
parent 8d2a3629d4
commit 5fb3b142ed

View File

@ -21,7 +21,7 @@ waitForElement([".LeftSidebar", ".LeftSidebar__section--rootlist .SidebarList__l
if (!link || !link[0]) continue;
link = link[0];
const href = link.href.replace("app:", "");
let href = link.href.replace("app:", "");
if (href.indexOf("playlist-folder") != -1) {
const button = item.getElementsByTagName("button")[0]
@ -31,6 +31,10 @@ waitForElement([".LeftSidebar", ".LeftSidebar__section--rootlist .SidebarList__l
continue;
}
if (href.indexOf("chart") != -1) {
href = href.replace("chart:", "user:spotifycharts:playlist:");
}
Spicetify.CosmosAPI.resolver.get({
url: `sp://core-playlist/v1/playlist/${href}/metadata`,
body: { policy: { picture: true } },
@ -48,7 +52,7 @@ waitForElement([".LeftSidebar", ".LeftSidebar__section--rootlist .SidebarList__l
new MutationObserver(loadPlaylistImage)
.observe(queries[1], {childList: true});
/** Replace Apps name with icons */
/** List of avaiable icons to use:
@ -96,7 +100,7 @@ waitForElement([".LeftSidebar", ".LeftSidebar__section--rootlist .SidebarList__l
case "playlist:local-files": return "localfile";
case "stations": return "stations";
}})(item.href.replace("spotify:app:", ""));
replaceTextWithIcon(item.firstChild, icon);
});