Created
September 26, 2014 18:42
-
-
Save paulopatto/2a49a42ec7c35e4cf092 to your computer and use it in GitHub Desktop.
Status linhas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"CurrentLineStatus": { | |
"DateUpdateFormated": "26/09/2014 15:35", | |
"Status": "Operação Normal", | |
"Icon": "20140415_6f5dad3fe3bd4abfa1f5ad90c87bed6a_normal.png", | |
"FinalDescription": null | |
}, | |
"StatusMetro": { | |
"ListLineStatus": [ | |
{ | |
"Id": "1", | |
"Color": "Azul", | |
"Line": "Linha 1 - Azul", | |
"LineRaw": "Linha 1", | |
"StatusMetro": "Velocidade Reduzida", | |
"Status": 1, | |
"Description": "Devido às chuvas, os trens da Linha 1 - Azul estão circulando com velocidade reduzida entre as estações TIRADENTES e TUCURUVI." | |
}, | |
{ | |
"Id": "2", | |
"Color": "Verde", | |
"Line": "Linha 2 - Verde", | |
"LineRaw": "Linha 2", | |
"StatusMetro": "Velocidade Reduzida", | |
"Status": 1, | |
"Description": "Devido às chuvas, os trens da Linha 2 - Verde estão circulando com velocidade reduzida entre as estações ALTO DO IPIRANGA e CHACARA KLABIN." | |
}, | |
{ | |
"Id": "3", | |
"Color": "Vermelha", | |
"Line": "Linha 3 - Vermelha", | |
"LineRaw": "Linha 3", | |
"StatusMetro": "Velocidade Reduzida", | |
"Status": 1, | |
"Description": "Devido às chuvas, os trens da Linha 3 - Vermelha estão circulando com velocidade reduzida entre as estações e PALMEIRAS BARRA FUNDA." | |
}, | |
{ | |
"Id": "5", | |
"Color": "Lilás", | |
"Line": "Linha 5 - Lilás", | |
"LineRaw": "Linha 5", | |
"StatusMetro": "Velocidade Reduzida", | |
"Status": 1, | |
"Description": "Devido às chuvas, os trens da Linha 5 - Lilás estão circulando com velocidade reduzida entre as estações CAPAO REDONDO e ADOLFO PINHEIRO." | |
} | |
], | |
"DateUpdateMetro": "26/09/2014 15:35" | |
}, | |
"DateUpdateMetro": "26/09/2014 15:35" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remote Address:187.17.82.243:80 | |
Request URL:http://www.viaquatro.com.br/generic/Main/LineStatus?_=1411756584292 | |
Request Method:GET | |
Status Code:200 OK | |
Request Headersview source | |
Accept:*/* | |
Accept-Encoding:gzip,deflate,sdch | |
Accept-Language:en-US,en;q=0.8,pt;q=0.6 | |
Cache-Control:max-age=0 | |
Connection:keep-alive | |
Cookie:ASP.NET_SessionId=kqftspowhlrgzxk3gxvdce5w; Alert=DateUpdateCookie=635472409440000000; __utma=219144734.764732152.1411756455.1411756455.1411756455.1; __utmb=219144734.2.10.1411756455; __utmc=219144734; __utmz=219144734.1411756455.1.1.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); MiniProfilerEnabled=0 | |
Host:www.viaquatro.com.br | |
Referer:http://www.viaquatro.com.br/ | |
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36 | |
X-Requested-With:XMLHttpRequest | |
Query String Parametersview sourceview URL encoded | |
_:1411756584292 | |
Response Headersview source | |
Cache-Control:private | |
Content-Length:1389 | |
Content-Type:application/json; charset=utf-8 | |
Date:Fri, 26 Sep 2014 18:35:00 GMT | |
Server:Microsoft-IIS/7.5 | |
Set-Cookie:MiniProfilerEnabled=0; path=/ | |
X-AspNet-Version:4.0.30319 | |
X-AspNetMvc-Version:3.0 | |
X-Powered-By:ASP.NET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var StatusLine = { | |
Init: function () { | |
StatusLine.Reload(); | |
setInterval(function () { StatusLine.Reload() }, 60000); | |
}, | |
Reload: function () { | |
$.ajax({ | |
url: '/generic/Main/LineStatus', | |
cache: false, | |
type: 'get', | |
success: function loadLineStatus(data) { | |
if (data != null && data != undefined) { | |
$('#dateCurrentLineFourStatus').html(data.CurrentLineStatus.DateUpdateFormated); | |
$('#imageCurrentLineFourStatus').attr('src', '/Media/Service/Icon/source/' + data.CurrentLineStatus.Icon); | |
$('#imageCurrentLineFourStatus').attr('alt', data.CurrentLineStatus.Status); | |
$('# e').html('<div id="status-wrapper">' + data.CurrentLineStatus.FinalDescription + '</div>'); | |
for (var i = 0; i < data.StatusMetro.ListLineStatus.length; i++) { | |
$('#description_' + data.StatusMetro.ListLineStatus[i].Id).html(data.StatusMetro.ListLineStatus[i].StatusMetro); | |
var imageName = ''; | |
var statusMobile = ''; | |
switch (data.StatusMetro.ListLineStatus[i].StatusMetro) { | |
case 'Operação Normal': | |
imageName = 'normal.png'; | |
statusMobile = 'normal'; | |
break; | |
case 'Velocidade Reduzida': | |
imageName = 'reduzida.png'; | |
statusMobile = 'reduzida'; | |
break; | |
case 'Operação Encerrada': | |
imageName = 'encerrada.png'; | |
statusMobile = 'encerrada'; | |
break; | |
case 'Paralisada': | |
imageName = 'paralisada.png'; | |
statusMobile = 'paralisada'; | |
break; | |
case 'Operação Parcial': | |
imageName = 'parcial.png'; | |
statusMobile = 'parcial'; | |
break; | |
default: | |
imageName = 'indisponivel.png'; | |
statusMobile = 'dados indisponíveis'; | |
break; | |
} | |
$('[name="image_' + data.StatusMetro.ListLineStatus[i].Id + '"').attr('src', '/Content/img/ico/trafego/' + imageName); | |
$('[name="statusMobile_' + data.StatusMetro.ListLineStatus[i].Id + '"').text(statusMobile); | |
} | |
$('#dateStatusMetro').html('Atualizadas em ' + data.StatusMetro.DateUpdateMetro); | |
} | |
} | |
}); | |
} | |
} | |
$(document).ready(function () { | |
StatusLine.Init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment