Added date on view train page

This commit is contained in:
Kenneth Bruen 2022-07-13 01:43:43 +03:00
parent b0afb0dfea
commit c86c7c14ad
Signed by: kbruen
GPG key ID: CB77B9FE7F902176
3 changed files with 18 additions and 2 deletions

View file

@ -14,8 +14,17 @@
color: black; color: black;
} }
#comp-date {
display: flex;
justify-content: space-between;
}
#company { #company {
text-align: center; text-align: start;
}
#date {
text-align: end;
} }
.stationItem { .stationItem {

View file

@ -14,7 +14,10 @@
</head> </head>
<body> <body>
<h1>Train Info</h1> <h1>Train Info</h1>
<div id="comp-date">
<p class="sec" id="company"></p> <p class="sec" id="company"></p>
<p class="sec" id="date"></p>
</div>
<div class="content" tabindex="0"> <div class="content" tabindex="0">
<div id="route"> <div id="route">

View file

@ -16,6 +16,7 @@ function onTrainData(data) {
title.appendChild(document.createTextNode(` ${data.number}`)) title.appendChild(document.createTextNode(` ${data.number}`))
document.getElementById('company').textContent = data.operator document.getElementById('company').textContent = data.operator
document.getElementById('date').textContent = data.date
document.getElementById('route-from').textContent = data.route.from document.getElementById('route-from').textContent = data.route.from
document.getElementById('route-to').textContent = data.route.to document.getElementById('route-to').textContent = data.route.to
@ -198,6 +199,9 @@ function refresh() {
onTrainData(response) onTrainData(response)
}) })
.then(function () { .then(function () {
if (refreshStopToken != null) {
clearTimeout(refreshStopToken)
}
refreshStopToken = setTimeout(function () { refreshStopToken = setTimeout(function () {
refresh() refresh()
}, 60000) }, 60000)