Fri, 21 Sep 2018 00:20:40 +0300
added links to stop_week
68 | 1 | <html> |
2 | <head> | |
3 | <link rel="icon" type="image/png" href="../static/favicon.png" /> | |
4 | <link rel="stylesheet" type="text/css" href="../static/style.css" /> | |
5 | <meta charset='UTF-8' /> | |
6 | <title>{{name}}</title> | |
7 | <meta http-equiv='refresh' content='30'> | |
8 | <style> | |
9 | .sarake-määränpää | |
10 | { | |
11 | text-align: left; | |
12 | } | |
13 | ||
14 | .next-leave | |
15 | { | |
16 | margin-left: 1vw; | |
17 | margin-right: 1vw; | |
18 | } | |
19 | ||
20 | .next-leave td | |
21 | { | |
85 | 22 | height: 12vh; |
68 | 23 | vertical-align: middle; |
24 | } | |
25 | ||
76 | 26 | .next-leave-time, |
27 | .next-leave-route | |
68 | 28 | { |
29 | font-weight: bold; | |
30 | font-size: 10vmin; | |
31 | } | |
32 | ||
33 | .next-leave-time | |
34 | { | |
76 | 35 | text-align: left; |
68 | 36 | } |
37 | ||
85 | 38 | .next-leave-route .route-symbol |
68 | 39 | { |
76 | 40 | border: 0.5vmin solid black; |
41 | border-radius: 100%; | |
42 | padding: 8px; | |
43 | min-width: 12vmin; | |
44 | min-height: 12vmin; | |
45 | text-align: center; | |
46 | background: #ffd90f; | |
85 | 47 | } |
48 | ||
49 | .next-leave, .next-leave table | |
50 | { | |
51 | width: 100%; | |
68 | 52 | } |
53 | ||
76 | 54 | .next-leave-places |
68 | 55 | { |
76 | 56 | text-align: center; |
68 | 57 | } |
58 | ||
76 | 59 | .next-leave-places li |
68 | 60 | { |
61 | list-style: none; | |
62 | font-size: 6vmin; | |
63 | font-weight: normal; | |
85 | 64 | float: left; |
65 | padding-left: 10pt; | |
68 | 66 | } |
67 | ||
68 | #other-leaves | |
69 | { | |
70 | width: 100%; | |
71 | position: absolute; | |
72 | bottom: 0; | |
73 | background: #ccc; | |
74 | box-shadow: 0 0 1vw rgba(0, 0, 0, 0.5), inset 0 0 2vw rgba(0, 0, 0, 0.5); | |
75 | } | |
76 | ||
77 | #other-leaves table | |
78 | { | |
79 | width: 80%; | |
80 | margin: auto; | |
81 | margin-bottom: 10pt; | |
82 | margin-top: 10pt; | |
83 | } | |
84 | ||
85 | #other-leaves table td | |
86 | { | |
87 | font-size: 4vh; | |
88 | height: 5vh; | |
89 | text-align: center; | |
90 | } | |
91 | ||
85 | 92 | .next-leave-destination |
93 | { | |
94 | font-size: 7vh; | |
95 | font-weight: bold; | |
96 | text-align: left; | |
97 | } | |
98 | ||
68 | 99 | .other-leave-time |
100 | { | |
101 | width: 30%; | |
102 | } | |
103 | ||
104 | .other-leave-route | |
105 | { | |
106 | width: 30%; | |
107 | } | |
108 | ||
109 | .other-leave-destination | |
110 | { | |
111 | width: 40%; | |
112 | } | |
113 | ||
114 | #stop-name | |
115 | { | |
116 | width: 100%; | |
117 | text-align: center; | |
118 | } | |
119 | ||
120 | h1 | |
121 | { | |
122 | background-color: #ffd90f; | |
123 | margin: 0; | |
124 | padding-top: 10pt; | |
125 | background: #dc9e00; | |
126 | background: linear-gradient(to bottom, #ffd90f 0%, #ffd90f 95%, #AA7700 100%); | |
127 | color: black; | |
128 | vertical-align: middle; | |
129 | box-shadow: 0px 0px 1vw rgba(0, 0, 0, 0.5); | |
130 | } | |
131 | ||
132 | h1, h1 span | |
133 | { | |
134 | font-size: 5vw; | |
135 | text-align: center; | |
136 | font-weight: bold; | |
137 | } | |
138 | ||
139 | h1 span, h1 img | |
140 | { | |
141 | vertical-align: middle; | |
142 | } | |
143 | ||
144 | @media screen and (orientation:landscape) | |
145 | { | |
146 | h1 | |
147 | { | |
148 | height: 12vh; | |
149 | } | |
150 | ||
151 | h1 img | |
152 | { | |
153 | height: 10vh; | |
154 | float: left; | |
155 | margin-left: 1%; | |
156 | } | |
157 | ||
158 | #stop-name | |
159 | { | |
160 | margin-top: 5pt; | |
161 | font-size: 8vh; | |
162 | } | |
163 | } | |
164 | ||
165 | @media screen and (orientation:portrait) | |
166 | { | |
167 | h1 img | |
168 | { | |
169 | height: 10vh; | |
170 | display: block; | |
171 | margin-left: auto; | |
172 | margin-right: auto; | |
173 | } | |
174 | ||
175 | #stop-name | |
176 | { | |
177 | font-size: 6vw; | |
178 | } | |
179 | } | |
180 | </style> | |
181 | <script> | |
182 | num_visible_leaves = 3; | |
183 | num_imminent_leaves = {{num_imminent_leaves}}; | |
184 | var imminent_leave_cycle = []; | |
185 | var other_leave_cycle = []; | |
186 | var max_leaves; | |
187 | var current_imminent_leave = 0; | |
188 | var current_other_leave = 0; | |
189 | var initialized = false; | |
190 | function cycle_leaves() | |
191 | { | |
192 | if (initialized == false) | |
193 | { | |
194 | for (max_leaves = 0;; max_leaves += 1) | |
195 | { | |
196 | var i = max_leaves; | |
197 | var tr = document.getElementById('leave-' + i); | |
198 | if (tr) | |
199 | { | |
200 | if (i == 0 || i == num_imminent_leaves) | |
201 | tr.style.display = 'table-row-group'; | |
202 | else if (i < num_imminent_leaves) | |
203 | imminent_leave_cycle.push(tr); | |
204 | else if (i >= num_imminent_leaves + 1) | |
205 | other_leave_cycle.push(tr); | |
206 | } | |
207 | else | |
208 | break; | |
209 | } | |
210 | initialized = true; | |
211 | current_imminent_leave = imminent_leave_cycle.length - 1; | |
212 | current_other_leave = other_leave_cycle.length - 1; | |
213 | } | |
214 | if (imminent_leave_cycle) | |
215 | { | |
216 | current_imminent_leave = (current_imminent_leave + 1) % imminent_leave_cycle.length; | |
217 | for (var i = 0; i < imminent_leave_cycle.length; i += 1) | |
218 | imminent_leave_cycle[i].style.display = (i == current_imminent_leave) ? 'table-row-group' : 'none'; | |
219 | } | |
220 | if (other_leave_cycle) | |
221 | { | |
222 | current_other_leave = (current_other_leave + 1) % other_leave_cycle.length; | |
223 | for (var i = 0; i < other_leave_cycle.length; i += 1) | |
224 | other_leave_cycle[i].style.display = (i == current_other_leave) ? 'table-row-group' : 'none'; | |
225 | } | |
226 | setTimeout(cycle_leaves, 6000); | |
227 | } | |
228 | </script> | |
229 | </head> | |
230 | <body onload='cycle_leaves()'> | |
231 | <h1><img src="../static/pysäkki.png" height="128" /><span id='stop-name'>{{ref}} {{name}}</span></h1> | |
232 | <div class='next-leave'> | |
233 | {% for schedule_entry in schedule[:num_imminent_leaves] %} | |
76 | 234 | <table> |
68 | 235 | <tr> |
236 | <td class='next-leave-time'> | |
237 | {% if schedule_entry['imminent'] %} | |
238 | <span class='imminent-leave'>{{schedule_entry['time']}}</span>​ | |
239 | {% else %} | |
240 | {{schedule_entry['time']}}​ | |
241 | {% endif %} | |
242 | </td> | |
85 | 243 | <td class='next-leave-route'> |
244 | <span class='route-symbol'>{{schedule_entry['route']}}</span> | |
245 | </td> | |
246 | </tr> | |
247 | ||
248 | <tr> | |
249 | <td colspan="2" class='next-leave-destination'>{{schedule_entry['sign']['destination']}}</td> | |
250 | </tr> | |
251 | ||
252 | <tr> | |
253 | <td> | |
76 | 254 | <ul class="next-leave-places"> |
85 | 255 | {% for entry in schedule_entry['sign']['via'] %} |
256 | <li>{{entry}}</li> | |
257 | {% endfor %} | |
76 | 258 | </ul> |
259 | </td> | |
68 | 260 | </tr> |
76 | 261 | </table> |
68 | 262 | {% endfor %} |
263 | </div> | |
264 | {% if schedule[num_imminent_leaves] %} | |
265 | <div id='other-leaves'> | |
266 | <table cellspacing="0"> | |
76 | 267 | {% for halt in schedule[num_imminent_leaves:num_imminent_leaves + 2] %} |
68 | 268 | <tr id="leave-{{halt['index']}}" style='display: none'> |
269 | <td class='other-leave-time'>{{halt['time']}}</td> | |
270 | <td class='other-leave-route'>{{halt['route']}}</td> | |
271 | <td class='other-leave-destination'>{{halt['sign']['destination']}}</td> | |
272 | </tr> | |
273 | {% endfor %} | |
274 | </table> | |
275 | </div> | |
276 | {% endif %} | |
277 | </body> | |
278 | </html> |