Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Software
Shunting
Commits
36f754d1
Commit
36f754d1
authored
Nov 18, 2016
by
Thorsten Wißmann
🐧
Browse files
Make restart button configurable
parent
ed6693ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
rails.html
View file @
36f754d1
...
...
@@ -15,6 +15,13 @@
</head>
<body>
<script
type=
"text/javascript"
>
var
getParameters
=
location
.
search
.
substring
(
1
);
/* from http://stackoverflow.com/questions/8648892/convert-url-parameters-to-a-javascript-object */
getParameters
=
getParameters
?
JSON
.
parse
(
'
{"
'
+
getParameters
.
replace
(
/&/g
,
'
","
'
).
replace
(
/=/g
,
'
":"
'
)
+
'
"}
'
,
function
(
key
,
value
)
{
return
key
===
""
?
value
:
decodeURIComponent
(
value
)
})
:
{};
console
.
log
(
JSON
.
stringify
(
getParameters
));
var
proto
=
window
.
location
.
protocol
;
var
mobileBrowser
=
/* http://stackoverflow.com/a/11381730/4400896 */
navigator
.
userAgent
.
match
(
/Android/i
)
...
...
@@ -24,10 +31,12 @@
||
navigator
.
userAgent
.
match
(
/iPod/i
)
||
navigator
.
userAgent
.
match
(
/BlackBerry/i
)
||
navigator
.
userAgent
.
match
(
/Windows Phone/i
);
var
app
=
Elm
.
Main
.
fullscreen
(
{
var
app
Parameters
=
{
clickableHeader
:
(
proto
!=
"
file:
"
),
showRestart
:
(
proto
==
"
file:
"
),
minimalInterface
:
(
mobileBrowser
!=
null
),
});
};
var
app
=
Elm
.
Main
.
fullscreen
(
appParameters
);
app
.
ports
.
scrollIntoView
.
subscribe
(
function
(
elem_id
)
{
var
element
=
document
.
getElementById
(
elem_id
);
...
...
src/Main.elm
View file @
36f754d1
...
...
@@ -31,6 +31,7 @@ import Overlay
type
alias
Flags
=
{
clickableHeader
:
Bool
,
minimalInterface
:
Bool
-- whether to show a more minimal 'mobile' version
,
showRestart
:
Bool
-- whether to show a restart-button
}
type
alias
Model
=
...
...
@@ -310,7 +311,7 @@ viewNavigation model =
[
HA
.
href
"
javascript: ;"
,
HE
.
onClick
msg
]
[
MultiLang
.
text
en
de
]
in
(
if
model
.
flags
.
minimalInterface
(
(
if
model
.
flags
.
minimalInterface
then
(
::
)
[
a
main_page_url
[
img
...
...
@@ -324,10 +325,18 @@ viewNavigation model =
]
]
else
identity
)
[
[
Html
.
a
[
HA
.
style
[(
,
)
"
font-weight"
"
bold"
]
,
HA
.
href
"
rails.html"
]
[
MultiLang
.
text
"
Restart"
"
Neu Starten"
]
]
,
[
link
(
ForRails
RailPuzzle
.
undo
)
"
Undo"
"
Rückgängig"
]
)
<|
(
if
model
.
flags
.
showRestart
then
(
::
)
[
Html
.
a
[
HA
.
style
[(
,
)
"
font-weight"
"
bold"
]
,
HA
.
href
"
rails.html"
]
[
MultiLang
.
text
"
Restart"
"
Neu Starten"
]
]
else
identity
)
<|
[
[
link
(
ForRails
RailPuzzle
.
undo
)
"
Undo"
"
Rückgängig"
]
,
[
link
resetCars
"
Reset All Cars"
"
Zurücksetzen"
]
,
[
Html
.
span
[
HA
.
style
[(
,
)
"
margin-right"
"
1em"
]
]
...
...
@@ -348,6 +357,7 @@ viewNavigation model =
]
,
[
Html
.
map
ForMultiLang
<|
MultiLang
.
viewSwitcher
model
.
languageSwitcher
]
]
)
|>
List
.
filter
(
not
<<
List
.
isEmpty
)
|>
List
.
map
(
Html
.
li
[])
|>
Html
.
ul
[
HA
.
id
"
navigationbar"
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment