Commit 3650dfef authored by Thorsten Wißmann's avatar Thorsten Wißmann 🐧
Browse files

Minimal interface for mobile browsers

parent e8351c67
...@@ -3,5 +3,6 @@ elm-stuff/ ...@@ -3,5 +3,6 @@ elm-stuff/
*~ *~
rails.js rails.js
logo.png logo.png
logo_negated.png
fau_black.png fau_black.png
favicon.png favicon.png
...@@ -4,7 +4,7 @@ TARGET=rails.js ...@@ -4,7 +4,7 @@ TARGET=rails.js
SRC=$(shell find src/ -name '*.elm' ) SRC=$(shell find src/ -name '*.elm' )
CSS=$(wildcard *.css) CSS=$(wildcard *.css)
IMG = logo.png fau_black.png favicon.png IMG = logo.png fau_black.png favicon.png logo_negated.png
.PHONY: clean install .PHONY: clean install
...@@ -13,6 +13,9 @@ all: $(TARGET) $(IMG) ...@@ -13,6 +13,9 @@ all: $(TARGET) $(IMG)
logo.png: logo.png:
wget -O $@ https://www8.cs.fau.de/lib/tpl/mnml-blog/user/logo.png wget -O $@ https://www8.cs.fau.de/lib/tpl/mnml-blog/user/logo.png
logo_negated.png: logo.png
convert $< -negate -crop 100x40+0+40 +repage $@
fau_black.png: fau_black.png:
wget -O $@ https://www8.cs.fau.de/lib/tpl/mnml-blog/user/fau_black.png wget -O $@ https://www8.cs.fau.de/lib/tpl/mnml-blog/user/fau_black.png
......
...@@ -64,3 +64,11 @@ ...@@ -64,3 +64,11 @@
overflow: hidden; overflow: hidden;
} }
.minimalInterface > #pagewrap {
margin: 0px;
padding: 0px;
}
.minimalInterface #navigationbar {
margin-left: 0px;
}
...@@ -16,9 +16,17 @@ ...@@ -16,9 +16,17 @@
<body> <body>
<script type="text/javascript"> <script type="text/javascript">
var proto = window.location.protocol; var proto = window.location.protocol;
console.log(proto); var mobileBrowser = /* http://stackoverflow.com/a/11381730/4400896 */
navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i);
var app = Elm.Main.fullscreen({ var app = Elm.Main.fullscreen({
clickableHeader: (proto != "file:"), clickableHeader: (proto != "file:"),
minimalInterface : (mobileBrowser != null),
}); });
app.ports.scrollIntoView.subscribe( app.ports.scrollIntoView.subscribe(
function(elem_id) { function(elem_id) {
......
...@@ -31,6 +31,7 @@ import Overlay ...@@ -31,6 +31,7 @@ import Overlay
type alias Flags = type alias Flags =
{ clickableHeader : Bool { clickableHeader : Bool
, minimalInterface : Bool -- whether to show a more minimal 'mobile' version
} }
type alias Model = type alias Model =
...@@ -270,6 +271,11 @@ hasNextPuzzle model = ...@@ -270,6 +271,11 @@ hasNextPuzzle model =
viewNavigation : Model -> Html Msg viewNavigation : Model -> Html Msg
viewNavigation model = viewNavigation model =
let let
main_page_url =
if model.flags.clickableHeader
then [ HA.href "/" ]
else []
a_href t l = [ Html.a [ HA.href l ] [ text t ] ] a_href t l = [ Html.a [ HA.href l ] [ text t ] ]
-- the attributes for the i'th option of the network select combobox -- the attributes for the i'th option of the network select combobox
...@@ -305,6 +311,21 @@ viewNavigation model = ...@@ -305,6 +311,21 @@ viewNavigation model =
[ HA.href "javascript: ;", HE.onClick msg ] [ HA.href "javascript: ;", HE.onClick msg ]
[MultiLang.text en de] [MultiLang.text en de]
in in
( if model.flags.minimalInterface
then (::)
[ a main_page_url
[ img
[ HA.src "logo_negated.png"
, HA.style
[(,) "height" "2.4em"
,(,) "margin" "-5px -5px"
--,(,) "border" "1px solid red"
]
] []
]
]
else identity
)
[ [ link (ForRails RailPuzzle.undo) "Undo" "Rückgängig"] [ [ link (ForRails RailPuzzle.undo) "Undo" "Rückgängig"]
, [ link resetCars "Reset All Cars" "Zurücksetzen" ] , [ link resetCars "Reset All Cars" "Zurücksetzen" ]
, [ Html.span , [ Html.span
...@@ -333,10 +354,19 @@ viewNavigation model = ...@@ -333,10 +354,19 @@ viewNavigation model =
view : Model -> Html Msg view : Model -> Html Msg
view model = view model =
div [HA.class <| MultiLang.class model.languageSwitcher] div
[HA.classList
[ (MultiLang.class model.languageSwitcher, True)
, ("minimalInterface", model.flags.minimalInterface)
]
]
<|
[ div [ HA.id "pagewrap" ] [ div [ HA.id "pagewrap" ]
[ viewHeader model.flags.clickableHeader (
, viewNavigation model (if model.flags.minimalInterface
then identity
else (::) (viewHeader model.flags.clickableHeader))
[ viewNavigation model
, div [HA.classList , div [HA.classList
[ ("taskOrCongrats", True) [ ("taskOrCongrats", True)
, ("solved", RailPuzzle.isSolved model.rails) , ("solved", RailPuzzle.isSolved model.rails)
...@@ -350,11 +380,16 @@ view model = ...@@ -350,11 +380,16 @@ view model =
] ]
, div [HA.id "mainrailpuzzle" ] , div [HA.id "mainrailpuzzle" ]
[ Html.map ForRails <| RailPuzzle.view model.rails ] [ Html.map ForRails <| RailPuzzle.view model.rails ]
, Html.map ForSmv <| Html.lazy NuSmvInput.viewSmvOptions model.smv
] ]
++ if model.flags.minimalInterface
then []
else [ Html.map ForSmv <| Html.lazy NuSmvInput.viewSmvOptions model.smv ]
)
, Html.map ForOverlay <| Html.lazy Overlay.view model.overlay , Html.map ForOverlay <| Html.lazy Overlay.view model.overlay
, Html.lazy NuSmvInput.viewPlaceholder model.smv
] ]
++ if model.flags.minimalInterface
then []
else [ Html.lazy NuSmvInput.viewPlaceholder model.smv ]
-- vim: ft=elm et ts=2 sw=2 -- vim: ft=elm et ts=2 sw=2
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment