messing with the nsfw warning
This commit is contained in:
parent
9d45b520e7
commit
5c2a50760a
6 changed files with 46 additions and 18 deletions
|
@ -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)
|
||||
|
|
|
@ -4,7 +4,7 @@ module Depend
|
|||
thumbFile, pageFile)
|
||||
where
|
||||
|
||||
import BuilderQQ
|
||||
import BuilderQQ hiding (CanBuild (..))
|
||||
import Info hiding (Text)
|
||||
|
||||
import Data.Maybe (fromMaybe, mapMaybe)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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|<script src=/script/nsfw-warning.js></script>|]
|
||||
|
||||
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|<script src=/script/nsfw-warning.js></script>|]
|
||||
|
||||
dialog :: Maybe What -> Builder
|
||||
dialog Nothing = ""
|
||||
dialog (Just what) = [b|@0
|
||||
<div class=dialog id=nsfw-dialog>
|
||||
<div class=dialog-inner>
|
||||
<h1>cw: lewd</h1>
|
||||
<h1>cw: lewd art</h1>
|
||||
|
||||
<img class=dialog-icon src=/style/stop_hand.svg>
|
||||
|
||||
<div class=dialog-message>
|
||||
are you an adult? <br> if not please don't look!
|
||||
<p>
|
||||
$what contains pornographic content that is
|
||||
<strong>not suitable for minors</strong>.
|
||||
<p>
|
||||
by continuing, you are confirming that you are at least
|
||||
<strong>eighteen years old</strong>.
|
||||
</div>
|
||||
|
||||
<div class=dialog-buttons>
|
||||
<button id=nsfw-yes class=yes>yes i am and i wanna see</button>
|
||||
<button id=nsfw-no class=no>no i’m not</button>
|
||||
<button id=nsfw-yes class=yes>i am an adult</button>
|
||||
<button id=nsfw-no class=no>i am not</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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|<br> <span class=updated>updated $updated</span>|]
|
||||
|
||||
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
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -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%;
|
||||
|
|
Loading…
Reference in a new issue