From 98ef13f91132738e57ec800c687f16959ca99d3c Mon Sep 17 00:00:00 2001 From: Florrie Date: Sun, 24 Nov 2019 18:48:33 -0400 Subject: listings; about & credits; other fancy things ...that i don't exactly remember :) --- site.css | 37 ++++++----- upd8-util.js | 5 ++ upd8.js | 211 ++++++++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 213 insertions(+), 40 deletions(-) diff --git a/site.css b/site.css index bd27d16..dc06585 100644 --- a/site.css +++ b/site.css @@ -77,7 +77,7 @@ a:hover { padding-right: 15px; } -#sidebar li.current-track { +#sidebar li.current { font-weight: 800; } @@ -145,8 +145,21 @@ h1 { font-size: 2em; } -#intro { - margin: 24px 12%; +#intro-menu { + margin: 24px 0; + padding: 10px; + background-color: #222222; + text-align: center; + border: 1px dotted var(--fg-color); + border-radius: 2px; +} + +#intro-menu p { + margin: 12px 0; +} + +#intro-menu a { + margin: 0 6px; } li .by { @@ -164,6 +177,11 @@ blockquote { max-width: 600px; } +.long-content { + margin-left: 12%; + margin-right: 12%; +} + p img { max-width: 100%; } @@ -179,16 +197,3 @@ dl dt { dl dd { margin-bottom: 1em; } - -dl { - counter-reset: subolcounter; -} - -dl ol { - list-style: none; -} - -dl ol li:before { - counter-increment: subolcounter; - content: counter(subolcounter) ". "; -} diff --git a/upd8-util.js b/upd8-util.js index 2fe2fcc..cd0beed 100644 --- a/upd8-util.js +++ b/upd8-util.js @@ -69,3 +69,8 @@ module.exports.th = function (n) { return n + 'th'; } }; + +// My function names just keep getting 8etter. +module.exports.s = function (n, word) { + return `${n} ${word}` + (n === 1 ? '' : 's'); +}; diff --git a/upd8.js b/upd8.js index 7fb72f6..2599172 100644 --- a/upd8.js +++ b/upd8.js @@ -78,6 +78,7 @@ const access = util.promisify(fs.access); const { joinNoOxford, progressPromiseAll, + s, splitArray, th } = require('./upd8-util'); @@ -88,10 +89,19 @@ const SITE_DIRECTORY = ''; const SITE_TITLE = 'Homestuck Music Wiki'; -const SITE_INTRO = fixWS` -

Welcome to my fan-made Homestuck music wiki! Select any album below to begin browsing.

-

This site was mostly made as a remake of Homestuck's official Bandcamp, which saw its content reduced on 10/25/19. This site aims to be a more reliable resource and reference: track art (conspicuously missing from the Bandcamp) is archived here, solo albums are all indexed in the one place, and URLs will always stay consistent. Also included are tracks for listening on Bandcamp and other services.

-

This site was mostly made by Florrie (@florriestuck, /u/towerofnix - feel free to send suggestions and feedback!!). Listings were fetched primarily from the Homestuck Bandcamp. Track art is primarily from the Web Archive. Leitmotif and track-reference info is gathered from the fantastic NSND. Much of this is made based on and with use of the Homestuck and MSPA Music Wiki on Fandom - thanks a bunch to all who've worked on that!

+const SITE_ABOUT = ` +

Welcome to my fan-made Homestuck music wiki!

+

Homestuck has always been an incredible creative collaboration, and especially beloved by the community and critical in that collaboration is the webcomic and world's humongous soundtrack, comprising well over 500 tracks by dozens of musicians and artists. This wiki aims to be an interesting and useful resource for anyone interested in that music, as well as an archive for all things related.

+

Pertaining to the history of this site: it was originally made as a remake of Homestuck's official Bandcamp, which saw its content particularly reduced on 10/25/19. This site aims to be a more reliable resource and reference: track art (conspicuously missing from the Bandcamp) is archived here, solo albums (among other missing albums, like Squiddles!) are all indexed in the one place, and URLs will always stay consistent. And of course, also included are links for listening on Bandcamp and other services.

+

Credits

+ `; // The folder you stick your random downloads in is called "Downloads", yeah? @@ -112,6 +122,8 @@ const ALBUM_DIRECTORY = 'album'; const TRACK_DIRECTORY = 'track'; const ARTIST_DIRECTORY = 'artist'; const ARTIST_AVATAR_DIRECTORY = 'artist-avatar'; +const LISTING_DIRECTORY = 'list'; +const ABOUT_DIRECTORY = 'about'; // Might ena8le this later... we'll see! Eventually. May8e. const ENABLE_ARTIST_AVATARS = false; @@ -506,7 +518,6 @@ async function writePage(directoryParts, title, body) { // for now. TM. (Ahem. Still. Soon...may8e. TM. -- Should 8e easier now // that we'll have a proper function for writing any page - just appending // a ROOT_DIRECTORY should work. Um... okay, fine, I'll do that.) - if (directoryParts.length === 0) console.log(directory, SITE_DIRECTORY); await writeFile(path.join(directory, 'index.html'), fixWS` @@ -525,25 +536,41 @@ async function writePage(directoryParts, title, body) { `); } -async function writeTopIndexPage(albumData) { - await writePage([], SITE_TITLE, fixWS` - -
-

${SITE_TITLE}

