diff options
Diffstat (limited to 'src/listing-spec.js')
-rw-r--r-- | src/listing-spec.js | 500 |
1 files changed, 250 insertions, 250 deletions
diff --git a/src/listing-spec.js b/src/listing-spec.js index f561cef4..d5341a57 100644 --- a/src/listing-spec.js +++ b/src/listing-spec.js @@ -1,6 +1,6 @@ -// @format +/** @format */ -import fixWS from "fix-whitespace"; +import fixWS from 'fix-whitespace'; import { chunkByProperties, @@ -8,55 +8,55 @@ import { getTotalDuration, sortAlphabetically, sortChronologically, -} from "./util/wiki-data.js"; +} from './util/wiki-data.js'; const listingSpec = [ { - directory: "albums/by-name", - stringsKey: "listAlbums.byName", + directory: 'albums/by-name', + stringsKey: 'listAlbums.byName', - data({ wikiData }) { + data({wikiData}) { return sortAlphabetically(wikiData.albumData.slice()); }, - row(album, { link, language }) { - return language.$("listingPage.listAlbums.byName.item", { + row(album, {link, language}) { + return language.$('listingPage.listAlbums.byName.item', { album: link.album(album), - tracks: language.countTracks(album.tracks.length, { unit: true }), + tracks: language.countTracks(album.tracks.length, {unit: true}), }); }, }, { - directory: "albums/by-tracks", - stringsKey: "listAlbums.byTracks", + directory: 'albums/by-tracks', + stringsKey: 'listAlbums.byTracks', - data({ wikiData }) { + data({wikiData}) { return wikiData.albumData .slice() .sort((a, b) => b.tracks.length - a.tracks.length); }, - row(album, { link, language }) { - return language.$("listingPage.listAlbums.byTracks.item", { + row(album, {link, language}) { + return language.$('listingPage.listAlbums.byTracks.item', { album: link.album(album), - tracks: language.countTracks(album.tracks.length, { unit: true }), + tracks: language.countTracks(album.tracks.length, {unit: true}), }); }, }, { - directory: "albums/by-duration", - stringsKey: "listAlbums.byDuration", + directory: 'albums/by-duration', + stringsKey: 'listAlbums.byDuration', - data({ wikiData }) { + data({wikiData}) { return wikiData.albumData - .map((album) => ({ album, duration: getTotalDuration(album.tracks) })) + .map((album) => ({album, duration: getTotalDuration(album.tracks)})) .sort((a, b) => b.duration - a.duration); }, - row({ album, duration }, { link, language }) { - return language.$("listingPage.listAlbums.byDuration.item", { + row({album, duration}, {link, language}) { + return language.$('listingPage.listAlbums.byDuration.item', { album: link.album(album), duration: language.formatDuration(duration), }); @@ -64,17 +64,17 @@ const listingSpec = [ }, { - directory: "albums/by-date", - stringsKey: "listAlbums.byDate", + directory: 'albums/by-date', + stringsKey: 'listAlbums.byDate', - data({ wikiData }) { + data({wikiData}) { return sortChronologically( wikiData.albumData.filter((album) => album.date) ); }, - row(album, { link, language }) { - return language.$("listingPage.listAlbums.byDate.item", { + row(album, {link, language}) { + return language.$('listingPage.listAlbums.byDate.item', { album: link.album(album), date: language.formatDate(album.date), }); @@ -82,10 +82,10 @@ const listingSpec = [ }, { - directory: "albums/by-date-added", - stringsKey: "listAlbums.byDateAdded", + directory: 'albums/by-date-added', + stringsKey: 'listAlbums.byDateAdded', - data({ wikiData }) { + data({wikiData}) { return chunkByProperties( wikiData.albumData .filter((a) => a.dateAddedToWiki) @@ -93,18 +93,18 @@ const listingSpec = [ if (a.dateAddedToWiki < b.dateAddedToWiki) return -1; if (a.dateAddedToWiki > b.dateAddedToWiki) return 1; }), - ["dateAddedToWiki"] + ['dateAddedToWiki'] ); }, - html(chunks, { link, language }) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks .map( - ({ dateAddedToWiki, chunk: albums }) => fixWS` + ({dateAddedToWiki, chunk: albums}) => fixWS` <dt>${language.$( - "listingPage.listAlbums.byDateAdded.date", + 'listingPage.listAlbums.byDateAdded.date', { date: language.formatDate(dateAddedToWiki), } @@ -113,36 +113,36 @@ const listingSpec = [ ${albums .map((album) => language.$( - "listingPage.listAlbums.byDateAdded.album", + 'listingPage.listAlbums.byDateAdded.album', { album: link.album(album), } ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul></dd> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "artists/by-name", - stringsKey: "listArtists.byName", + directory: 'artists/by-name', + stringsKey: 'listArtists.byName', - data({ wikiData }) { + data({wikiData}) { return sortAlphabetically(wikiData.artistData.slice()).map((artist) => ({ artist, contributions: getArtistNumContributions(artist), })); }, - row({ artist, contributions }, { link, language }) { - return language.$("listingPage.listArtists.byName.item", { + row({artist, contributions}, {link, language}) { + return language.$('listingPage.listArtists.byName.item', { artist: link.artist(artist), contributions: language.countContributions(contributions, { unit: true, @@ -152,10 +152,10 @@ const listingSpec = [ }, { - directory: "artists/by-contribs", - stringsKey: "listArtists.byContribs", + directory: 'artists/by-contribs', + stringsKey: 'listArtists.byContribs', - data({ wikiData }) { + data({wikiData}) { return { toTracks: wikiData.artistData .map((artist) => ({ @@ -165,7 +165,7 @@ const listingSpec = [ (artist.tracksAsArtist?.length ?? 0), })) .sort((a, b) => b.contributions - a.contributions) - .filter(({ contributions }) => contributions), + .filter(({contributions}) => contributions), toArtAndFlashes: wikiData.artistData .map((artist) => ({ @@ -180,7 +180,7 @@ const listingSpec = [ : 0), })) .sort((a, b) => b.contributions - a.contributions) - .filter(({ contributions }) => contributions), + .filter(({contributions}) => contributions), // This is a kinda naughty hack, 8ut like, it's the only place // we'd 8e passing wikiData to html() otherwise, so like.... @@ -189,54 +189,54 @@ const listingSpec = [ }; }, - html({ toTracks, toArtAndFlashes, showAsFlashes }, { link, language }) { + html({toTracks, toArtAndFlashes, showAsFlashes}, {link, language}) { return fixWS` <div class="content-columns"> <div class="column"> <h2>${language.$( - "listingPage.misc.trackContributors" + 'listingPage.misc.trackContributors' )}</h2> <ul> ${toTracks - .map(({ artist, contributions }) => + .map(({artist, contributions}) => language.$( - "listingPage.listArtists.byContribs.item", + 'listingPage.listArtists.byContribs.item', { artist: link.artist(artist), contributions: language.countContributions( contributions, - { unit: true } + {unit: true} ), } ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul> </div> <div class="column"> <h2>${language.$( - "listingPage.misc" + + 'listingPage.misc' + (showAsFlashes - ? ".artAndFlashContributors" - : ".artContributors") + ? '.artAndFlashContributors' + : '.artContributors') )}</h2> <ul> ${toArtAndFlashes - .map(({ artist, contributions }) => + .map(({artist, contributions}) => language.$( - "listingPage.listArtists.byContribs.item", + 'listingPage.listArtists.byContribs.item', { artist: link.artist(artist), contributions: language.countContributions( contributions, - { unit: true } + {unit: true} ), } ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul> </div> </div> @@ -245,10 +245,10 @@ const listingSpec = [ }, { - directory: "artists/by-commentary", - stringsKey: "listArtists.byCommentary", + directory: 'artists/by-commentary', + stringsKey: 'listArtists.byCommentary', - data({ wikiData }) { + data({wikiData}) { return wikiData.artistData .map((artist) => ({ artist, @@ -256,23 +256,23 @@ const listingSpec = [ (artist.tracksAsCommentator?.length ?? 0) + (artist.albumsAsCommentator?.length ?? 0), })) - .filter(({ entries }) => entries) + .filter(({entries}) => entries) .sort((a, b) => b.entries - a.entries); }, - row({ artist, entries }, { link, language }) { - return language.$("listingPage.listArtists.byCommentary.item", { + row({artist, entries}, {link, language}) { + return language.$('listingPage.listArtists.byCommentary.item', { artist: link.artist(artist), - entries: language.countCommentaryEntries(entries, { unit: true }), + entries: language.countCommentaryEntries(entries, {unit: true}), }); }, }, { - directory: "artists/by-duration", - stringsKey: "listArtists.byDuration", + directory: 'artists/by-duration', + stringsKey: 'listArtists.byDuration', - data({ wikiData }) { + data({wikiData}) { return wikiData.artistData .map((artist) => ({ artist, @@ -281,12 +281,12 @@ const listingSpec = [ ...(artist.tracksAsContributor ?? []), ]), })) - .filter(({ duration }) => duration > 0) + .filter(({duration}) => duration > 0) .sort((a, b) => b.duration - a.duration); }, - row({ artist, duration }, { link, language }) { - return language.$("listingPage.listArtists.byDuration.item", { + row({artist, duration}, {link, language}) { + return language.$('listingPage.listArtists.byDuration.item', { artist: link.artist(artist), duration: language.formatDuration(duration), }); @@ -294,10 +294,10 @@ const listingSpec = [ }, { - directory: "artists/by-latest", - stringsKey: "listArtists.byLatest", + directory: 'artists/by-latest', + stringsKey: 'listArtists.byLatest', - data({ wikiData }) { + data({wikiData}) { const reversedTracks = sortChronologically( wikiData.trackData.filter((t) => t.date) ).reverse(); @@ -318,10 +318,10 @@ const listingSpec = [ [ ...(track.artistContribs ?? []), ...(track.contributorContribs ?? []), - ].some(({ who }) => who === artist) + ].some(({who}) => who === artist) )?.date, })) - .filter(({ date }) => date) + .filter(({date}) => date) ).reverse(), toArtAndFlashes: sortChronologically( @@ -331,7 +331,7 @@ const listingSpec = [ [ ...(thing.coverArtistContribs ?? []), ...((!thing.album && thing.contributorContribs) || []), - ].some(({ who }) => who === artist) + ].some(({who}) => who === artist) ); return ( thing && { @@ -339,7 +339,7 @@ const listingSpec = [ directory: artist.directory, name: artist.name, date: thing.coverArtistContribs?.some( - ({ who }) => who === artist + ({who}) => who === artist ) ? thing.coverArtDate : thing.date, @@ -357,18 +357,18 @@ const listingSpec = [ }; }, - html({ toTracks, toArtAndFlashes, showAsFlashes }, { link, language }) { + html({toTracks, toArtAndFlashes, showAsFlashes}, {link, language}) { return fixWS` <div class="content-columns"> <div class="column"> <h2>${language.$( - "listingPage.misc.trackContributors" + 'listingPage.misc.trackContributors' )}</h2> <ul> ${toTracks - .map(({ artist, date }) => + .map(({artist, date}) => language.$( - "listingPage.listArtists.byLatest.item", + 'listingPage.listArtists.byLatest.item', { artist: link.artist(artist), date: language.formatDate(date), @@ -376,21 +376,21 @@ const listingSpec = [ ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul> </div> <div class="column"> <h2>${language.$( - "listingPage.misc" + + 'listingPage.misc' + (showAsFlashes - ? ".artAndFlashContributors" - : ".artContributors") + ? '.artAndFlashContributors' + : '.artContributors') )}</h2> <ul> ${toArtAndFlashes - .map(({ artist, date }) => + .map(({artist, date}) => language.$( - "listingPage.listArtists.byLatest.item", + 'listingPage.listArtists.byLatest.item', { artist: link.artist(artist), date: language.formatDate(date), @@ -398,7 +398,7 @@ const listingSpec = [ ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul> </div> </div> @@ -407,35 +407,35 @@ const listingSpec = [ }, { - directory: "groups/by-name", - stringsKey: "listGroups.byName", - condition: ({ wikiData }) => wikiData.wikiInfo.enableGroupUI, - data: ({ wikiData }) => sortAlphabetically(wikiData.groupData.slice()), + directory: 'groups/by-name', + stringsKey: 'listGroups.byName', + condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, + data: ({wikiData}) => sortAlphabetically(wikiData.groupData.slice()), - row(group, { link, language }) { - return language.$("listingPage.listGroups.byCategory.group", { + row(group, {link, language}) { + return language.$('listingPage.listGroups.byCategory.group', { group: link.groupInfo(group), gallery: link.groupGallery(group, { - text: language.$("listingPage.listGroups.byCategory.group.gallery"), + text: language.$('listingPage.listGroups.byCategory.group.gallery'), }), }); }, }, { - directory: "groups/by-category", - stringsKey: "listGroups.byCategory", - condition: ({ wikiData }) => wikiData.wikiInfo.enableGroupUI, - data: ({ wikiData }) => wikiData.groupCategoryData, + directory: 'groups/by-category', + stringsKey: 'listGroups.byCategory', + condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, + data: ({wikiData}) => wikiData.groupCategoryData, - html(groupCategoryData, { link, language }) { + html(groupCategoryData, {link, language}) { return fixWS` <dl> ${groupCategoryData .map( (category) => fixWS` <dt>${language.$( - "listingPage.listGroups.byCategory.category", + 'listingPage.listGroups.byCategory.category', { category: link.groupInfo(category.groups[0], { text: category.name, @@ -446,53 +446,53 @@ const listingSpec = [ ${category.groups .map((group) => language.$( - "listingPage.listGroups.byCategory.group", + 'listingPage.listGroups.byCategory.group', { group: link.groupInfo(group), gallery: link.groupGallery(group, { text: language.$( - "listingPage.listGroups.byCategory.group.gallery" + 'listingPage.listGroups.byCategory.group.gallery' ), }), } ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul></dd> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "groups/by-albums", - stringsKey: "listGroups.byAlbums", - condition: ({ wikiData }) => wikiData.wikiInfo.enableGroupUI, + directory: 'groups/by-albums', + stringsKey: 'listGroups.byAlbums', + condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, - data({ wikiData }) { + data({wikiData}) { return wikiData.groupData - .map((group) => ({ group, albums: group.albums.length })) + .map((group) => ({group, albums: group.albums.length})) .sort((a, b) => b.albums - a.albums); }, - row({ group, albums }, { link, language }) { - return language.$("listingPage.listGroups.byAlbums.item", { + row({group, albums}, {link, language}) { + return language.$('listingPage.listGroups.byAlbums.item', { group: link.groupInfo(group), - albums: language.countAlbums(albums, { unit: true }), + albums: language.countAlbums(albums, {unit: true}), }); }, }, { - directory: "groups/by-tracks", - stringsKey: "listGroups.byTracks", - condition: ({ wikiData }) => wikiData.wikiInfo.enableGroupUI, + directory: 'groups/by-tracks', + stringsKey: 'listGroups.byTracks', + condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, - data({ wikiData }) { + data({wikiData}) { return wikiData.groupData .map((group) => ({ group, @@ -504,20 +504,20 @@ const listingSpec = [ .sort((a, b) => b.tracks - a.tracks); }, - row({ group, tracks }, { link, language }) { - return language.$("listingPage.listGroups.byTracks.item", { + row({group, tracks}, {link, language}) { + return language.$('listingPage.listGroups.byTracks.item', { group: link.groupInfo(group), - tracks: language.countTracks(tracks, { unit: true }), + tracks: language.countTracks(tracks, {unit: true}), }); }, }, { - directory: "groups/by-duration", - stringsKey: "listGroups.byDuration", - condition: ({ wikiData }) => wikiData.wikiInfo.enableGroupUI, + directory: 'groups/by-duration', + stringsKey: 'listGroups.byDuration', + condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, - data({ wikiData }) { + data({wikiData}) { return wikiData.groupData .map((group) => ({ group, @@ -528,8 +528,8 @@ const listingSpec = [ .sort((a, b) => b.duration - a.duration); }, - row({ group, duration }, { link, language }) { - return language.$("listingPage.listGroups.byDuration.item", { + row({group, duration}, {link, language}) { + return language.$('listingPage.listGroups.byDuration.item', { group: link.groupInfo(group), duration: language.formatDuration(duration), }); @@ -537,11 +537,11 @@ const listingSpec = [ }, { - directory: "groups/by-latest-album", - stringsKey: "listGroups.byLatest", - condition: ({ wikiData }) => wikiData.wikiInfo.enableGroupUI, + directory: 'groups/by-latest-album', + stringsKey: 'listGroups.byLatest', + condition: ({wikiData}) => wikiData.wikiInfo.enableGroupUI, - data({ wikiData }) { + data({wikiData}) { return sortChronologically( wikiData.groupData .map((group) => { @@ -572,8 +572,8 @@ const listingSpec = [ ).reverse(); }, - row({ group, date }, { link, language }) { - return language.$("listingPage.listGroups.byLatest.item", { + row({group, date}, {link, language}) { + return language.$('listingPage.listGroups.byLatest.item', { group: link.groupInfo(group), date: language.formatDate(date), }); @@ -581,33 +581,33 @@ const listingSpec = [ }, { - directory: "tracks/by-name", - stringsKey: "listTracks.byName", + directory: 'tracks/by-name', + stringsKey: 'listTracks.byName', - data({ wikiData }) { + data({wikiData}) { return sortAlphabetically(wikiData.trackData.slice()); }, - row(track, { link, language }) { - return language.$("listingPage.listTracks.byName.item", { + row(track, {link, language}) { + return language.$('listingPage.listTracks.byName.item', { track: link.track(track), }); }, }, { - directory: "tracks/by-album", - stringsKey: "listTracks.byAlbum", - data: ({ wikiData }) => wikiData.albumData, + directory: 'tracks/by-album', + stringsKey: 'listTracks.byAlbum', + data: ({wikiData}) => wikiData.albumData, - html(albumData, { link, language }) { + html(albumData, {link, language}) { return fixWS` <dl> ${albumData .map( (album) => fixWS` <dt>${language.$( - "listingPage.listTracks.byAlbum.album", + 'listingPage.listTracks.byAlbum.album', { album: link.album(album), } @@ -616,42 +616,42 @@ const listingSpec = [ ${album.tracks .map((track) => language.$( - "listingPage.listTracks.byAlbum.track", + 'listingPage.listTracks.byAlbum.track', { track: link.track(track), } ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ol></dd> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "tracks/by-date", - stringsKey: "listTracks.byDate", + directory: 'tracks/by-date', + stringsKey: 'listTracks.byDate', - data({ wikiData }) { + data({wikiData}) { return chunkByProperties( sortChronologically(wikiData.trackData.filter((t) => t.date)), - ["album", "date"] + ['album', 'date'] ); }, - html(chunks, { link, language }) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks .map( - ({ album, date, chunk: tracks }) => fixWS` + ({album, date, chunk: tracks}) => fixWS` <dt>${language.$( - "listingPage.listTracks.byDate.album", + 'listingPage.listTracks.byDate.album', { album: link.album(album), date: language.formatDate(date), @@ -662,41 +662,41 @@ const listingSpec = [ .map((track) => track.aka ? `<li class="rerelease">${language.$( - "listingPage.listTracks.byDate.track.rerelease", + 'listingPage.listTracks.byDate.track.rerelease', { track: link.track(track), } )}</li>` : `<li>${language.$( - "listingPage.listTracks.byDate.track", + 'listingPage.listTracks.byDate.track', { track: link.track(track), } )}</li>` ) - .join("\n")} + .join('\n')} </ul></dd> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "tracks/by-duration", - stringsKey: "listTracks.byDuration", + directory: 'tracks/by-duration', + stringsKey: 'listTracks.byDuration', - data({ wikiData }) { + data({wikiData}) { return wikiData.trackData - .map((track) => ({ track, duration: track.duration })) - .filter(({ duration }) => duration > 0) + .map((track) => ({track, duration: track.duration})) + .filter(({duration}) => duration > 0) .sort((a, b) => b.duration - a.duration); }, - row({ track, duration }, { link, language }) { - return language.$("listingPage.listTracks.byDuration.item", { + row({track, duration}, {link, language}) { + return language.$('listingPage.listTracks.byDuration.item', { track: link.track(track), duration: language.formatDuration(duration), }); @@ -704,10 +704,10 @@ const listingSpec = [ }, { - directory: "tracks/by-duration-in-album", - stringsKey: "listTracks.byDurationInAlbum", + directory: 'tracks/by-duration-in-album', + stringsKey: 'listTracks.byDurationInAlbum', - data({ wikiData }) { + data({wikiData}) { return wikiData.albumData.map((album) => ({ album, tracks: album.tracks @@ -716,14 +716,14 @@ const listingSpec = [ })); }, - html(albums, { link, language }) { + html(albums, {link, language}) { return fixWS` <dl> ${albums .map( - ({ album, tracks }) => fixWS` + ({album, tracks}) => fixWS` <dt>${language.$( - "listingPage.listTracks.byDurationInAlbum.album", + 'listingPage.listTracks.byDurationInAlbum.album', { album: link.album(album), } @@ -732,7 +732,7 @@ const listingSpec = [ ${tracks .map((track) => language.$( - "listingPage.listTracks.byDurationInAlbum.track", + 'listingPage.listTracks.byDurationInAlbum.track', { track: link.track(track), duration: language.formatDuration( @@ -742,32 +742,32 @@ const listingSpec = [ ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </dd></ul> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "tracks/by-times-referenced", - stringsKey: "listTracks.byTimesReferenced", + directory: 'tracks/by-times-referenced', + stringsKey: 'listTracks.byTimesReferenced', - data({ wikiData }) { + data({wikiData}) { return wikiData.trackData .map((track) => ({ track, timesReferenced: track.referencedByTracks.length, })) - .filter(({ timesReferenced }) => timesReferenced > 0) + .filter(({timesReferenced}) => timesReferenced > 0) .sort((a, b) => b.timesReferenced - a.timesReferenced); }, - row({ track, timesReferenced }, { link, language }) { - return language.$("listingPage.listTracks.byTimesReferenced.item", { + row({track, timesReferenced}, {link, language}) { + return language.$('listingPage.listTracks.byTimesReferenced.item', { track: link.track(track), timesReferenced: language.countTimesReferenced(timesReferenced, { unit: true, @@ -777,25 +777,25 @@ const listingSpec = [ }, { - directory: "tracks/in-flashes/by-album", - stringsKey: "listTracks.inFlashes.byAlbum", - condition: ({ wikiData }) => wikiData.wikiInfo.enableFlashesAndGames, + directory: 'tracks/in-flashes/by-album', + stringsKey: 'listTracks.inFlashes.byAlbum', + condition: ({wikiData}) => wikiData.wikiInfo.enableFlashesAndGames, - data({ wikiData }) { + data({wikiData}) { return chunkByProperties( wikiData.trackData.filter((t) => t.featuredInFlashes?.length > 0), - ["album"] + ['album'] ); }, - html(chunks, { link, language }) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks .map( - ({ album, chunk: tracks }) => fixWS` + ({album, chunk: tracks}) => fixWS` <dt>${language.$( - "listingPage.listTracks.inFlashes.byAlbum.album", + 'listingPage.listTracks.inFlashes.byAlbum.album', { album: link.album(album), date: language.formatDate(album.date), @@ -805,7 +805,7 @@ const listingSpec = [ ${tracks .map((track) => language.$( - "listingPage.listTracks.inFlashes.byAlbum.track", + 'listingPage.listTracks.inFlashes.byAlbum.track', { track: link.track(track), flashes: language.formatConjunctionList( @@ -815,30 +815,30 @@ const listingSpec = [ ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </dd></ul> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "tracks/in-flashes/by-flash", - stringsKey: "listTracks.inFlashes.byFlash", - condition: ({ wikiData }) => wikiData.wikiInfo.enableFlashesAndGames, - data: ({ wikiData }) => wikiData.flashData, + directory: 'tracks/in-flashes/by-flash', + stringsKey: 'listTracks.inFlashes.byFlash', + condition: ({wikiData}) => wikiData.wikiInfo.enableFlashesAndGames, + data: ({wikiData}) => wikiData.flashData, - html(flashData, { link, language }) { + html(flashData, {link, language}) { return fixWS` <dl> ${sortChronologically(flashData.slice()) .map( (flash) => fixWS` <dt>${language.$( - "listingPage.listTracks.inFlashes.byFlash.flash", + 'listingPage.listTracks.inFlashes.byFlash.flash', { flash: link.flash(flash), date: language.formatDate(flash.date), @@ -848,7 +848,7 @@ const listingSpec = [ ${flash.featuredTracks .map((track) => language.$( - "listingPage.listTracks.inFlashes.byFlash.track", + 'listingPage.listTracks.inFlashes.byFlash.track', { track: link.track(track), album: link.album(track.album), @@ -856,37 +856,37 @@ const listingSpec = [ ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </ul></dd> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "tracks/with-lyrics", - stringsKey: "listTracks.withLyrics", + directory: 'tracks/with-lyrics', + stringsKey: 'listTracks.withLyrics', - data({ wikiData }) { + data({wikiData}) { return wikiData.albumData .map((album) => ({ album, tracks: album.tracks.filter((t) => t.lyrics), })) - .filter(({ tracks }) => tracks.length > 0); + .filter(({tracks}) => tracks.length > 0); }, - html(chunks, { link, language }) { + html(chunks, {link, language}) { return fixWS` <dl> ${chunks .map( - ({ album, tracks }) => fixWS` + ({album, tracks}) => fixWS` <dt>${language.$( - "listingPage.listTracks.withLyrics.album", + 'listingPage.listTracks.withLyrics.album', { album: link.album(album), date: language.formatDate(album.date), @@ -896,74 +896,74 @@ const listingSpec = [ ${tracks .map((track) => language.$( - "listingPage.listTracks.withLyrics.track", + 'listingPage.listTracks.withLyrics.track', { track: link.track(track), } ) ) .map((row) => `<li>${row}</li>`) - .join("\n")} + .join('\n')} </dd></ul> ` ) - .join("\n")} + .join('\n')} </dl> `; }, }, { - directory: "tags/by-name", - stringsKey: "listTags.byName", - condition: ({ wikiData }) => wikiData.wikiInfo.enableArtTagUI, + directory: 'tags/by-name', + stringsKey: 'listTags.byName', + condition: ({wikiData}) => wikiData.wikiInfo.enableArtTagUI, - data({ wikiData }) { + data({wikiData}) { return sortAlphabetically( wikiData.artTagData.filter((tag) => !tag.isContentWarning) - ).map((tag) => ({ tag, timesUsed: tag.taggedInThings?.length })); + ).map((tag) => ({tag, timesUsed: tag.taggedInThings?.length})); }, - row({ tag, timesUsed }, { link, language }) { - return language.$("listingPage.listTags.byName.item", { + row({tag, timesUsed}, {link, language}) { + return language.$('listingPage.listTags.byName.item', { tag: link.tag(tag), - timesUsed: language.countTimesUsed(timesUsed, { unit: true }), + timesUsed: language.countTimesUsed(timesUsed, {unit: true}), }); }, }, { - directory: "tags/by-uses", - stringsKey: "listTags.byUses", - condition: ({ wikiData }) => wikiData.wikiInfo.enableArtTagUI, + directory: 'tags/by-uses', + stringsKey: 'listTags.byUses', + condition: ({wikiData}) => wikiData.wikiInfo.enableArtTagUI, - data({ wikiData }) { + data({wikiData}) { return wikiData.artTagData .filter((tag) => !tag.isContentWarning) - .map((tag) => ({ tag, timesUsed: tag.taggedInThings?.length })) + .map((tag) => ({tag, timesUsed: tag.taggedInThings?.length})) .sort((a, b) => b.timesUsed - a.timesUsed); }, - row({ tag, timesUsed }, { link, language }) { - return language.$("listingPage.listTags.byUses.item", { + row({tag, timesUsed}, {link, language}) { + return language.$('listingPage.listTags.byUses.item', { tag: link.tag(tag), - timesUsed: language.countTimesUsed(timesUsed, { unit: true }), + timesUsed: language.countTimesUsed(timesUsed, {unit: true}), }); }, }, { - directory: "random", - stringsKey: "other.randomPages", + directory: 'random', + stringsKey: 'other.randomPages', - data: ({ wikiData }) => ({ + data: ({wikiData}) => ({ officialAlbumData: wikiData.officialAlbumData, fandomAlbumData: wikiData.fandomAlbumData, }), html: ( - { officialAlbumData, fandomAlbumData }, - { getLinkThemeString, language } + {officialAlbumData, fandomAlbumData}, + {getLinkThemeString, language} ) => fixWS` <p>Choose a link to go to a random page in that category or album! If your browser doesn't support relatively modern JavaScript or you've disabled it, these links won't work - sorry.</p> <p class="js-hide-once-data">(Data files are downloading in the background! Please wait for data to load.)</p> @@ -980,14 +980,14 @@ const listingSpec = [ </ul></dd> ${[ { - name: "Official", + name: 'Official', albumData: officialAlbumData, - code: "official", + code: 'official', }, { - name: "Fandom", + name: 'Fandom', albumData: fandomAlbumData, - code: "fandom", + code: 'fandom', }, ] .map( @@ -1009,10 +1009,10 @@ const listingSpec = [ }</a></li> ` ) - .join("\n")}</ul></dd> + .join('\n')}</ul></dd> ` ) - .join("\n")} + .join('\n')} </dl> `, }, @@ -1023,29 +1023,29 @@ const filterListings = (directoryPrefix) => const listingTargetSpec = [ { - title: ({ language }) => language.$("listingPage.target.album"), - listings: filterListings("album"), + title: ({language}) => language.$('listingPage.target.album'), + listings: filterListings('album'), }, { - title: ({ language }) => language.$("listingPage.target.artist"), - listings: filterListings("artist"), + title: ({language}) => language.$('listingPage.target.artist'), + listings: filterListings('artist'), }, { - title: ({ language }) => language.$("listingPage.target.group"), - listings: filterListings("group"), + title: ({language}) => language.$('listingPage.target.group'), + listings: filterListings('group'), }, { - title: ({ language }) => language.$("listingPage.target.track"), - listings: filterListings("track"), + title: ({language}) => language.$('listingPage.target.track'), + listings: filterListings('track'), }, { - title: ({ language }) => language.$("listingPage.target.tag"), - listings: filterListings("tag"), + title: ({language}) => language.$('listingPage.target.tag'), + listings: filterListings('tag'), }, { - title: ({ language }) => language.$("listingPage.target.other"), - listings: [listingSpec.find((l) => l.directory === "random")], + title: ({language}) => language.$('listingPage.target.other'), + listings: [listingSpec.find((l) => l.directory === 'random')], }, ]; -export { listingSpec, listingTargetSpec }; +export {listingSpec, listingTargetSpec}; |