Also refresh traffic info
This commit is contained in:
parent
69a5fa5a8a
commit
64d578c3ba
10
app.js
10
app.js
@ -8,6 +8,7 @@ $("#traffic").hide();
|
||||
$("#schedule").hide();
|
||||
$("#loading").hide();
|
||||
var nextSchedule = null;
|
||||
var nextTraffic = null;
|
||||
|
||||
var uri = window.location.pathname.split("/").filter(function(v) {
|
||||
return v.length > 0;
|
||||
@ -80,10 +81,19 @@ function findStations(type, code) {
|
||||
|
||||
function getTraffic(type, code) {
|
||||
$("#traffic").hide();
|
||||
if (nextTraffic != null) {
|
||||
clearTimeout(nextTraffic);
|
||||
nextTraffic = null;
|
||||
}
|
||||
|
||||
$.getJSON( BASE_API + "/traffic/" + type + "/" + code, function( data ) {
|
||||
$("#traffic h3").text(data["result"]["line"] + " : " + data["result"]["title"]);
|
||||
$("#traffic p").text(data["result"]["message"]);
|
||||
$("#traffic").show();
|
||||
|
||||
nextTraffic = setTimeout(function() {
|
||||
getSchedule(type, code);
|
||||
}, 150000);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user