-
- ${SITE_INTRO} +function writeMiscellaneousPages(albumData) { + return progressPromiseAll('Writing miscellaneous pages.', [ + writePage([], SITE_TITLE, fixWS` + +
+

${SITE_TITLE}

+
+

Explore the site!

+ Listings + About & Credits +

...or choose an album:

+
+
+ ${albumData.map(album => fixWS` + + + ${album.name} + + `).join('\n')} +
-
- ${albumData.map(album => fixWS` - - - ${album.name} - - `).join('\n')} + + `), + writePage([ABOUT_DIRECTORY], 'About & Credits', fixWS` + +
+
+

${SITE_TITLE}

+

(Home)

+ ${SITE_ABOUT} +
-
- - `); + + `) + ]); } // This function title is my gr8test work of art. @@ -764,6 +791,141 @@ function albumChunkedList(tracks, getLI, showDate = true) { `; } +function writeListingPages(albumData) { + const allArtists = getArtistNames(albumData).sort(); + const allTracks = getAllTracks(albumData); + + const getArtistNumContributions = artistName => [ + ...allTracks.filter(track => + track.artists.includes(artistName) || + [...track.contributors, ...track.coverArtists || []].some(({ who }) => who === artistName)), + ...albumData.filter(album => + (album.coverArtists || []).some(({ who }) => who === artistName)) + ].length; + + const getArtistNumCommentary = artistName => albumData.concat(allTracks) + .filter(thing => thing.commentary && thing.commentary.includes('' + artistName + ':')).length; + + const getAlbumLI = (album, extraText = '') => fixWS` +
  • + ${album.name} + ${extraText} +
  • + `; + + const getArtistLI = artistName => fixWS` +
  • + ${artistName} + (${getArtistNumContributions(artistName)} c.) +
  • + `; + + const sortByName = (a, b) => { + const an = a.name.toLowerCase(); + const bn = b.name.toLowerCase(); + return an < bn ? -1 : an > bn ? 1 : 0; + }; + + const listingDescriptors = [ + [['albums', 'by-name'], `Albums - by Name`, albumData.slice() + .sort(sortByName) + .map(album => getAlbumLI(album, `(${album.tracks.length} tracks)`))], + [['albums', 'by-date'], `Albums - by Date`, sortByDate(albumData.slice()) + .map(album => getAlbumLI(album, `(${getDateString(album)})`))], + [['albums', 'by-tracks'], `Albums - by Tracks`, albumData.slice() + .sort((a, b) => b.tracks.length - a.tracks.length) + .map(album => getAlbumLI(album, `(${album.tracks.length} tracks)`))], + [['artists', 'by-name'], `Artists - by Name`, allArtists + .map(name => ({name})) + .sort(sortByName) + .map(({ name }) => name) + .map(getArtistLI)], + [['artists', 'by-commentary'], `Artists - by Commentary`, allArtists + .map(name => ({name, commentary: getArtistNumCommentary(name)})) + .filter(({ commentary }) => commentary > 0) + .sort((a, b) => b.commentary - a.commentary) + .map(({ name, commentary }) => fixWS` +
  • + ${name} + (${commentary} ${commentary === 1 ? 'entry' : 'entries'}) +
  • + `)], + [['artists', 'by-contribs'], `Artists - by Contributions`, allArtists + .map(name => ({name, contribs: getArtistNumContributions(name)})) + .sort((a, b) => b.contribs - a.contribs) + .map(({ name }) => name) + .map(getArtistLI)], + [['tracks', 'by-name'], `Tracks - by Name`, allTracks.slice() + .sort(sortByName) + .map(track => fixWS` +
  • ${track.name}
  • + `)], + [['tracks', 'by-album'], `Tracks - by Album`, fixWS` +
    + ${albumData.map(album => fixWS` +
    ${album.name}
    +
      + ${album.tracks.map(track => fixWS` +
    1. ${track.name}
    2. + `).join('\n')} +
    + `).join('\n')} +
    + `], + [['tracks', 'by-date'], `Tracks - by Date`, albumChunkedList( + sortByDate(allTracks.slice()), + track => fixWS` +
  • ${track.name}
  • + `)] + ]; + + return progressPromiseAll(`Writing listing pages.`, [ + writePage([LISTING_DIRECTORY], `Listings Index`, fixWS` + + ${generateSidebarForListings(listingDescriptors)} +
    +

    Listings

    +

    Feel free to explore any of the listings linked in the sidebar!

    +
    + + `), + ...listingDescriptors.map(entry => writeListingPage(...entry, listingDescriptors)) + ]); +} + +function writeListingPage(directoryParts, title, items, listingDescriptors) { + return writePage([LISTING_DIRECTORY, ...directoryParts], title, fixWS` + + ${generateSidebarForListings(listingDescriptors, directoryParts)} +
    +

    ${title}

    + ${typeof items === 'string' ? items : fixWS` +
      + ${items.join('\n')} +
    + `} +
    + + `); +} + +function generateSidebarForListings(listingDescriptors, currentDirectoryParts) { + return fixWS` + + `; +} + // This function is terri8le. Sorry! function getContributionString({ what }, allTracks) { return what @@ -816,7 +978,7 @@ function generateSidebarForAlbum(album, currentTrack = null) {

    ${album.name}

      ${album.tracks.map(track => fixWS` -
    1. ${track.name}
    2. +
    3. ${track.name}
    4. `).join('\n')}
    ` @@ -906,9 +1068,10 @@ async function main() { return; } - await writeTopIndexPage(albumData); + await writeMiscellaneousPages(albumData); await progressPromiseAll(`Writing album & track pages.`, albumData.map(album => writeIndexAndTrackPagesForAlbum(album, albumData))); await writeArtistPages(albumData); + await writeListingPages(albumData); // The single most important step. console.log('Written!'); -- cgit 1.3.0-6-gf8a5