Browse Source

handle extraText as an option from HTML

main
Efertone 4 months ago
parent
commit
55a9eed289
Signed by: efertone GPG Key ID: 07AB750DDFD9EE50
  1. 12
      public/index.html
  2. 9
      src/Flags.elm
  3. 4
      src/Model.elm
  4. 19
      src/View.elm

12
public/index.html

@ -22,6 +22,18 @@
, extentions:
[ { extention: "mp4", mime: "video/mp4" }
]
, showExtraText: true
, extraText:
{ title: "Why are these available here?"
, content:
`
I have no intention to make pirate copy of all these videos,"
but I think they are useful or interesting. The UI of cube365
is very slow and painful to use and all VODs are available only there.
The other reason is, it requires a cube365 registration which I don't
think is necessary, not only unnecessary, but annoying as well.
`
}
}
});

9
src/Flags.elm

@ -2,10 +2,19 @@ module Flags exposing (..)
import Video
type alias ExtraText =
{ title : String
, content : String
}
type alias Flags =
{ debug : Bool
, withDownload : Bool
, extentions : List Video.FileFormat
, showExtraText : Bool
, extraText : ExtraText
}

4
src/Model.elm

@ -9,6 +9,8 @@ type alias Model =
, videos : List Video.Video
, extensions : List Video.FileFormat
, withDownload : Bool
, showExtraText : Bool
, extraText : Flags.ExtraText
}
@ -18,4 +20,6 @@ initialState flags =
, videos = []
, extensions = flags.extentions
, withDownload = withDownload flags
, showExtraText = flags.showExtraText
, extraText = flags.extraText
}

19
src/View.elm

@ -16,7 +16,7 @@ view model =
[ dropdown model.videos
, player model
, download model
, text
, text model
, Html.footer []
[ Html.text "Handmade with love (and Vim and elm) ;)"
, Html.a
@ -29,8 +29,21 @@ view model =
}
text : Html.Html Msg.Msg
text =
text : Model -> Html.Html Msg.Msg
text model =
if model.showExtraText then
Html.p
[ Html.Attributes.class "extra-text" ]
[ Html.strong [] [ Html.text model.extraText.title ]
, Html.span [] [ Html.text model.extraText.content ]
]
else
Html.span [] []
text2 : Html.Html Msg.Msg
text2 =
Html.p
[ Html.Attributes.class "extra-text" ]
[ Html.strong [] [ Html.text "Why are these available here?" ]

Loading…
Cancel
Save