Wed, 28 Jun 2017 17:01:42 +0300
Lisätty vilkkuvat merkit hetken päästä lähteville
service.py | file | annotate | diff | comparison | revisions | |
static/style.css | file | annotate | diff | comparison | revisions | |
templates/cluster.html | file | annotate | diff | comparison | revisions | |
templates/stop.html | file | annotate | diff | comparison | revisions |
--- a/service.py Wed Jun 28 16:25:17 2017 +0300 +++ b/service.py Wed Jun 28 17:01:42 2017 +0300 @@ -74,6 +74,9 @@ else: return schedule_entry['trip'].schedule[-1].stop.name +def imminent(schedule_entry): + return (schedule_entry['time'] - now()) <= timedelta(minutes = 3) + @app.route('/pysäkki/<reference>') def bus_stop_schedule(reference): from buses import bus_stops @@ -89,6 +92,7 @@ 'sign': sign(schedule_entry), 'trip': schedule_entry['stop'].trip.name, 'night': is_night_time(schedule_entry['time']), + 'imminent': imminent(schedule_entry), }) return render_template( 'stop.html', @@ -134,6 +138,7 @@ 'stop_id': schedule_entry['stop'].stop.reference, 'stop_code': schedule_entry['stop'].stop.code, 'stop_name': tr(schedule_entry['stop'].stop.name, 'pysäkit'), + 'imminent': imminent(schedule_entry), }) stops_in_cluster = sorted( ({
--- a/static/style.css Wed Jun 28 16:25:17 2017 +0300 +++ b/static/style.css Wed Jun 28 17:01:42 2017 +0300 @@ -60,11 +60,16 @@ border-radius: 0 30px 0 0; } -.sarake-aika, .sarake-linja +.sarake-linja { text-align: center; } +.sarake-aika +{ + text-align: right; +} + td, th, body { font-size: 24pt; @@ -172,3 +177,23 @@ border: 1px solid gray; box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5); } + +.imminent-leave +{ + color: #C0660B; + vertical-align: middle; + animation: blinker steps(1) 500ms infinite alternate; + opacity: 0; + animation: blinking 2s linear infinite; +} + +@keyframes blinking +{ + from, 24.9% + { + opacity: 0; + } + 25%, to { + opacity: 1; + } +}
--- a/templates/cluster.html Wed Jun 28 16:25:17 2017 +0300 +++ b/templates/cluster.html Wed Jun 28 17:01:42 2017 +0300 @@ -23,7 +23,7 @@ { text-align: center; } - .sarake-määränpää + .sarake-määränpää, .sarake-pysäkki { text-align: left; } @@ -56,7 +56,12 @@ </tr> {% for halt in schedule %} <tr class="{% if halt['night'] %} yö {% endif %}"> - <td class='sarake-aika'>{{halt['time']}}</td> + <td class='sarake-aika'> + {% if halt['imminent'] %} + <span class='imminent-leave'>●</span> + {% endif %} + {{halt['time']}} + </td> <td class='sarake-linja linja'> <a href="../ajovuoro/{{halt['trip']}}">{{halt['route']}}</a> </td>
--- a/templates/stop.html Wed Jun 28 16:25:17 2017 +0300 +++ b/templates/stop.html Wed Jun 28 17:01:42 2017 +0300 @@ -47,6 +47,9 @@ </td> <td class='sarake-määränpää'> <a href="../ajovuoro/{{halt['trip']}}">{{halt['sign']}}</a> + {% if halt['imminent'] %} + <span class='imminent-leave'>●</span> + {% endif %} </td> </tr> {% endfor %}