From 90ed6fd94299109c3e7cc2bd81bf03d3231e77f0 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 26 Nov 2020 09:08:43 -0400 Subject: more lovely changes across the board --- upd8.js | 127 +++++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 45 deletions(-) (limited to 'upd8.js') diff --git a/upd8.js b/upd8.js index 34e97d87..5c4b5e82 100644 --- a/upd8.js +++ b/upd8.js @@ -110,6 +110,8 @@ const SITE_SHORT_TITLE = 'HSMusic'; const SITE_VERSION = 'autumnal polish haul'; const SITE_RELEASE = '10 October 2020'; +const SITE_DONATE_LINK = 'https://liberapay.com/nebula'; + function readDataFile(file) { // fight me bro return fs.readFileSync(path.join(C.DATA_DIRECTORY, file)).toString().trim(); @@ -659,12 +661,13 @@ async function processArtistDataFile(file) { const name = getBasicField(section, 'Artist'); const urls = (getListField(section, 'URLs') || []).filter(Boolean); const alias = getBasicField(section, 'Alias'); + const note = getMultilineField(section, 'Note'); if (!name) { return {error: 'Expected "Artist" (name) field!'}; } - return {name, urls, alias}; + return {name, urls, alias, note}; }); } @@ -684,7 +687,8 @@ async function processFlashDataFile(file) { if (getBasicField(section, 'ACT')) { act = getBasicField(section, 'ACT'); color = getBasicField(section, 'FG'); - return {act8r8k: true, act, color}; + const anchor = getBasicField(section, 'Anchor'); + return {act8r8k: true, act, color, anchor}; } const name = getBasicField(section, 'Flash'); @@ -1238,8 +1242,8 @@ function writeMiscellaneousPages() { content: fixWS`

Get involved!


News

@@ -1319,11 +1323,23 @@ function writeMiscellaneousPages() {

Also check out:

+ + ${flashData.filter(flash => flash.act8r8k).map((act, i) => fixWS` -

${act.act}

+

${act.act}

${getFlashGridHTML({ entries: (flashData @@ -1335,6 +1351,13 @@ function writeMiscellaneousPages() { `).join('\n')} ` }, + + /* + sidebar: { + content: generateSidebarForFlashes(null) + }, + */ + nav: {simple: true} }), @@ -1657,7 +1680,8 @@ function getTracksByArtist(artistName) { async function writeArtistPage(artistName) { const { - urls = [] + urls = [], + note = '' } = artistData.find(({ name }) => name === artistName) || {}; const tracks = getTracksByArtist(artistName); @@ -1697,6 +1721,11 @@ async function writeArtistPage(artistName) { Artist avatar `}

${artistName}

+ ${note && fixWS` +

Note:

+
${note}
+
+ `} ${urls.length && `

Visit on ${joinNoOxford(urls.map(fancifyURL), 'or')}.

`}

Jump to: ${[ [ @@ -1840,14 +1869,6 @@ async function writeFlashPages() { async function writeFlashPage(flash) { const kebab = getFlashDirectory(flash); - const act6 = flashData.findIndex(f => f.act.startsWith('Act 6')); - const postCanon = flashData.findIndex(f => f.act.includes('Post Canon')); - const outsideCanon = postCanon + flashData.slice(postCanon).findIndex(f => !f.act.includes('Post Canon')); - const side = ( - (flashData.indexOf(flash) < act6) ? 1 : - (flashData.indexOf(flash) <= outsideCanon) ? 2 : - 0 - ); const flashes = flashData.filter(flash => !flash.act8r8k); const index = flashes.indexOf(flash); @@ -1923,37 +1944,7 @@ async function writeFlashPage(flash) { ` }, sidebar: { - content: fixWS` -

Flashes & Games

-
- ${flashData.filter(f => f.act8r8k).filter(({ act }) => - act.startsWith('Act 1') || - act.startsWith('Act 6 Act 1') || - act.startsWith('Hiveswap') || - ( - flashData.findIndex(f => f.act === act) < act6 ? side === 1 : - flashData.findIndex(f => f.act === act) < outsideCanon ? side === 2 : - true - ) - ).flatMap(({ act, color }) => [ - act.startsWith('Act 1') && `
Side 1 (Acts 1-5)
` - || act.startsWith('Act 6 Act 1') && `
Side 2 (Acts 6-7)
` - || act.startsWith('Hiveswap') && `
Outside Canon (Misc. Games)
`, - ( - flashData.findIndex(f => f.act === act) < act6 ? side === 1 : - flashData.findIndex(f => f.act === act) < outsideCanon ? side === 2 : - true - ) && `
${act}
`, - act === flash.act && fixWS` -
    - ${flashData.filter(f => !f.act8r8k && f.act === act).map(f => fixWS` -
  • ${f.name}
  • - `).join('\n')} -
- ` - ]).filter(Boolean).join('\n')} -
- ` + content: generateSidebarForFlashes(flash) }, nav: { links: [ @@ -1980,6 +1971,52 @@ async function writeFlashPage(flash) { }); } +function generateSidebarForFlashes(flash) { + const act6 = flashData.findIndex(f => f.act.startsWith('Act 6')); + const postCanon = flashData.findIndex(f => f.act.includes('Post Canon')); + const outsideCanon = postCanon + flashData.slice(postCanon).findIndex(f => !f.act.includes('Post Canon')); + const index = flashData.indexOf(flash); + const side = ( + (index < 0) ? 0 : + (index < act6) ? 1 : + (index <= outsideCanon) ? 2 : + 3 + ); + const currentAct = flash && flash.act; + + return fixWS` +

Flashes & Games

+
+ ${flashData.filter(f => f.act8r8k).filter(({ act }) => + act.startsWith('Act 1') || + act.startsWith('Act 6 Act 1') || + act.startsWith('Hiveswap') || + ( + flashData.findIndex(f => f.act === act) < act6 ? side === 1 : + flashData.findIndex(f => f.act === act) < outsideCanon ? side === 2 : + true + ) + ).flatMap(({ act, color }) => [ + act.startsWith('Act 1') && `
Side 1 (Acts 1-5)
` + || act.startsWith('Act 6 Act 1') && `
Side 2 (Acts 6-7)
` + || act.startsWith('Hiveswap') && `
Outside Canon (Misc. Games)
`, + ( + flashData.findIndex(f => f.act === act) < act6 ? side === 1 : + flashData.findIndex(f => f.act === act) < outsideCanon ? side === 2 : + true + ) && `
${act}
`, + act === currentAct && fixWS` +
    + ${flashData.filter(f => !f.act8r8k && f.act === act).map(f => fixWS` +
  • ${f.name}
  • + `).join('\n')} +
+ ` + ]).filter(Boolean).join('\n')} +
+ `; +} + function writeListingPages() { const allArtists = artistNames.slice().sort(); const reversedTracks = allTracks.slice().reverse(); -- cgit 1.3.0-6-gf8a5