« get me outta code hell

reveal strings on info card art - 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 16:03:13 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-04-05 16:03:13 -0300
commitd55610a3869167c8100ceec39f36334b5395de40 (patch)
tree20da297333dfa4f54ac4b87e985ff0ed09611200 /static
parentddca239668167b34157e6dfd2ab88e6b9774db7d (diff)
reveal strings on info card art
Diffstat (limited to 'static')
-rw-r--r--static/client.js25
-rw-r--r--static/site.css3
2 files changed, 26 insertions, 2 deletions
diff --git a/static/client.js b/static/client.js
index a4fb8243..b79539e4 100644
--- a/static/client.js
+++ b/static/client.js
@@ -231,12 +231,33 @@ const infoCard = (() => {
             const albumLink = container.querySelector('.info-card-album a');
             link(albumLink, 'album', data.links.album);
 
-            const img = container.querySelector('.info-card-art');
+            const [ containerNoReveal, containerReveal ] = [
+                container.querySelector('.info-card-art-container.no-reveal'),
+                container.querySelector('.info-card-art-container.reveal')
+            ];
+
+            const [ containerShow, containerHide ] = (data.cover.warnings.length
+                ? [containerReveal, containerNoReveal]
+                : [containerNoReveal, containerReveal]);
+
+            containerHide.style.display = 'none';
+            containerShow.style.display = 'block';
+
+            const img = containerShow.querySelector('.info-card-art');
             img.src = rebase(data.cover.paths.small, 'rebaseMedia');
 
-            const imgLink = container.querySelector('.info-card-art-container a');
+            const imgLink = containerShow.querySelector('a');
             colorLink(imgLink, data.color);
             imgLink.href = rebase(data.cover.paths.original, 'rebaseMedia');
+
+            if (containerShow === containerReveal) {
+                // TODO: List localiz8tion?
+                const cw = containerShow.querySelector('.info-card-art-warnings');
+                cw.innerText = data.cover.warnings.join(', ');
+
+                const reveal = containerShow.querySelector('.reveal');
+                reveal.classList.remove('revealed');
+            }
         });
     }
 
diff --git a/static/site.css b/static/site.css
index 83bddd37..d8d20dcc 100644
--- a/static/site.css
+++ b/static/site.css
@@ -795,6 +795,9 @@ li > ul {
     width: 40%;
     margin: 5px;
     font-size: 0.8em;
+
+    /* Dynamically shown. */
+    display: none;
 }
 
 .info-card-art-container .image-container {