From b21e5b5521cad7f38b93e2f41bf5d3c30eb8298c Mon Sep 17 00:00:00 2001 From: Florrie Date: Wed, 3 Jun 2020 16:37:19 -0300 Subject: next/previous buttons in track header --- upd8.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/upd8.js b/upd8.js index bb5e22de..d22f1bee 100644 --- a/upd8.js +++ b/upd8.js @@ -1701,14 +1701,19 @@ function chronologyButtons(currentTrack, { } function generateHeaderForAlbum(album, currentTrack = null) { + const index = currentTrack && album.tracks.indexOf(currentTrack) + const previous = currentTrack && album.tracks[index - 1] + const next = currentTrack && album.tracks[index + 1] return fixWS`

Home / ${album.name} ${currentTrack && `/ ${currentTrack.name}`} - - ${album.tracks.length > 1 && `(Random track)`} - + ${album.tracks.length > 1 && `(${[ + previous && `Previous`, + next && `Next`, + `${currentTrack ? 'Random' : 'Random Track'}` + ].filter(Boolean).join(', ')})`}

${currentTrack === null && chronologyButtons(album, { -- cgit 1.3.0-6-gf8a5