« get me outta code hell

content, css: always control offset-tooltip effect from content - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-11-04 09:30:41 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-11-04 09:30:41 -0400
commitdfc3fc5290cd73c3232a05c0cc6dd1edb4ed1477 (patch)
tree9e6ba78a72f92179e1f8b4464e1675c02b9aae48 /src
parentd3b56134bc051f4786c60991da40346227dc65eb (diff)
content, css: always control offset-tooltip effect from content
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateArtistInfoPageTracksChunk.js35
-rw-r--r--src/content/dependencies/generateContributionList.js3
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js3
-rw-r--r--src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js3
-rw-r--r--src/static/css/site.css3
5 files changed, 42 insertions, 5 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunk.js b/src/content/dependencies/generateArtistInfoPageTracksChunk.js
index ed3177b1..7d00fdd6 100644
--- a/src/content/dependencies/generateArtistInfoPageTracksChunk.js
+++ b/src/content/dependencies/generateArtistInfoPageTracksChunk.js
@@ -1,4 +1,5 @@
-import {unique} from '#sugar';
+import {sortAlbumsTracksChronologically} from '#sort';
+import {empty, unique} from '#sugar';
 import {getTotalDuration} from '#wiki-data';
 
 export default {
@@ -18,7 +19,7 @@ export default {
           trackContribs)),
   }),
 
-  data(_artist, album, trackContribLists) {
+  data(artist, album, trackContribLists) {
     const data = {};
 
     const contribs =
@@ -43,6 +44,30 @@ export default {
     data.durationApproximate =
       durationTerms.length > 1;
 
+    const tracks =
+      trackContribLists.map(contribs => contribs[0].thing);
+
+    data.numLinkingOtherReleases =
+      tracks.filter(track => {
+        if (empty(track.otherReleases)) return false;
+
+        const releases =
+          sortAlbumsTracksChronologically(track.allReleases.slice());
+
+        // later releases always link to first release
+        if (track !== releases[0]) return true;
+
+        // first releases only link to later credited releases
+        return tracks.slice(1).some(track => {
+          const contribs = [
+            ...track.artistContribs,
+            ...track.contributorContribs,
+          ];
+
+          return contribs.some(contrib => contrib.artist === artist);
+        });
+      }).length;
+
     return data;
   },
 
@@ -56,6 +81,10 @@ export default {
       durationApproximate: data.durationApproximate,
 
       list:
-        html.tag('ul', relations.items),
+        html.tag('ul',
+          data.numLinkingOtherReleases > 1 &&
+            {class: 'offset-tooltips'},
+
+          relations.items),
     }),
 };
diff --git a/src/content/dependencies/generateContributionList.js b/src/content/dependencies/generateContributionList.js
index 3716bcd6..fa9e3d70 100644
--- a/src/content/dependencies/generateContributionList.js
+++ b/src/content/dependencies/generateContributionList.js
@@ -13,6 +13,9 @@ export default {
     html.tag('ul',
       {[html.onlyIfContent]: true},
 
+      relations.contributionLinks.length > 1 &&
+        {class: 'offset-tooltips'},
+
       relations.contributionLinks
         .map(contributionLink =>
           html.tag('li',
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js b/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js
index de55f33a..c295ab86 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListByDate.js
@@ -35,6 +35,9 @@ export default {
 
       slots.hidden && {style: 'display: none'},
 
+      relations.items.length > 1&&
+        {class: 'offset-tooltips'},
+
       {[html.onlyIfContent]: true},
 
       relations.items
diff --git a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
index 6bbee03a..0743e66e 100644
--- a/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
+++ b/src/content/dependencies/generateGroupInfoPageAlbumsListBySeries.js
@@ -48,6 +48,9 @@ export default {
         {id: 'group-album-list-by-series'},
         {class: 'group-series-list'},
 
+        relations.seriesItems.flat().length > 1 &&
+          {class: 'offset-tooltips'},
+
         {[html.onlyIfContent]: true},
 
         stitchArrays({
diff --git a/src/static/css/site.css b/src/static/css/site.css
index ef3ffe8e..e1654e6d 100644
--- a/src/static/css/site.css
+++ b/src/static/css/site.css
@@ -1261,8 +1261,7 @@ label > input[type=checkbox]:not(:checked) + span {
   font-size: 0.9rem;
 }
 
-li:not(:first-child:last-child) .tooltip:where(:not(.cover-artwork .tooltip)),
-.offset-tooltips > :not(:first-child:last-child) .tooltip {
+.offset-tooltips .tooltip {
   left: 14px;
 }