From d7a399bf29eb275876f9ea551c173fe76356b04d Mon Sep 17 00:00:00 2001 From: Nam Anh Date: Thu, 21 Jul 2022 20:30:07 +0700 Subject: [PATCH] fix(Dribbblish): playlist icon fallback (#806) --- Dribbblish/dribbblish.js | 11 +++++++++-- Dribbblish/images/tracklist-row-song-fallback.svg | 1 + Dribbblish/user.css | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 Dribbblish/images/tracklist-row-song-fallback.svg diff --git a/Dribbblish/dribbblish.js b/Dribbblish/dribbblish.js index b5d059f..691a229 100644 --- a/Dribbblish/dribbblish.js +++ b/Dribbblish/dribbblish.js @@ -34,6 +34,13 @@ function waitForElement(els, func, timeout = 100) { } } +// Avoid clipping playlists at the bottom of scroll node +waitForElement([".main-rootlist-wrapper"], () => { + const mainRootlist = document.querySelector(".main-rootlist-wrapper"); + const playListItems = document.getElementsByClassName("main-rootlist-rootlistItemLink") + mainRootlist.style.height = `${playListItems.length * 56}px`; +}); + waitForElement([ `ul[tabindex="0"]`, `ul[tabindex="0"] .GlueDropTarget--playlists.GlueDropTarget--folders` @@ -59,7 +66,7 @@ waitForElement([ img.classList.add("playlist-picture"); link.prepend(img); } - img.src = base64 || "/images/tracklist-row-song-fallback.svg"; + img.src = base64 || "https://cdn.jsdelivr.net/gh/spicetify/spicetify-themes@master/Dribbblish/images/tracklist-row-song-fallback.svg"; continue; } @@ -74,7 +81,7 @@ waitForElement([ img.classList.add("playlist-picture"); link.prepend(img); } - img.src = meta.picture || "/images/tracklist-row-song-fallback.svg"; + img.src = meta.picture || "https://cdn.jsdelivr.net/gh/spicetify/spicetify-themes@master/Dribbblish/images/tracklist-row-song-fallback.svg"; }); } } diff --git a/Dribbblish/images/tracklist-row-song-fallback.svg b/Dribbblish/images/tracklist-row-song-fallback.svg new file mode 100644 index 0000000..40980a7 --- /dev/null +++ b/Dribbblish/images/tracklist-row-song-fallback.svg @@ -0,0 +1 @@ +Playlist Icon \ No newline at end of file diff --git a/Dribbblish/user.css b/Dribbblish/user.css index 7ad49e8..0ee9810 100644 --- a/Dribbblish/user.css +++ b/Dribbblish/user.css @@ -503,6 +503,12 @@ img.playlist-picture { border-radius: 50%; } +img.playlist-picture[src$=".svg"] { + width: 24px; + height: 24px; + border-radius: 0; +} + .main-rootlist-rootlistItem a span { margin-left: 24px; }