diff options
author | Yorhel <git@yorhel.nl> | 2020-07-05 10:55:18 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-07-05 10:55:18 +0200 |
commit | a7909fb9e21bf1e31e85d8795a72c74707543c68 (patch) | |
tree | 6e1f2fb3f57e6a84a8cbb3ef1de0f48bc4dd4b91 /elm/Lib | |
parent | 0a6254431d97a2f4de9429e738e58c4dca3bfaa5 (diff) |
VN::Edit: Add screenshot manager
Diffstat (limited to 'elm/Lib')
-rw-r--r-- | elm/Lib/Image.elm | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/elm/Lib/Image.elm b/elm/Lib/Image.elm index 44ce8240..d5e6f229 100644 --- a/elm/Lib/Image.elm +++ b/elm/Lib/Image.elm @@ -113,10 +113,23 @@ viewImg image = (Error e, _) -> b [ class "standout" ] [ text <| Api.showResponse e ] (_, Nothing) -> text "No image." (_, Just i) -> - label [ class "imghover", style "width" (String.fromInt i.width++"px"), style "height" (String.fromInt i.height++"px") ] + let + maxWidth = toFloat <| if String.startsWith "sf" i.id then 136 else 10000 + maxHeight = toFloat <| if String.startsWith "sf" i.id then 102 else 10000 + sWidth = maxWidth / toFloat i.width + sHeight = maxHeight / toFloat i.height + scale = Basics.min 1 <| if sWidth < sHeight then sWidth else sHeight + imgWidth = round <| scale * toFloat i.width + imgHeight = round <| scale * toFloat i.height + in + -- TODO: Onclick iv.js support for screenshot thumbnails + label [ class "imghover", style "width" (String.fromInt imgWidth++"px"), style "height" (String.fromInt imgHeight++"px") ] [ div [ class "imghover--visible" ] - [ img [ src (imageUrl i.id) ] [] - , a [ href <| "/img/"++i.id ] <| + [ if String.startsWith "sf" i.id + then a [ href (imageUrl i.id), attribute "data-iv" <| String.fromInt i.width ++ "x" ++ String.fromInt i.height ++ ":scr" ] + [ img [ src <| imageUrl <| String.replace "sf" "st" i.id ] [] ] + else img [ src <| imageUrl i.id ] [] + , a [ class "imghover--overlay", href <| "/img/"++i.id ] <| case (i.sexual_avg, i.violence_avg) of (Just sex, Just vio) -> -- XXX: These thresholds are subject to change, maybe just show the numbers here? @@ -143,12 +156,12 @@ viewVote model = Api.Error e -> [ tr [] [ td [ colspan 2 ] [ b [ class "standout" ] [ text (Api.showResponse e) ] ] ] ] _ -> [] , tr [] - [ td [] + [ td [ style "white-space" "nowrap" ] [ label [] [ inputRadio "" (i.my_sexual == Just 0) (MySex 0), text " Safe" ], br [] [] , label [] [ inputRadio "" (i.my_sexual == Just 1) (MySex 1), text " Suggestive" ], br [] [] , label [] [ inputRadio "" (i.my_sexual == Just 2) (MySex 2), text " Explicit" ] ] - , td [] + , td [ style "white-space" "nowrap" ] [ label [] [ inputRadio "" (i.my_violence == Just 0) (MyVio 0), text " Tame" ], br [] [] , label [] [ inputRadio "" (i.my_violence == Just 1) (MyVio 1), text " Violent" ], br [] [] , label [] [ inputRadio "" (i.my_violence == Just 2) (MyVio 2), text " Brutal" ] |