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