From 3ff4dbee48dbbf323666ec86e3ad9363a83f910e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 2 Mar 2023 19:16:57 -0400 Subject: hide CW'd art from sticky heading til main cover revealed --- src/misc-templates.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/misc-templates.js') diff --git a/src/misc-templates.js b/src/misc-templates.js index aa21a39..47324ac 100644 --- a/src/misc-templates.js +++ b/src/misc-templates.js @@ -727,7 +727,8 @@ function unbound_img({ if (reveal) { wrapped = html.tag('div', {class: 'reveal'}, [ wrapped, - html.tag('span', {class: 'reveal-text'}, reveal), + html.tag('span', {class: 'reveal-text-container'}, + html.tag('span', {class: 'reveal-text'}, reveal)), ]); } @@ -952,7 +953,6 @@ function unbound_generateContentHeading({ } function unbound_generateStickyHeadingContainer({ - getRevealStringFromArtTags, html, img, @@ -971,16 +971,27 @@ function unbound_generateStickyHeadingContainer({ html.tag('div', {class: 'content-sticky-heading-row'}, [ html.tag('h1', title), + // Cover art in the sticky heading never uses the 'reveal' setting + // because it's too small to effectively display content warnings. + // Instead, if art has content warnings, it's hidden from the sticky + // heading by default, and will be enabled once the main cover art + // is revealed. coverSrc && html.tag('div', {class: 'content-sticky-heading-cover-container'}, - html.tag('div', {class: 'content-sticky-heading-cover'}, + html.tag('div', + { + class: [ + 'content-sticky-heading-cover', + coverArtTags .some(tag => !tag.isContentWarning) && + 'content-sticky-heading-cover-needs-reveal', + ], + }, img({ src: coverSrc, alt: coverAlt, thumb: 'small', link: false, square: true, - reveal: getRevealStringFromArtTags(coverArtTags), }))), ]), -- cgit 1.3.0-6-gf8a5