Compare commits
2 commits
6a1995d656
...
40631ceac5
Author | SHA1 | Date | |
---|---|---|---|
40631ceac5 | |||
81b342a0c4 |
2 changed files with 11 additions and 3 deletions
|
@ -199,7 +199,7 @@ makeDesc (LongDesc fs) = [b|@0
|
||||||
</div>
|
</div>
|
||||||
|]
|
|]
|
||||||
|
|
||||||
addIds :: Images' (Image, a) -> Images' (Image, a, Text)
|
addIds :: Traversable t => t (Image, a) -> t (Image, a, Text)
|
||||||
addIds = snd . mapAccumL makeId Set.empty where
|
addIds = snd . mapAccumL makeId Set.empty where
|
||||||
makeId used (img, x) = (Set.insert newId used, (img, x, newId)) where
|
makeId used (img, x) = (Set.insert newId used, (img, x, newId)) where
|
||||||
newId = head $ filter (\i -> not $ i `Set.member` used) ids
|
newId = head $ filter (\i -> not $ i `Set.member` used) ids
|
||||||
|
@ -213,7 +213,11 @@ makeButtonBar title images =
|
||||||
Uncat [_] -> ""
|
Uncat [_] -> ""
|
||||||
Cat [(_,[_])] -> ""
|
Cat [(_,[_])] -> ""
|
||||||
Uncat imgs -> makeNav "uncat" $ makeAlts imgs
|
Uncat imgs -> makeNav "uncat" $ makeAlts imgs
|
||||||
Cat cats -> makeNav "cat" $ map (uncurry makeCat) cats
|
Cat cats
|
||||||
|
| all ((<= 1) . length . snd) cats ->
|
||||||
|
makeButtonBar title $ Uncat $ flatten cats
|
||||||
|
| otherwise ->
|
||||||
|
makeNav "cat" $ map (uncurry makeCat) cats
|
||||||
where
|
where
|
||||||
makeNav (cls :: Text) inner = [b|@0
|
makeNav (cls :: Text) inner = [b|@0
|
||||||
<nav id=alts class=$cls aria-label="alternate versions">
|
<nav id=alts class=$cls aria-label="alternate versions">
|
||||||
|
@ -231,6 +235,10 @@ makeButtonBar title images =
|
||||||
</ul> |]
|
</ul> |]
|
||||||
where elems = map (\(img,sz,i) -> altButton img sz i) imgs
|
where elems = map (\(img,sz,i) -> altButton img sz i) imgs
|
||||||
|
|
||||||
|
flatten :: [(Text, [(Image, Size, Text)])] -> [(Image, Size, Text)]
|
||||||
|
flatten cats =
|
||||||
|
addIds [(img {label = cat}, sz) | (cat, is) <- cats, (img, sz, _) <- is]
|
||||||
|
|
||||||
altButton :: Image -> Size -> Text -> Builder
|
altButton :: Image -> Size -> Text -> Builder
|
||||||
altButton img size i = [b|@0
|
altButton img size i = [b|@0
|
||||||
<li$nsfwClass>
|
<li$nsfwClass>
|
||||||
|
|
|
@ -170,7 +170,7 @@ figcaption .title { bottom: -1px; left: -1px; }
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
mix-blend-mode: multiply;
|
mix-blend-mode: hard-light;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item.nsfw::before {
|
.item.nsfw::before {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue