Skip to content

Instantly share code, notes, and snippets.

@proProbe
Created July 20, 2016 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proProbe/8e6f5ba0b23e3c8f2813ac1ea305a5c9 to your computer and use it in GitHub Desktop.
Save proProbe/8e6f5ba0b23e3c8f2813ac1ea305a5c9 to your computer and use it in GitHub Desktop.
module Main exposing (..)
import Html exposing (..)
import Html.App exposing (beginnerProgram)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
import Html.Lazy exposing (..)
view model =
let
html =
case model of
True ->
lazyVideoHtml model
False ->
div [] [ text "no iframes" ]
in
div []
[ button [ onClick Toggle ] [ text "Toggle view" ]
, html
]
type Msg
= Toggle
update msg model =
case msg of
Toggle ->
not model
main =
beginnerProgram { model = False, view = view, update = update }
-- Helpers
lazyVideoHtml =
lazy videoHtml
videoHtml model =
div []
[ text "should show tons of videos"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
, videoContainer "https://www.youtube.com/embed/pmWtTUjRxig"
]
videoContainer : String -> Html msg
videoContainer videoSrc =
div [ class "video-container" ]
[ iframe
[ type' "text/html"
, src <| videoSrc ++ "?showinfo=0&autohide=1&?wmode=opaque"
, attribute "frameborder" "0"
, attribute "allowfullscreen" "True"
]
[]
]
(=>) =
(,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment