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/
*~
rails.js
logo.png
logo_negated.png
fau_black.png
favicon.png
......@@ -4,7 +4,7 @@ TARGET=rails.js
SRC=$(shell find src/ -name '*.elm' )
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
......@@ -13,6 +13,9 @@ all: $(TARGET) $(IMG)
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:
wget -O $@ https://www8.cs.fau.de/lib/tpl/mnml-blog/user/fau_black.png
......
......@@ -64,3 +64,11 @@
overflow: hidden;
}
.minimalInterface > #pagewrap {
margin: 0px;
padding: 0px;
}
.minimalInterface #navigationbar {
margin-left: 0px;
}
......@@ -16,9 +16,17 @@
<body>
<script type="text/javascript">
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({
clickableHeader: (proto != "file:"),
minimalInterface : (mobileBrowser != null),
});
app.ports.scrollIntoView.subscribe(
function(elem_id) {
......
......@@ -31,6 +31,7 @@ import Overlay
type alias Flags =
{ clickableHeader : Bool
, minimalInterface : Bool -- whether to show a more minimal 'mobile' version
}
type alias Model =
......@@ -270,6 +271,11 @@ hasNextPuzzle model =
viewNavigation : Model -> Html Msg
viewNavigation model =
let
main_page_url =
if model.flags.clickableHeader
then [ HA.href "/" ]
else []
a_href t l = [ Html.a [ HA.href l ] [ text t ] ]
-- the attributes for the i'th option of the network select combobox
......@@ -305,6 +311,21 @@ viewNavigation model =
[ HA.href "javascript: ;", HE.onClick msg ]
[MultiLang.text en de]
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 resetCars "Reset All Cars" "Zurücksetzen" ]
, [ Html.span
......@@ -333,10 +354,19 @@ viewNavigation model =
view : Model -> Html Msg
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" ]
[ viewHeader model.flags.clickableHeader
, viewNavigation model
(
(if model.flags.minimalInterface
then identity
else (::) (viewHeader model.flags.clickableHeader))
[ viewNavigation model
, div [HA.classList
[ ("taskOrCongrats", True)
, ("solved", RailPuzzle.isSolved model.rails)
......@@ -350,11 +380,16 @@ view model =
]
, div [HA.id "mainrailpuzzle" ]
[ 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.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
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