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
|
module BuilderQQ
|
||||||
(b,
|
(b,
|
||||||
Builder, toStrictText, toLazyText, fromText, fromString, fromChar,
|
Builder, toStrictText, toLazyText, fromText, fromString, fromChar,
|
||||||
textMap, ifJust, escId, escAttr)
|
textMap, ifJust, escId, escAttr, CanBuild (..))
|
||||||
where
|
where
|
||||||
|
|
||||||
import Data.Char (isLower, isSpace, isDigit, isAlphaNum)
|
import Data.Char (isLower, isSpace, isDigit, isAlphaNum)
|
||||||
|
|
|
@ -4,7 +4,7 @@ module Depend
|
||||||
thumbFile, pageFile)
|
thumbFile, pageFile)
|
||||||
where
|
where
|
||||||
|
|
||||||
import BuilderQQ
|
import BuilderQQ hiding (CanBuild (..))
|
||||||
import Info hiding (Text)
|
import Info hiding (Text)
|
||||||
|
|
||||||
import Data.Maybe (fromMaybe, mapMaybe)
|
import Data.Maybe (fromMaybe, mapMaybe)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import Date
|
||||||
import Info
|
import Info
|
||||||
import qualified NsfwWarning
|
import qualified NsfwWarning
|
||||||
|
|
||||||
|
import Control.Monad
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.Function (on, (&))
|
import Data.Function (on, (&))
|
||||||
import qualified Data.HashMap.Strict as HashMap
|
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
|
| (_, (p0, i0) : _) : _ <- infosByYear = getThumb (takeDirectory p0) i0
|
||||||
| otherwise = "/style/card.png"
|
| otherwise = "/style/card.png"
|
||||||
|
|
||||||
nsfwScript = NsfwWarning.script nsfw
|
nsfw' = NsfwWarning.Gallery <$ guard nsfw
|
||||||
nsfwDialog = NsfwWarning.dialog nsfw
|
nsfwScript = NsfwWarning.script nsfw'
|
||||||
|
nsfwDialog = NsfwWarning.dialog nsfw'
|
||||||
|
|
||||||
makeFilter :: Text -> HashSet Text -> Text -> Int -> Builder
|
makeFilter :: Text -> HashSet Text -> Text -> Int -> Builder
|
||||||
makeFilter prefix initial tag count = [b|@0
|
makeFilter prefix initial tag count = [b|@0
|
||||||
|
|
|
@ -1,27 +1,40 @@
|
||||||
module NsfwWarning (script, dialog) where
|
module NsfwWarning (What (..), script, dialog) where
|
||||||
|
|
||||||
import BuilderQQ
|
import BuilderQQ
|
||||||
|
|
||||||
script :: Bool -> Builder
|
|
||||||
script False = ""
|
|
||||||
script True = [b|<script src=/script/nsfw-warning.js></script>|]
|
|
||||||
|
|
||||||
dialog :: Bool -> Builder
|
data What = Single | Gallery
|
||||||
dialog False = ""
|
|
||||||
dialog True = [b|@0
|
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 id=nsfw-dialog>
|
||||||
<div class=dialog-inner>
|
<div class=dialog-inner>
|
||||||
<h1>cw: lewd</h1>
|
<h1>cw: lewd art</h1>
|
||||||
|
|
||||||
<img class=dialog-icon src=/style/stop_hand.svg>
|
<img class=dialog-icon src=/style/stop_hand.svg>
|
||||||
|
|
||||||
<div class=dialog-message>
|
<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>
|
||||||
|
|
||||||
<div class=dialog-buttons>
|
<div class=dialog-buttons>
|
||||||
<button id=nsfw-yes class=yes>yes i am and i wanna see</button>
|
<button id=nsfw-yes class=yes>i am an adult</button>
|
||||||
<button id=nsfw-no class=no>no i’m not</button>
|
<button id=nsfw-no class=no>i am not</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import Records ()
|
||||||
import qualified NsfwWarning
|
import qualified NsfwWarning
|
||||||
|
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
import Control.Monad
|
||||||
import Data.List (sort)
|
import Data.List (sort)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
import qualified Data.Text as Strict
|
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
|
let updated = formatLong d in
|
||||||
[b|<br> <span class=updated>updated $updated</span>|]
|
[b|<br> <span class=updated>updated $updated</span>|]
|
||||||
|
|
||||||
let nsfwScript = NsfwWarning.script nsfw
|
let nsfw' = NsfwWarning.Single <$ guard nsfw
|
||||||
let nsfwDialog = NsfwWarning.dialog nsfw
|
let nsfwScript = NsfwWarning.script nsfw'
|
||||||
|
let nsfwDialog = NsfwWarning.dialog nsfw'
|
||||||
|
|
||||||
pure [b|@0
|
pure [b|@0
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
min-height: 20vh;
|
min-height: 20vh;
|
||||||
max-width: 60vw;
|
max-width: 30em;
|
||||||
padding: 1.5em 3em 2em;
|
padding: 1.5em 3em 2em;
|
||||||
|
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
.dialog-message {
|
.dialog-message {
|
||||||
grid-area: text;
|
grid-area: text;
|
||||||
justify-self: start;
|
justify-self: start;
|
||||||
|
font-size: 125%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dialog-buttons {
|
.dialog-buttons {
|
||||||
|
@ -83,6 +84,16 @@
|
||||||
background: hsl(5deg, 70%, 80%);
|
background: hsl(5deg, 70%, 80%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dialog p {
|
||||||
|
text-align: left;
|
||||||
|
-ms-hyphens: none;
|
||||||
|
hyphens: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog strong {
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
@media (pointer: coarse) {
|
@media (pointer: coarse) {
|
||||||
button {
|
button {
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
|
|
Loading…
Reference in a new issue