From 8fd50d6f0ba8dcfcfe34eb1321dc0bdd307b8c6a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 5 May 2022 19:33:01 -0300 Subject: support albums without cover art --- src/upd8.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/upd8.js') diff --git a/src/upd8.js b/src/upd8.js index 14471186..13cf2e77 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -606,6 +606,7 @@ function stringifyThings(thingData) { function img({ src, alt, + noSrcText = '', thumb: thumbKey, reveal, id, @@ -620,7 +621,7 @@ function img({ const willLink = typeof link === 'string' || link; const originalSrc = src; - const thumbSrc = thumbKey ? thumb[thumbKey](src) : src; + const thumbSrc = src && (thumbKey ? thumb[thumbKey](src) : src); const imgAttributes = html.attributes({ id: link ? '' : id, @@ -630,10 +631,13 @@ function img({ height }); - const nonlazyHTML = wrap(``); - const lazyHTML = lazy && wrap(``, true); + const noSrcHTML = !src && wrap(`
${noSrcText}
`); + const nonlazyHTML = src && wrap(``); + const lazyHTML = src && lazy && wrap(``, true); - if (lazy) { + if (!src) { + return noSrcHTML; + } else if (lazy) { return fixWS` ${lazyHTML} -- cgit 1.3.0-6-gf8a5