# HG changeset patch # User Teemu Piippo <teemu@hecknology.net> # Date 1498658502 -10800 # Node ID d0ae1996abddd30e194282ba0bf19b9384a0a995 # Parent 5da3315058a2135b1cfeb627c9178f44fac26214 Lisätty vilkkuvat merkit hetken päästä lähteville diff -r 5da3315058a2 -r d0ae1996abdd service.py --- 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( ({ diff -r 5da3315058a2 -r d0ae1996abdd static/style.css --- 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; + } +} diff -r 5da3315058a2 -r d0ae1996abdd templates/cluster.html --- 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> diff -r 5da3315058a2 -r d0ae1996abdd templates/stop.html --- 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 %}