Add the station tag
This commit is contained in:
parent
bb6b933762
commit
7d05a79ab3
13
app.js
13
app.js
@ -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) {
|
function updateTime(time) {
|
||||||
var hours = time.getHours();
|
var hours = time.getHours();
|
||||||
var minutes = time.getMinutes();
|
var minutes = time.getMinutes();
|
||||||
@ -146,6 +158,7 @@ function main(uri, fetchTrafic) {
|
|||||||
if (uri.length == 3)
|
if (uri.length == 3)
|
||||||
uri.push("A+R");
|
uri.push("A+R");
|
||||||
|
|
||||||
|
defineTag(uri[0], uri[2]);
|
||||||
getSchedule(uri[0], uri[1], uri[2], uri[3]);
|
getSchedule(uri[0], uri[1], uri[2], uri[3]);
|
||||||
if (fetchTrafic)
|
if (fetchTrafic)
|
||||||
getTraffic(uri[0], uri[1]);
|
getTraffic(uri[0], uri[1]);
|
||||||
|
@ -55,6 +55,8 @@
|
|||||||
<button type="submit" class="btn btn-primary" disabled>Go !</button>
|
<button type="submit" class="btn btn-primary" disabled>Go !</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<h2 id="station" style="display: none"></h2>
|
||||||
|
|
||||||
<div id="schedule">
|
<div id="schedule">
|
||||||
<h3></h3>
|
<h3></h3>
|
||||||
<dl></dl>
|
<dl></dl>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user