Add the station tag

This commit is contained in:
nemunaire 2018-06-06 21:24:50 +02:00
parent bb6b933762
commit 7d05a79ab3
2 changed files with 15 additions and 0 deletions

13
app.js
View File

@ -115,6 +115,18 @@ function getSchedule(type, code, station, way) {
});
}
function defineTag(type, station) {
station = station.replace(/\+/g, " ").replace(/\b[a-z]/g, function(letter) {
return letter.toUpperCase();
}).replace(/\b(de|du|sur)\b/gi, function(word) {
return word.toLowerCase();
});
$("#station").text(station);
$(".navbar-brand").hide();
$("#station").show();
$("title").text("RATP - Prochains passages à " + (type == "bus" ? "l'arrêt" : "la station") + " " + station);
}
function updateTime(time) {
var hours = time.getHours();
var minutes = time.getMinutes();
@ -146,6 +158,7 @@ function main(uri, fetchTrafic) {
if (uri.length == 3)
uri.push("A+R");
defineTag(uri[0], uri[2]);
getSchedule(uri[0], uri[1], uri[2], uri[3]);
if (fetchTrafic)
getTraffic(uri[0], uri[1]);

View File

@ -55,6 +55,8 @@
<button type="submit" class="btn btn-primary" disabled>Go !</button>
</form>
<h2 id="station" style="display: none"></h2>
<div id="schedule">
<h3></h3>
<dl></dl>