Created
March 5, 2016 06:44
-
-
Save clarkf/b443ca30923de5f1c0ca to your computer and use it in GitHub Desktop.
Functional. Reactive. Beautiful. Try pasting this at http://elm-lang.org/try
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (iframe, Html) | |
import Html.Attributes exposing (seamless, attribute, height) | |
import String exposing (concat, join) | |
-- FIXME | |
secure_required : Bool | |
secure_required = True | |
protocol : String | |
protocol = | |
if secure_required | |
then "https" | |
else "http" | |
join_path : List String -> String | |
join_path fragments = | |
join "/" fragments | |
query_item : String -> String -> String | |
query_item k v = | |
k ++ "=" ++ v | |
join_query : List String -> String | |
join_query kvs = | |
join "&" kvs | |
full_url : String -> List String -> List String -> String | |
full_url domain paths queries = | |
concat [ protocol | |
, "://" | |
, domain | |
, "/" | |
, join_path paths | |
, "?" | |
, join_query queries | |
] | |
target_url : String -> String | |
target_url id = | |
full_url "youtube.com" ["embed", id] ["autoplay=1", "showinfo=0", "controls=0"] | |
src : String -> Html.Attribute | |
src value = attribute "src" value | |
frameborder : String -> Html.Attribute | |
frameborder value = attribute "frameborder" value | |
width : String -> Html.Attribute | |
width value = attribute "width" value | |
embed : String -> Html | |
embed url = | |
iframe [ seamless True, src url, frameborder "0", width "100%", height 800] [] | |
main = embed (target_url ("UJDhBU-LneM")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment