From 7d05a79ab3515e957c2a5d04fa3dc8e1aa530c4e Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 6 Jun 2018 21:24:50 +0200 Subject: [PATCH] Add the station tag --- app.js | 13 +++++++++++++ index.html | 2 ++ 2 files changed, 15 insertions(+) diff --git a/app.js b/app.js index 766ba45..ab50a66 100644 --- a/app.js +++ b/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) { 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]); diff --git a/index.html b/index.html index ce9fa21..5f471e1 100644 --- a/index.html +++ b/index.html @@ -55,6 +55,8 @@ + +