From 8202005413171124c41e32bb02eea4414cc4ef37 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 3 Mar 2021 13:30:29 -0400 Subject: only divide ref list if official group present --- strings-default.json | 2 ++ upd8.js | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/strings-default.json b/strings-default.json index 20806a5f..10430c77 100644 --- a/strings-default.json +++ b/strings-default.json @@ -247,6 +247,8 @@ "tagPage.infoLine": "Appears in {COVER_ARTS}.", "tagPage.nav.tag": "Tag: {TAG}", "trackPage.title": "{TRACK}", + "trackPage.referenceList.fandom": "Fandom:", + "trackPage.referenceList.official": "Official:", "trackPage.nav.track": "{TRACK}", "trackPage.nav.track.withNumber": "{NUMBER}. {TRACK}", "trackPage.nav.random": "Random" diff --git a/upd8.js b/upd8.js index 8f40c45e..30545854 100755 --- a/upd8.js +++ b/upd8.js @@ -2728,9 +2728,14 @@ function writeTrackPages() { function writeTrackPage(track) { const { album } = track; + const tracksThatReference = track.referencedBy; - const ttrFanon = tracksThatReference.filter(t => t.album.groups.every(group => group.directory !== C.OFFICIAL_GROUP_DIRECTORY)); - const ttrOfficial = tracksThatReference.filter(t => t.album.groups.some(group => group.directory === C.OFFICIAL_GROUP_DIRECTORY)); + const useDividedReferences = groupData.some(group => group.directory === C.OFFICIAL_GROUP_DIRECTORY); + const ttrFanon = (useDividedReferences && + tracksThatReference.filter(t => t.album.groups.every(group => group.directory !== C.OFFICIAL_GROUP_DIRECTORY))); + const ttrOfficial = (useDividedReferences && + tracksThatReference.filter(t => t.album.groups.some(group => group.directory === C.OFFICIAL_GROUP_DIRECTORY))); + const tracksReferenced = track.references; const otherReleases = track.otherReleases; const listTag = getAlbumListTag(track.album); @@ -2865,16 +2870,19 @@ function writeTrackPage(track) { `} ${tracksThatReference.length && fixWS`

${strings('releaseInfo.tracksThatReference', {track: `${track.name}`})}

-
- ${ttrOfficial.length && fixWS` -
Official:
-
${generateTrackList(ttrOfficial, {strings, to})}
- `} - ${ttrFanon.length && fixWS` -
Fandom:
-
${generateTrackList(ttrFanon, {strings, to})}
- `} -
+ ${useDividedReferences && fixWS` +
+ ${ttrOfficial.length && fixWS` +
${strings('trackPage.referenceList.official')}
+
${generateTrackList(ttrOfficial, {strings, to})}
+ `} + ${ttrFanon.length && fixWS` +
${strings('trackPage.referenceList.fandom')}
+
${generateTrackList(ttrFanon, {strings, to})}
+ `} +
+ `} + ${!useDividedReferences && generateTrackList(tracksThatReference, {strings, to})} `} ${wikiInfo.features.flashesAndGames && flashesThatFeature.length && fixWS`

${strings('releaseInfo.flashesThatFeature', {track: `${track.name}`})}

-- cgit 1.3.0-6-gf8a5