diff --git a/make-pages/BuilderQQ.hs b/make-pages/BuilderQQ.hs index bde71c7..2870747 100644 --- a/make-pages/BuilderQQ.hs +++ b/make-pages/BuilderQQ.hs @@ -2,7 +2,7 @@ module BuilderQQ (b, Builder, toStrictText, toLazyText, fromText, fromString, fromChar, - textMap, ifJust, escId, escAttr) + textMap, ifJust, escId, escAttr, CanBuild (..)) where import Data.Char (isLower, isSpace, isDigit, isAlphaNum) diff --git a/make-pages/Depend.hs b/make-pages/Depend.hs index 269f757..4b87b4e 100644 --- a/make-pages/Depend.hs +++ b/make-pages/Depend.hs @@ -4,7 +4,7 @@ module Depend thumbFile, pageFile) where -import BuilderQQ +import BuilderQQ hiding (CanBuild (..)) import Info hiding (Text) import Data.Maybe (fromMaybe, mapMaybe) diff --git a/make-pages/GalleryPage.hs b/make-pages/GalleryPage.hs index 5c49bae..8edfba1 100644 --- a/make-pages/GalleryPage.hs +++ b/make-pages/GalleryPage.hs @@ -6,6 +6,7 @@ import Date import Info import qualified NsfwWarning +import Control.Monad import Data.Foldable import Data.Function (on, (&)) import qualified Data.HashMap.Strict as HashMap @@ -114,8 +115,9 @@ make' root (GalleryInfo {title, desc, prefix, filters, hidden}) infos = [b|@0 | (_, (p0, i0) : _) : _ <- infosByYear = getThumb (takeDirectory p0) i0 | otherwise = "/style/card.png" - nsfwScript = NsfwWarning.script nsfw - nsfwDialog = NsfwWarning.dialog nsfw + nsfw' = NsfwWarning.Gallery <$ guard nsfw + nsfwScript = NsfwWarning.script nsfw' + nsfwDialog = NsfwWarning.dialog nsfw' makeFilter :: Text -> HashSet Text -> Text -> Int -> Builder makeFilter prefix initial tag count = [b|@0 diff --git a/make-pages/NsfwWarning.hs b/make-pages/NsfwWarning.hs index 5d7b7e8..fcfabb5 100644 --- a/make-pages/NsfwWarning.hs +++ b/make-pages/NsfwWarning.hs @@ -1,27 +1,40 @@ -module NsfwWarning (script, dialog) where +module NsfwWarning (What (..), script, dialog) where import BuilderQQ -script :: Bool -> Builder -script False = "" -script True = [b||] -dialog :: Bool -> Builder -dialog False = "" -dialog True = [b|@0 +data What = Single | Gallery + +instance CanBuild What where + build Single = "this art" + build Gallery = "the art in this gallery" + + +script :: Maybe What -> Builder +script Nothing = "" +script (Just _) = [b||] + +dialog :: Maybe What -> Builder +dialog Nothing = "" +dialog (Just what) = [b|@0
-

cw: lewd

+

cw: lewd art

- are you an adult?
if not please don't look! +

+ $what contains pornographic content that is + not suitable for minors. +

+ by continuing, you are confirming that you are at least + eighteen years old.

- - + +
diff --git a/make-pages/SinglePage.hs b/make-pages/SinglePage.hs index 5aee691..bddb64c 100644 --- a/make-pages/SinglePage.hs +++ b/make-pages/SinglePage.hs @@ -7,6 +7,7 @@ import Records () import qualified NsfwWarning import Control.Exception +import Control.Monad import Data.List (sort) import Data.Maybe (fromMaybe) import qualified Data.Text as Strict @@ -92,8 +93,9 @@ make' root prefix nsfw dataDir dir info@(Info {date, title, artist, bg}) = do let updated = formatLong d in [b|
updated $updated|] - let nsfwScript = NsfwWarning.script nsfw - let nsfwDialog = NsfwWarning.dialog nsfw + let nsfw' = NsfwWarning.Single <$ guard nsfw + let nsfwScript = NsfwWarning.script nsfw' + let nsfwDialog = NsfwWarning.dialog nsfw' pure [b|@0 diff --git a/style/shiny/nsfw-warning.css b/style/shiny/nsfw-warning.css index 446162b..081128d 100644 --- a/style/shiny/nsfw-warning.css +++ b/style/shiny/nsfw-warning.css @@ -24,7 +24,7 @@ align-items: center; min-height: 20vh; - max-width: 60vw; + max-width: 30em; padding: 1.5em 3em 2em; background: var(--background); @@ -48,6 +48,7 @@ .dialog-message { grid-area: text; justify-self: start; + font-size: 125%; } .dialog-buttons { @@ -83,6 +84,16 @@ background: hsl(5deg, 70%, 80%); } +.dialog p { + text-align: left; + -ms-hyphens: none; + hyphens: none; +} + +.dialog strong { + font-weight: 800; +} + @media (pointer: coarse) { button { font-size: 150%;