summaryrefslogtreecommitdiff
path: root/templates/app.html.ep
diff options
context:
space:
mode:
Diffstat (limited to 'templates/app.html.ep')
-rw-r--r--templates/app.html.ep306
1 files changed, 117 insertions, 189 deletions
diff --git a/templates/app.html.ep b/templates/app.html.ep
index 80e17d2..8b52c61 100644
--- a/templates/app.html.ep
+++ b/templates/app.html.ep
@@ -1,12 +1,23 @@
% if (@{$departures}) {
-% if (param('dark')) {
-<div class="app appdark">
-% }
-% else {
-<div class="app applight">
-% }
+% if (not param('ajax')) {
+<div class="app" data-station="<%= $station %>">
+<div class="moreinfo collapsed-moreinfo">
+ <div class="mheader">
+ <div>
+ <span class="train-line"></span>
+ <span class="train-no"></span>
+ </div>
+ <div>
+ <span class="train-origin"></span>
+ →
+ <span class="train-dest"></span>
+ </div>
+ </div>
+ <div class="mfooter"></div>
+</div>
<ul>
+% } # not param('ajax')
% my $i = 0;
% my $dt_now = DateTime->now;
% for my $departure (@{$departures}) {
@@ -18,25 +29,48 @@
% $via_cur++;
% $route_str .= $stop . ($via_cur < $via_max ? ' - ' : q{});
% }
-% my $extraclasses = q{};
+ <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="<%= $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') . ' ' . $_->[1] : $_->[0] . ' ' . $_->[1]{text}) } @{ $departure->{moreinfo} // [] } ) %>"
+ data-routeprev="<%= join(q{|}, @{ $departure->{route_pre} // [] } ) %>"
+ data-routenext="<%= join(q{|}, @{ $departure->{route_post} // [] } ) %>"
% if ($departure->{is_cancelled} or $departure->{departure_is_cancelled}) {
-% $extraclasses .= ' cancelled';
- <li class="cancelled">
+ class="cancelled">
+% }
+% else {
+ >
+% }
+% if (param('hafas')) {
+ <a href="/z/<%= Mojo::Util::url_escape($departure->{journey_id}) . '?hafas=' . Mojo::Util::url_escape(param('hafas')) . '&amp;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')) . '&amp;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')) . '&amp;highlight=' . Mojo::Util::url_escape($departure->{station} // $station) %>">
% }
% else {
- <li>
+ <a href="/z/<%= Mojo::Util::url_escape(($departure->{train_type} // q{}) . ' ' . ($departure->{train_no} // $departure->{train} // q{})) . '/' . Mojo::Util::url_escape($departure->{station} // $station) %>">
% }
-% my $linetype = 'bahn';
-% if ( $departure->{train_type} eq 'S' ) {
-% $linetype = 'sbahn';
+% if (param('dbris') or param('hafas')) {
+ <div class="anchor" id="<%= $departure->{journey_id} =~ s{[ #|]}{x}gr %>"></div>
% }
-% elsif ( $departure->{train_type} eq 'IC'
-% or $departure->{train_type} eq 'ICE'
-% or $departure->{train_type} eq 'EC'
-% or $departure->{train_type} eq 'THA' ) {
-% $linetype = 'fern';
+% else {
+ <div class="anchor" id="<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>"></div>
% }
- <div class="line <%= $linetype %>">
+ <div class="line <%= $departure->{linetype} %>">
% if ($departure->{train_type} and $departure->{train_no}) {
%= $departure->{train_type}
% }
@@ -65,176 +99,65 @@
% }
</div>
% }
- <div class="moreinfo collapsed-moreinfo">
- <div class="mheader">
- <div>
-% if ($departure->{train_no} or $departure->{train_line}) {
- <span class="train-line <%= $linetype %>"><%= $departure->{train_type} %>
- <%= $departure->{train_line} // $departure->{train_no} %></span>
-% if ($departure->{train_line}) {
- <span class="train-no"><%= $departure->{train_no} %></span>
-% }
+% if ($departure->{sched_departure}) {
+ <span class="dest">
+ <span class="visually-hidden">nach</span>
+%= $departure->{destination}
+ </span>
% }
% else {
- <span class="train-line"><%= $departure->{train} // q{???} %></span>
-% }
- </div>
- <div>
-% if ($departure->{origin}) {
- <span class="train-origin"><%= $departure->{origin} %></span>
- →
-% }
- <span class="train-dest"><%= $departure->{destination} // q{???} %></span>
- </div>
-% if ($departure->{is_cancelled}) {
- <div class="minfo">Fahrt fällt aus</div>
-% }
-% elsif (defined $departure->{delay} and $departure->{delay} > 0) {
- <div class="minfo">+<%= $departure->{delay} %>
-% if ($departure->{departure_is_cancelled}) {
- (endet hier)
-% }
- </div>
-% }
-% if (@{$departure->{replaced_by}}) {
-% for my $replacement (@{$departure->{replaced_by}}) {
- <span class="replaced">Ersatzzug: <%= $replacement %></span>
-% }
-% }
-% if (@{$departure->{replacement_for}}) {
-% for my $replacement (@{$departure->{replacement_for}}) {
- <span class="replacement">Ersatzzug für <%= $replacement %></span>
-% }
-% }
- </div> <!-- mheader -->
- <div class="mfooter">
- <div class="platforminfo">
-% if ($departure->{scheduled_platform} or $departure->{platform}) {
- Gleis <%= $departure->{scheduled_platform} // $departure->{platform} %>
-% }
-% if ($departure->{scheduled_platform} and $departure->{platform}
-% and $departure->{scheduled_platform} ne $departure->{platform}) {
- (heute Gleis <%= $departure->{platform} %>)
-% }
-% elsif ($departure->{changed_platform}) {
- (Gleiswechsel)
-% }
- </div> <!-- platforminfo -->
-% if (not $departure->{is_cancelled}) {
- <div class="timeinfo">
-% if ($departure->{sched_arrival}) {
- Ankunft: <%= $departure->{sched_arrival} %>
-% if ($departure->{arrival} and $departure->{arrival} ne $departure->{sched_arrival}) {
- (heute <%= $departure->{arrival} %>)
-% }
- <br/>
-% }
-% if ($departure->{sched_departure}) {
- Abfahrt: <%= $departure->{sched_departure} %>
-% if ($departure->{departure} and $departure->{departure} ne $departure->{sched_departure}) {
- (heute <%= $departure->{departure} %>)
-% }
- <br/>
-% }
-% if (not ($departure->{sched_arrival} or $departure->{sched_departure})) {
- Abfahrt: <%= $departure->{time} %>
-% if ($departure->{delay}) {
- (heute +<%= $departure->{delay} %>)
-% }
-% }
- </div> <!-- timeinfo -->
-% if ($linetype eq 'fern' and $departure->{wr_link}) {
- <div class="verbose">
- <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>">Wagenreihung</a>
- </div>
-% }
-
+ <span class="origin">
+ <span class="visually-hidden">von</span>
+%= $departure->{origin}
+ </span>
% }
-% if ($departure->{route_post_diff} and @{$departure->{route_post_diff}}) {
- <div class="mroute">
- Über:
-% my $first = 0;
-% for my $stop (@{$departure->{route_post_diff} // q{???}}) {
-% if ($first++) {
- <span class="separator">–</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>
% }
-% if ($stop->{isAdditional}) {
- <span class="additional-stop"><%= $stop->{name} %></span>
-% }
-% elsif ($stop->{isCancelled}) {
- <span class="cancelled-stop"><%= $stop->{name} %></span>
-% }
-% elsif ($self->is_important($stop->{name})) {
- <span class="important-stop"><%= $stop->{name} %></span>
-% }
-% else {
- <span class="generic-stop"><%= $stop->{name} %></span>
+% elsif ($departure->{delay} < 0) {
+ <span class="undelaynorm" aria-hidden="true"><%= $departure->{sched_departure} // $departure->{sched_arrival} %> ⇒</span>
% }
% }
- </div> <!-- mroute -->
-% }
-% if ($departure->{moreinfo} and @{$departure->{moreinfo}}) {
- Meldungen:
- <ul>
-% for my $pair (@{$departure->{moreinfo}}) {
- <li>
-% if ($pair->[0]->isa('DateTime')) {
-% if ($pair->[0]->day != $dt_now->day) {
-% $pair->[0]->set_locale('de_DE');
-%= $pair->[0]->strftime('%a %H:%M')
+% else {
+% if ($departure->{delay} > ($hide_low_delay ? 4 : 0)) {
+ <span class="delay" aria-hidden="true">+<%= $departure->{delay} %></span>
% }
-% else {
-%= $pair->[0]->strftime('%H:%M')
+% elsif ($departure->{delay} < 0) {
+ <span class="undelay" aria-hidden="true"><%= $departure->{delay} %></span>
% }
% }
-% else {
-%= $pair->[0]
-% }
- :
- <span class="reason">
-%= $pair->[1]
- </span>
- </li>
% }
-% if ($departure->{route_info}) {
- <li><%= $departure->{route_info} %></li>
+% 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>
% }
- </ul>
-% }
- </div> <!-- mfooter -->
- </div> <!-- moreinfo -->
-% if ($departure->{info} and length $departure->{info}) {
- <span class="info">
-%= $departure->{info}
- </span>
-% }
-% else {
- <span class="route">
-%= $route_str
- </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>
+% 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 {
- <span class="undelaynorm">(<%= $departure->{delay} %>)</span>
+%= ($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}) {
@@ -243,39 +166,44 @@
% 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>
% }
+% if (not param('ajax')) {
</ul>
</div> <!-- app -->
+% }
% }
-% else {
+% elsif (not param('ajax')) {
<div class="container">
<div class="error"><strong>Keine Abfahrten gefunden.</strong>