« get me outta code hell

info card thumbnail & image link/color niceness - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/static
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-04-05 15:21:24 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-04-05 15:21:24 -0300
commitddca239668167b34157e6dfd2ab88e6b9774db7d (patch)
treed1d52a696ea3f236167623430dd2a81819449eb4 /static
parent643eeb01b96e7635201505ef201c60ab405bd419 (diff)
info card thumbnail & image link/color niceness
Diffstat (limited to 'static')
-rw-r--r--static/client.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/static/client.js b/static/client.js
index 60bf62b4..a4fb8243 100644
--- a/static/client.js
+++ b/static/client.js
@@ -177,11 +177,16 @@ const HIDE_HOVER_DELAY = 250;
 let fastHover = false;
 let endFastHoverTimeout = null;
 
-function link(a, type, {name, directory, color}) {
+function colorLink(a, color) {
     if (color) {
-        a.style.setProperty('--primary-color', color);
+        const { primary, dim } = C.getColors(color);
+        a.style.setProperty('--primary-color', primary);
+        a.style.setProperty('--dim-color', dim);
     }
+}
 
+function link(a, type, {name, directory, color}) {
+    colorLink(a, color);
     a.innerText = name
     a.href = getLinkHref(type, directory);
 }
@@ -227,7 +232,11 @@ const infoCard = (() => {
             link(albumLink, 'album', data.links.album);
 
             const img = container.querySelector('.info-card-art');
-            img.src = rebase(data.cover.path, 'rebaseMedia');
+            img.src = rebase(data.cover.paths.small, 'rebaseMedia');
+
+            const imgLink = container.querySelector('.info-card-art-container a');
+            colorLink(imgLink, data.color);
+            imgLink.href = rebase(data.cover.paths.original, 'rebaseMedia');
         });
     }