From 5b320f6ece7ccb8cd1acc15ea517cceb13983cf4 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 30 Oct 2020 10:20:32 -0300 Subject: only show "Random" nav links when JS is enabled --- upd8.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'upd8.js') diff --git a/upd8.js b/upd8.js index 173fcc7..2c64b81 100644 --- a/upd8.js +++ b/upd8.js @@ -2403,11 +2403,18 @@ function generateAlbumNavLinks(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 `(${[ + + const [ previousLine, nextLine, randomLine ] = [ previous && `Previous`, next && `Next`, `${currentTrack ? 'Random' : 'Random Track'}` - ].filter(Boolean).join(', ')})`; + ]; + + if (previousLine || nextLine) { + return `(${[previousLine, nextLine].filter(Boolean).join(', ')}, ${randomLine})`; + } else { + return `(${randomLine})`; + } } function generateAlbumChronologyLinks(album, currentTrack = null) { -- cgit 1.3.0-6-gf8a5