add nsfw warning dialog
This commit is contained in:
parent
d671a4c01e
commit
c807895244
12 changed files with 346 additions and 102 deletions
|
@ -4,6 +4,7 @@ import Date
|
|||
import Info
|
||||
import BuilderQQ
|
||||
import Records ()
|
||||
import qualified NsfwWarning
|
||||
|
||||
import Control.Exception
|
||||
import qualified Data.Map.Strict as Map
|
||||
|
@ -60,7 +61,7 @@ make' root prefix nsfw dataDir dir
|
|||
let makePrefetch (Image {path}) = [b|<link rel=prefetch href=$path>|]
|
||||
let prefetches = map (makePrefetch . #first) $ tail images
|
||||
|
||||
let makeWarning w = [b|@4
|
||||
let makeWarning w = [b|@0
|
||||
<figcaption id=cw aria-role=button tabindex=0>
|
||||
<span id=cw-text>$w</span>
|
||||
</figcaption>
|
||||
|
@ -82,6 +83,9 @@ make' root prefix nsfw dataDir dir
|
|||
let updateDate = ifJust (Map.lookupMax updates) \(formatLong -> u, _) ->
|
||||
[b|<br> <span class=updated>updated $u</span>|]
|
||||
|
||||
let nsfwScript = NsfwWarning.script nsfw
|
||||
let nsfwDialog = NsfwWarning.dialog nsfw
|
||||
|
||||
pure [b|@0
|
||||
<!DOCTYPE html>
|
||||
<html lang=en>
|
||||
|
@ -100,44 +104,49 @@ make' root prefix nsfw dataDir dir
|
|||
<meta name=twitter:card content=summary>
|
||||
|
||||
<script src=/script/single.js></script>
|
||||
$nsfwScript
|
||||
$bgStyle
|
||||
|
||||
$0.prefetches
|
||||
|
||||
<title>$title</title>
|
||||
|
||||
<header>
|
||||
<h1>$title</h1>
|
||||
$artistTag
|
||||
<h2 id=date class="right corner">
|
||||
$formattedDate $updateDate
|
||||
</h2>
|
||||
</header>
|
||||
$nsfwDialog
|
||||
|
||||
$buttonBar
|
||||
<div class=page>
|
||||
<header>
|
||||
<h1>$title</h1>
|
||||
$artistTag
|
||||
<h2 id=date class="right corner">
|
||||
$formattedDate $updateDate
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<figure id=mainfig data-width=$width0 data-height=$height0>
|
||||
$warning'
|
||||
<a id=mainlink href="$download0" title="download full version">
|
||||
<img id=mainimg src="$path0'" alt="">
|
||||
</a>
|
||||
</figure>
|
||||
$2.buttonBar
|
||||
|
||||
<div id=info>
|
||||
$descSection
|
||||
<main>
|
||||
<figure id=mainfig data-width=$width0 data-height=$height0>
|
||||
$warning'
|
||||
<a id=mainlink href="$download0" title="download full version">
|
||||
<img id=mainimg src="$path0'" alt="">
|
||||
</a>
|
||||
</figure>
|
||||
|
||||
$tagsList
|
||||
<div id=info>
|
||||
$6.descSection
|
||||
|
||||
$linksList
|
||||
$6.tagsList
|
||||
|
||||
$updatesList
|
||||
</div>
|
||||
</main>
|
||||
$6.linksList
|
||||
|
||||
<footer>
|
||||
<a href=$undir>back to gallery</a>
|
||||
</footer>
|
||||
$6.updatesList
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<a href=$undir>back to gallery</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<template id=cw-template>
|
||||
$warningT
|
||||
|
@ -153,11 +162,11 @@ makeArtist (Artist {name, url}) =
|
|||
Nothing -> [b|$name|]
|
||||
|
||||
makeDesc :: Maybe Strict.Text -> Builder
|
||||
makeDesc mdesc = ifJust mdesc \desc -> [b|@4
|
||||
makeDesc mdesc = ifJust mdesc \desc -> [b|@0
|
||||
<section id=desc class=info-section>
|
||||
<h2>about</h2>
|
||||
<div>
|
||||
$8.desc
|
||||
$4.desc
|
||||
</div>
|
||||
</section>
|
||||
|]
|
||||
|
@ -177,7 +186,7 @@ makeButtonBar title images =
|
|||
where alts = map (\(i, (im, sz)) -> altButton i im sz) $ zip [0..] images
|
||||
|
||||
altButton :: Int -> Image -> Size -> Builder
|
||||
altButton i (Image {label, path, nsfw, warning}) (Size {width, height}) = [b|@4
|
||||
altButton i (Image {label, path, nsfw, warning}) (Size {width, height}) = [b|@0
|
||||
<li$nsfwClass>
|
||||
<input type=radio$checked name=variant id="$idLabel" value="$path'"
|
||||
data-link="$path"$warning'
|
||||
|
@ -194,11 +203,11 @@ altButton i (Image {label, path, nsfw, warning}) (Size {width, height}) = [b|@4
|
|||
|
||||
makeTags :: FilePath -> [Strict.Text] -> Builder
|
||||
makeTags undir tags =
|
||||
if null tags then "" else [b|@4
|
||||
if null tags then "" else [b|@0
|
||||
<nav id=tags class=info-section>
|
||||
<h2>tags</h2>
|
||||
<ul class="buttonbar bb-links">
|
||||
$8.tagList
|
||||
$4.tagList
|
||||
</ul>
|
||||
</nav>
|
||||
|]
|
||||
|
@ -209,11 +218,11 @@ makeTags undir tags =
|
|||
|
||||
extLinks :: [Link] -> Builder
|
||||
extLinks links =
|
||||
if null links then "" else [b|@4
|
||||
if null links then "" else [b|@0
|
||||
<nav id=links class=info-section>
|
||||
<h2>links</h2>
|
||||
<ul class="buttonbar bb-links">
|
||||
$8.linkList
|
||||
$4.linkList
|
||||
</ul>
|
||||
</nav>
|
||||
|]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue