templates/stop.html

Thu, 20 Dec 2018 23:11:07 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 20 Dec 2018 23:11:07 +0200
changeset 135
ca21302d1a74
parent 134
4ac0f2e2ec4e
child 136
27324a81beca
permissions
-rw-r--r--

added Yli-maarian koulu

77
83cd29dee853 stop_week
Teemu Piippo <teemu@hecknology.net>
parents: 67
diff changeset
1 {% from "macros.html" import route_rep %}
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 <html>
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 <head>
35
Teemu Piippo <teemu@hecknology.net>
parents: 34
diff changeset
4 <link rel="icon" type="image/png" href="../static/favicon.png" />
Teemu Piippo <teemu@hecknology.net>
parents: 34
diff changeset
5 <link rel="stylesheet" type="text/css" href="../static/style.css" />
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 <meta charset='UTF-8' />
33
f448f291c1dd Korjattu pysäkkisivun otsikko
Teemu Piippo <teemu@hecknology.net>
parents: 32
diff changeset
7 <title>{{name}}</title>
32
ca1a0ea81cf6 Yhdistetty pysäkki.png ja iso-pysäkki.png
Teemu Piippo <teemu@hecknology.net>
parents: 27
diff changeset
8 <meta http-equiv='refresh' content='60'>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 <style>
21
6a0394d5a159 Yleistä päivittelyä
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
10 .sarake-määränpää
6a0394d5a159 Yleistä päivittelyä
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
11 {
6a0394d5a159 Yleistä päivittelyä
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
12 text-align: left;
6a0394d5a159 Yleistä päivittelyä
Teemu Piippo <teemu@hecknology.net>
parents: 20
diff changeset
13 }
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
14
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
15 .dataentry
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
16 {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
17 display: none;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
18 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
19
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
20 .sarake-aika
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
21 {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
22 width: 150pt;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
23 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
24
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
25 .gone
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
26 {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
27 background-color: #666;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
28 color: silver;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
29 font-style: italic;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
30 display: none;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
31 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
32
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
33 tbody tr:nth-child(even).gone
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
34 {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
35 background-color: #585858;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
36 }
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 </style>
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
38 <script>
134
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
39 var getJSON = function(url, callback)
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
40 {
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
41 var xhr = new XMLHttpRequest();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
42 xhr.open('GET', url, true);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
43 xhr.responseType = 'json';
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
44 xhr.onload = function() {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
45 var status = xhr.status;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
46 if (status === 200) {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
47 callback(xhr.response);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
48 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
49 };
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
50 xhr.send();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
51 };
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
52
134
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
53 function timeConverter(UNIX_timestamp)
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
54 {
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
55 var a = new Date(UNIX_timestamp * 1000);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
56 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
57 var year = a.getFullYear();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
58 var month = months[a.getMonth()];
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
59 var date = a.getDate();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
60 var hour = a.getHours();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
61 var min = a.getMinutes();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
62 var sec = a.getSeconds();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
63 var time = hour + ':' + (min < 10 ? '0' : '') + min;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
64 return time;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
65 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
66
134
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
67 function epoch()
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
68 {
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
69 var d = new Date();
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
70 if (d.getHours() < 4)
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
71 d.setDate(d.getDate() - 1);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
72 d.setHours(0);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
73 d.setMinutes(0);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
74 d.setSeconds(0);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
75 return Math.floor(d.getTime() / 1000);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
76 }
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
77
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
78 function primarykey(data)
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
79 {
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
80 var key = data['blockref'] + '-';
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
81 key += (data['originaimeddeparturetime'] - epoch()).toString() + '-';
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
82 key += data['visitnumber'];
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
83 return key;
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
84 }
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
85
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
86 function updateTime(key, time)
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
87 {
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
88 const d = new Date();
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
89 const now = (d.getTime() + d.getTimezoneOffset()) / 1000;
134
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
90 row = document.getElementById(key);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
91 timeCell = document.getElementById(key + '-time');
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
92 t0 = parseInt(document.getElementById(key + '-stamp').innerHTML);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
93 if (Math.abs(time - t0) > 90)
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
94 {
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
95 oldTime = timeConverter(t0);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
96 newTime = timeConverter(time);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
97 timeCell.innerHTML = '<s style="color:gray">' + oldTime + '</s> ⟶ <b>' + newTime + '</b>';
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
98 }
134
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
99
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
100 if (time + 15 > now)
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
101 row.classList.remove('gone');
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
102 else
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
103 row.classList.add('gone');
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
104 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
105 </script>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
106 </head>
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
107 <body>
93
53ee9e945673 added ferry support
Teemu Piippo <teemu@hecknology.net>
parents: 90
diff changeset
108 <table class='aikataulu service-{{service}}' cellspacing="0">
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
109 <thead>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
110 <tr>
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
111 <th colspan='4' class='primary-heading'>
90
Teemu Piippo <teemu@hecknology.net>
parents: 77
diff changeset
112 <span><img src="../static/{{typename}}.png" height="96" /> {{name}}</span>
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
113 </th>
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
114 </tr>
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
115 <tr class='headings'>
20
3199e289ae62 - Sivusto hieman edustuksellisempi
Teemu Piippo <teemu@hecknology.net>
parents: 19
diff changeset
116 <th class='sarake-aika'>{{tr('time', 'headings')}}</th>
3199e289ae62 - Sivusto hieman edustuksellisempi
Teemu Piippo <teemu@hecknology.net>
parents: 19
diff changeset
117 <th class='sarake-linja'>{{tr('route', 'headings')}}</th>
3199e289ae62 - Sivusto hieman edustuksellisempi
Teemu Piippo <teemu@hecknology.net>
parents: 19
diff changeset
118 <th class='sarake-määränpää'>{{tr('destination', 'headings')}}</th>
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
119 <th>
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
120 <span class='actions'>
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
121 <a class="pysäkki-sijainti" href="{{link_to_map}}" target="_blank">📌</a>
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
122 {% if cluster %}
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
123 <a href="../stop_cluster/{{cluster}}">🞊</a>
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
124 {% endif %}
109
88a5110b66ba added some features
Teemu Piippo <teemu@hecknology.net>
parents: 93
diff changeset
125 <a href='../stop_week/{{ref}}'>&#9636;</a>
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
126 </th>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
127 </tr>
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
128 </thead>
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
129 <tbody id='departures-table'>
24
e6bdb9c54096 Yhtenäistetty ohjelmakoodin kieli englanniksi
Teemu Piippo <teemu@hecknology.net>
parents: 22
diff changeset
130 {% for halt in schedule %}
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
131 <tr class="{% if halt['night'] %}{% endif %}{% if halt['gone'] %}gone{% endif %}" id="{{halt['id']}}">
41
Teemu Piippo <teemu@hecknology.net>
parents: 40
diff changeset
132 <td class='sarake-aika'>
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
133 <!--
41
Teemu Piippo <teemu@hecknology.net>
parents: 40
diff changeset
134 {% if halt['imminent'] %}
Teemu Piippo <teemu@hecknology.net>
parents: 40
diff changeset
135 <span class='imminent-leave'>●</span>
Teemu Piippo <teemu@hecknology.net>
parents: 40
diff changeset
136 {% endif %}
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
137 -->
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
138 <span id="{{halt['id']}}-time"></span>
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
139 <span class='dataentry' id="{{halt['id']}}-stamp">{{halt['timestamp']}}</span>
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
140 <!--{{halt['time']}}--></td>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
141 <td class='sarake-linja linja'>
77
83cd29dee853 stop_week
Teemu Piippo <teemu@hecknology.net>
parents: 67
diff changeset
142 <a href="../trip/{{halt['trip']}}">{{route_rep(halt['route-splice'])}}</a>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
143 </td>
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
144 <td class='sarake-määränpää' colspan='2'>
48
428cfdf64ccc Lisätty uudelleenohjauksia
Teemu Piippo <teemu@hecknology.net>
parents: 41
diff changeset
145 <a href="../trip/{{halt['trip']}}">{{halt['sign']}}</a>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
146 </td>
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
147 </tr>
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
148 {% endfor %}
55
0f1d046b3f78 Suppeampi näkymä, pikatiet ja mootoritiet
Teemu Piippo <teemu@hecknology.net>
parents: 48
diff changeset
149 </tbody>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
150 </table>
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
151 <script>
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
152 var list = document.getElementById('departures-table').children;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
153 for (var i = 0; i < list.length; i += 1) {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
154 id = list[i].id;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
155 timestamp = parseInt(document.getElementById(id + '-stamp').innerHTML);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
156 document.getElementById(id + '-time').innerHTML = timeConverter(timestamp);
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
157 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
158 //updateTime('fbf6f367-069c-4f8d-831b-bd36cd643f3b', 1544092500);
133
Teemu Piippo <teemu@hecknology.net>
parents: 127
diff changeset
159 getJSON('https://data.foli.fi/siri/sm/{{ref}}', function(data){
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
160 var arrayLength = data['result'].length;
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
161 for (var i = 0; i < arrayLength; i++) {
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
162 var blockref = data['result'][i]['blockref'];
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
163 var originaimeddeparturetime = data['result'][i]['originaimeddeparturetime'];
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
164 var expecteddeparturetime = data['result'][i]['expecteddeparturetime'];
134
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
165 var key = primarykey(data['result'][i]);
4ac0f2e2ec4e removed uuid mapping
Teemu Piippo <teemu@hecknology.net>
parents: 133
diff changeset
166 updateTime(key, expecteddeparturetime);
127
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
167 }
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
168 });
2bc0529d44a5 bus live information
Teemu Piippo <teemu@hecknology.net>
parents: 109
diff changeset
169 </script>
0
fc48613c73e5 Alustava versio
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
170 </body>
4
Teemu Piippo <teemu@hecknology.net>
parents: 0
diff changeset
171 </html>

mercurial