diff options
Diffstat (limited to 'templates/app.html.ep')
-rw-r--r-- | templates/app.html.ep | 158 |
1 files changed, 93 insertions, 65 deletions
diff --git a/templates/app.html.ep b/templates/app.html.ep index a769bd5..8b52c61 100644 --- a/templates/app.html.ep +++ b/templates/app.html.ep @@ -1,12 +1,7 @@ % if (@{$departures}) { % if (not param('ajax')) { -% if (param('dark')) { -<div class="app appdark"> -% } -% else { -<div class="app applight"> -% } +<div class="app" data-station="<%= $station %>"> <div class="moreinfo collapsed-moreinfo"> <div class="mheader"> <div> @@ -34,45 +29,48 @@ % $via_cur++; % $route_str .= $stop . ($via_cur < $via_max ? ' - ' : q{}); % } -% my $linetype = 'bahn'; -% if ( $departure->{train_type} eq 'S' ) { -% $linetype = 'sbahn'; -% } -% elsif ( $departure->{train_type} eq 'IC' -% or $departure->{train_type} eq 'ICE' -% or $departure->{train_type} eq 'EC' -% or $departure->{train_type} eq 'ECE' -% or $departure->{train_type} eq 'EN') { -% $linetype = 'fern'; -% } -% elsif ( $departure->{train_type} eq 'THA' -% or $departure->{train_type} eq 'TGV' -% or $departure->{train_type} eq 'FLX' -% or $departure->{train_type} eq 'NJ') { -% $linetype = 'ext'; -% } <li +% if (param('dbris') or param('hafas') or param('efa')) { + data-jid="<%= $departure->{journey_id} =~ s{#}{%23}gr %>" +% } data-train="<%= ($departure->{train_type} // q{}) %> <%= ($departure->{train_no} // $departure->{train} // q{}) %>" data-line="<%= $departure->{train_type} %> <%= $departure->{train_line} // $departure->{train_no} %>" data-no="<%= $departure->{train_line} ? $departure->{train_no} : q{} %>" - data-linetype="<%= $linetype %>" + data-linetype="<%= $departure->{linetype} %>" data-from="<%= $departure->{origin} // q{???} %>" data-to="<%= $departure->{destination} // q{???} %>" + data-station="<%= $departure->{station} // $station %>" data-platform="<%= $departure->{scheduled_platform} // $departure->{platform} // '' %>" data-arrival="<%= $departure->{sched_arrival} // '' %>" data-departure="<%= $departure->{sched_departure} // '' %>" - data-moreinfo="<%= join(q{|}, map { ($_->[0]->isa('DateTime') ? $_->[0]->strftime('%H:%M') : $_->[0]) . ' ' . $_->[1] } @{ $departure->{moreinfo} // [] } ) %>" + data-moreinfo="<%= join(q{|}, map { ($_->[0]->isa('DateTime') ? $_->[0]->strftime('%H:%M') . ' ' . $_->[1] : $_->[0] . ' ' . $_->[1]{text}) } @{ $departure->{moreinfo} // [] } ) %>" data-routeprev="<%= join(q{|}, @{ $departure->{route_pre} // [] } ) %>" data-routenext="<%= join(q{|}, @{ $departure->{route_post} // [] } ) %>" -% my $extraclasses = q{}; % if ($departure->{is_cancelled} or $departure->{departure_is_cancelled}) { -% $extraclasses .= ' cancelled'; class="cancelled"> % } % else { > % } - <div class="line <%= $linetype %>"> +% if (param('hafas')) { + <a href="/z/<%= Mojo::Util::url_escape($departure->{journey_id}) . '?hafas=' . Mojo::Util::url_escape(param('hafas')) . '&highlight=' . Mojo::Util::url_escape($departure->{station} // $station) %>"> +% } +% elsif (param('efa')) { + <a href="/z/<%= Mojo::Util::url_escape($departure->{journey_id}) . '?efa=' . Mojo::Util::url_escape(param('efa')) . '&highlight=' . Mojo::Util::url_escape($departure->{station} // $station) %>"> +% } +% elsif (param('dbris')) { + <a href="/z/<%= Mojo::Util::url_escape($departure->{journey_id}) . '?dbris=' . Mojo::Util::url_escape(param('dbris')) . '&highlight=' . Mojo::Util::url_escape($departure->{station} // $station) %>"> +% } +% else { + <a href="/z/<%= Mojo::Util::url_escape(($departure->{train_type} // q{}) . ' ' . ($departure->{train_no} // $departure->{train} // q{})) . '/' . Mojo::Util::url_escape($departure->{station} // $station) %>"> +% } +% if (param('dbris') or param('hafas')) { + <div class="anchor" id="<%= $departure->{journey_id} =~ s{[ #|]}{x}gr %>"></div> +% } +% else { + <div class="anchor" id="<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>"></div> +% } + <div class="line <%= $departure->{linetype} %>"> % if ($departure->{train_type} and $departure->{train_no}) { %= $departure->{train_type} % } @@ -101,38 +99,65 @@ % } </div> % } -% if ($departure->{info} and length $departure->{info}) { - <span class="info"> -%= $departure->{info} +% if ($departure->{sched_departure}) { + <span class="dest"> + <span class="visually-hidden">nach</span> +%= $departure->{destination} </span> % } % else { - <span class="route"> -%= $route_str + <span class="origin"> + <span class="visually-hidden">von</span> +%= $departure->{origin} </span> % } - <span class="dest <%= $extraclasses %>"> -%= $departure->{destination} - </span> - <span class="countdown <%= $extraclasses %>"> -% if ($departure->{delay} and not $departure->{is_cancelled}) { -% if ($show_realtime) { -% if ($departure->{delay} > 0) { - <span class="delaynorm">(+<%= $departure->{delay} %>)</span> + <span class="time <%= $show_realtime ? get_rt_time_class($departure) : q{} %>"> +% if ($departure->{delay} and not $departure->{is_cancelled} and not $departure->{departure_is_cancelled}) { +% if ($show_realtime and ($departure->{sched_arrival} or $departure->{sched_departure})) { +% if ($departure->{delay} > ($hide_low_delay ? 4 : 0)) { + <span class="delaynorm" aria-hidden="true"><%= $departure->{sched_departure} // $departure->{sched_arrival} %> ⇒</span> +% } +% elsif ($departure->{delay} < 0) { + <span class="undelaynorm" aria-hidden="true"><%= $departure->{sched_departure} // $departure->{sched_arrival} %> ⇒</span> +% } % } % else { - <span class="undelaynorm">(<%= $departure->{delay} %>)</span> +% if ($departure->{delay} > ($hide_low_delay ? 4 : 0)) { + <span class="delay" aria-hidden="true">+<%= $departure->{delay} %></span> +% } +% elsif ($departure->{delay} < 0) { + <span class="undelay" aria-hidden="true"><%= $departure->{delay} %></span> +% } +% } +% } +% elsif ($departure->{missing_realtime}) { + <span class="visually-hidden">Echtzeitdaten fehlen</span> + <span class="no-realtime" aria-hidden="true"><i class="material-icons">gps_off</i></span> +% } +% if (param('detailed')) { +% my $arrow = '→'; +% if (not $departure->{sched_arrival}) { +% $arrow = '↦'; +% } +% elsif (not $departure->{sched_departure}) { +% $arrow = '⇥'; +% } +% if ($show_realtime) { +%= ($departure->{arrival} // q{}) . $arrow . ($departure->{departure} // q{}) +% } +% else { +%= ($departure->{sched_arrival} // q{}) . $arrow . ($departure->{sched_departure} // q{}) % } % } % else { -% if ($departure->{delay} > 0) { - <span class="delay">(+<%= $departure->{delay} %>)</span> +% if ($departure->{is_cancelled} or $departure->{departure_is_cancelled}) { +%= $departure->{sched_departure} // $departure->{sched_arrival} // $departure->{time} % } % else { - <span class="undelay">(<%= $departure->{delay} %>)</span> +%= $departure->{time} % } % } -% } + </span> % if (($departure->{scheduled_platform} and $departure->{platform} and % $departure->{scheduled_platform} ne $departure->{platform}) % or $departure->{changed_platform}) { @@ -141,30 +166,33 @@ % else { <span class="platform"> % } +% if ($departure->{load}{FIRST} or $departure->{load}{SECOND}) { +% my ($text, $icon1, $icon2) = utilization_icon([$departure->{load}{FIRST}, $departure->{load}{SECOND}]); + <span class="load"> + <i class="material-icons" style="vertical-align: bottom;" aria-hidden="true"><%= $icon2 %></i> + </span> +% } +% elsif (my $o = $departure->{occupancy}) { + <span class="load"> +% my ($text, $icon) = occupancy_icon($o); + <i class="material-icons" style="vertical-align: bottom;" aria-hidden="true"><%= $icon %></i> + </span> +% } + <span class="visually-hidden">Gleis</span> %= $departure->{platform} </span> - </span> - <span class="time <%= ($show_realtime and $departure->{delay} and not - $departure->{is_cancelled}) ? 'delayed' : q{} %> <%= $extraclasses %>"> -% if (param('detailed')) { -% my $arrow = '→'; -% if (not $departure->{sched_arrival}) { -% $arrow = '↦'; -% } -% elsif (not $departure->{sched_departure}) { -% $arrow = '⇥'; -% } -% if ($show_realtime) { -%= ($departure->{arrival} // q{}) . $arrow . ($departure->{departure} // q{}) -% } -% else { -%= ($departure->{sched_arrival} // q{}) . $arrow . ($departure->{sched_departure} // q{}) -% } +% if ($departure->{info} and length $departure->{info}) { + <span class="info"> +%= $departure->{info} + </span> % } % else { -%= $departure->{time} + <span class="route"> + <span class="visually-hidden">über</span> +%= $route_str + </span> % } - </span> + </a> </li> % } |