% if (@{$departures}) { % if (not param('ajax')) { % if (param('dark')) { <div class="app appdark"> % } % else { <div class="app applight"> % } <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}) { % $i++; % my $route_str = q{}; % my $via_max = @{$departure->{via} // []}; % my $via_cur = 0; % for my $stop (@{$departure->{via} // []}) { % $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'; % } % elsif ( $departure->{train_line} and $departure->{train_line} =~ m{^S\d} ) { % $linetype = 'sbahn'; % } <li 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-from="<%= $departure->{origin} // q{???} %>" data-to="<%= $departure->{destination} // q{???} %>" 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-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 ($departure->{train_type} and $departure->{train_no}) { %= $departure->{train_type} % } % if ($departure->{train_line} ) { %= $departure->{train_line} % } % elsif ($departure->{train_no}) { <span class="trainno"><%= $departure->{train_no} %></span> % } % else { %= $departure->{train} % } % if ($departure->{train_line} and $departure->{train_no} % and $departure->{train_line} ne $departure->{train_no} % and param('detailed')) { <div class="trainno_sub"><%= $departure->{train_no} %></div> % } </div> % if (@{$departure->{replaced_by}} or @{$departure->{replacement_for}}) { <div class="lineinfo"> % if (@{$departure->{replaced_by}}) { %#<span class="replaced">→ Ersatzzug</span> % } % if (@{$departure->{replacement_for}}) { <span class="replacement">Ersatzzug</span> % } </div> % } % 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> % } % else { <span class="undelaynorm">(<%= $departure->{delay} %>)</span> % } % } % else { % if ($departure->{delay} > 0) { <span class="delay">(+<%= $departure->{delay} %>)</span> % } % else { <span class="undelay">(<%= $departure->{delay} %>)</span> % } % } % } % if (($departure->{scheduled_platform} and $departure->{platform} and % $departure->{scheduled_platform} ne $departure->{platform}) % or $departure->{changed_platform}) { <span class="platform changed-platform"> % } % else { <span class="platform"> % } %= $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{}) % } % } % else { %= $departure->{time} % } </span> </li> % } % if (not param('ajax')) { </ul> </div> <!-- app --> % } % } % elsif (not param('ajax')) { <div class="container"> <div class="error"><strong>Keine Abfahrten gefunden.</strong> Möglicherweise ist der Filter zu restriktiv, oder an dieser Station fahren momentan keine Züge.</div> </div> <!-- container --> % }