A music player that connects to your cloud/distributed storage.
at main 1.1 kB view raw
1module Html.Ext exposing (..) 2 3import Html exposing (Attribute, Html) 4import Html.Events exposing (keyCode, on, preventDefaultOn, stopPropagationOn) 5import Json.Decode as Json 6 7 8lineBreak : Html msg 9lineBreak = 10 Html.br [] [] 11 12 13onClickStopPropagation : msg -> Attribute msg 14onClickStopPropagation msg = 15 stopPropagationOn "click" (Json.succeed ( msg, True )) 16 17 18onDoubleTap : msg -> Attribute msg 19onDoubleTap msg = 20 on "dbltap" (Json.succeed msg) 21 22 23onEnterKey : msg -> Attribute msg 24onEnterKey msg = 25 on "keydown" (Json.andThen (ifEnterKey msg) keyCode) 26 27 28ifEnterKey : msg -> Int -> Json.Decoder msg 29ifEnterKey msg key = 30 case key of 31 13 -> 32 Json.succeed msg 33 34 _ -> 35 Json.fail "Another key, that isn't enter, was pressed" 36 37 38onTap : msg -> Attribute msg 39onTap msg = 40 on "tap" (Json.succeed msg) 41 42 43onTapPreventDefault : msg -> Attribute msg 44onTapPreventDefault msg = 45 preventDefaultOn "tap" (Json.succeed ( msg, True )) 46 47 48onTapStopPropagation : msg -> Attribute msg 49onTapStopPropagation msg = 50 stopPropagationOn "tap" (Json.succeed ( msg, True ))