diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-13 09:02:54 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-31 12:11:52 -0300 |
commit | 1b399c2451b222597bf734dbf8a211e8b421fe07 (patch) | |
tree | 8e5d3fcbf5c3a517c53bd82f5ef7af6f339409d1 /src/static/js | |
parent | 5038549631b0413552fe6589e7c77f66e53e7bcd (diff) |
search, client: refactor & simplify search result image processing
Diffstat (limited to 'src/static/js')
-rw-r--r-- | src/static/js/client.js | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/src/static/js/client.js b/src/static/js/client.js index 771d2011..bee82938 100644 --- a/src/static/js/client.js +++ b/src/static/js/client.js @@ -3862,36 +3862,12 @@ function generateSidebarSearchResult(result) { function getSearchResultImageSource(result) { const {artwork} = result.data; - if (!artwork) return null; - const [kind, ...opts] = artwork; - - switch (kind) { - case 'flash': - return rebase( - ('flash-art' - + `/${result.directory}.small.jpg`), - 'rebaseThumb'); - - case 'track': - return rebase( - (`album-art` - + `/${opts[0]}` - + `/${result.directory}` - + `.small.jpg`), - 'rebaseThumb'); - - case 'track-album': - return rebase( - (`album-art` - + `/${opts[0]}` - + `/cover.small.jpg`), - 'rebaseThumb'); - - default: - return null; - } + return ( + rebase( + artwork.replace('<>', result.directory), + 'rebaseThumb')); } function generateSidebarSearchResultTemplate(slots) { |