From 1cac79ba31858b496c03762a66eb86680ff3a3da Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 30 May 2021 18:24:29 +0200 Subject: add delay --- bin/nvm | 4 ++++ static/v0/css/wip.css | 23 ++++++++++++++--------- templates/departure_list.html | 7 ++++++- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/bin/nvm b/bin/nvm index 7fe000a..d75f16e 100755 --- a/bin/nvm +++ b/bin/nvm @@ -62,6 +62,10 @@ class Departure: else: self.sort_by = 0 + if self.delay: + self.delay = self.delay // 60 + self.delay = f"{self.delay:+.0f}" + def set_relative(self, now): minutes = (self.sort_by - now) // 60 if minutes < 1: diff --git a/static/v0/css/wip.css b/static/v0/css/wip.css index 965f5ec..a5f9424 100644 --- a/static/v0/css/wip.css +++ b/static/v0/css/wip.css @@ -42,13 +42,13 @@ ul.departures > li.cancelled { ul.departures li .line { position: absolute; - bottom: 0; + bottom: 2px; left: 2px; max-width: 6em; max-height: 3ex; - max-width: 4em; + max-width: 5em; overflow: hidden; - font-size: 150%; + font-size: 140%; background-color: #eeeeee; font-weight: bold; padding-left: 0.1em; @@ -76,29 +76,33 @@ ul.departures li .bus { ul.departures li .dest { position: absolute; bottom: 0; - left: 4em; + left: 5em; width: 70%; overflow: hidden; background-color: transparent; - font-size: 160%; + font-size: 150%; color: black; } ul.departures li .destsuffix { position: absolute; top: 1px; - left: 6.5em; + left: 7.6em; width: 70%; height: 1.2em; overflow: hidden; } +ul.departures li .time .delay { + padding-right: 1ex; + color: #ff0000; +} + ul.departures li .time { position: absolute; right: 5px; - top: 4px; + top: 1px; background-color: transparent; - font-size: 100%; padding-left: 0.2em; color: black; } @@ -109,7 +113,8 @@ ul.departures li .platform { right: 5px; overflow: hidden; background-color: transparent; - font-size: 150%; + font-size: 140%; + font-weight: bold; color: black; } diff --git a/templates/departure_list.html b/templates/departure_list.html index 37f259b..e234a2c 100644 --- a/templates/departure_list.html +++ b/templates/departure_list.html @@ -31,7 +31,12 @@ {% if departure.cancelled and departure.plannedWhen %} {{ departure.plannedWhen.strftime("%H:%M") }} {% else %} - {{ departure.relativeWhen }} + + {% if departure.delay %} + ({{ departure.delay }}) + {% endif %} + {{ departure.relativeWhen }} + {% endif %} {% if departure.platform %} {{ departure.platform }} -- cgit v1.2.3