blob: fac78d4fd9377e0e92396ba91c382a7a08ac6e09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
<!DOCTYPE html>
<html>
<head>
<title><%= $title %></title>
<meta charset="utf-8">
% if ($self->stash('refresh_interval')) {
<meta http-equiv="refresh" content="<%= $self->stash('refresh_interval') %>"/>
% }
%= stylesheet '/infoscreen.css'
%= javascript '/jquery-2.1.1.min.js'
%= javascript '/collapse.js'
</head>
<body>
% if (my $error = stash 'error') {
<div class="error">Received an error from the backend service:</div>
<div>
<pre>
%= $error
</pre>
</div>
% }
<div class="displayclean">
<ul>
% for my $departure (@{$raw}) {
% my $linetype = q{};
% if ($departure->can('type')) {
% given ($departure->type) {
% when ($_ =~ m{ (?: enbahn $ ) | Tram | STR }ix) { $linetype = 'tram' }
% when ([qw[S-Bahn S]]) { $linetype = 'sbahn' }
% when ([qw[NE Niederflurbus SB Bus]]) { $linetype = 'bus' }
% when ([qw[U-Bahn U]]) { $linetype = 'ubahn' }
% }
% }
<li>
<span class="line <%= $linetype %>">
% if ($departure->can('line_no')) {
% if ($linetype eq 'sbahn') {
S
% }
%= $departure->line_no
% }
% else {
%= $departure->line
% }
</span> <!-- line -->
<span class="moreinfo">
<div class="mheader">
<span class="train-line"><%= $departure->line %></span>
:
<span class="train-route">
% if ($departure->can('lineref') and $departure->lineref) {
%= $departure->lineref->route
% }
% else {
%= $departure->destination
% }
</span> <!-- train-route -->
</div> <!-- mheader -->
% if ($departure->isa('Travel::Status::DE::EFA::Result')) {
Fahrplan:
<table class="scheduled">
% for my $stop ($departure->route_pre) {
<tr class="routepre"><td class="time">
% if (not defined $stop->arr_time) {
<%= $stop->dep_time %>
% }
% elsif (not defined $stop->dep_time) {
<%= $stop->arr_time %>
% }
% elsif ( $stop->arr_time eq $stop->dep_time ) {
<%= $stop->dep_time %>
% }
% else {
<%= $stop->arr_time %> → <%= $stop->dep_time %>
% }
</td>
<td class="stop"><%= $stop->name %></td></tr>
% }
<tr class="routenow"><td class="time">
% if ($departure->can('sched_time')) {
<%= $departure->sched_time %>
% }
% else {
<%= $departure->time %>
% }
</td>
<td class="stop"><%= $id_name %> <%= $id_stop %></td></tr>
% for my $stop ($departure->route_post) {
<tr class="routepost"><td class="time">
% if (not defined $stop->arr_time) {
<%= $stop->dep_time %>
% }
% elsif (not defined $stop->dep_time) {
<%= $stop->arr_time %>
% }
% elsif ( $stop->arr_time eq $stop->dep_time ) {
<%= $stop->dep_time %>
% }
% else {
<%= $stop->arr_time %> → <%= $stop->dep_time %>
% }
</td>
<td class="stop"><%= $stop->name %></td></tr>
% }
</table>
% }
% elsif ($departure->isa('Travel::Status::DE::URA::Result')) {
Fahrplan:
<table class="scheduled">
% for my $stop ($departure->route_pre) {
<tr class="routepre"><td class="time">
%= $stop->time
</td>
<td class="stop"><%= $stop->name %></td></tr>
% }
<tr class="routenow"><td class="time">
<%= $departure->time %>
</td>
<td class="stop"><%= $id_name %> <%= $id_stop %></td></tr>
% for my $stop ($departure->route_post) {
<tr class="routepost"><td class="time">
%= $stop->time
</td>
<td class="stop"><%= $stop->name %></td></tr>
% }
</table>
% }
</span> <!-- moreinfo -->
<span class="route">
% if ($departure->can('route_interesting') and $departure->route_interesting) {
%= join(' - ', map { ref($_) ? $_->name_suf : $_ } ($departure->route_interesting));
% }
% elsif ($departure->can('lineref') and $departure->lineref) {
%= $departure->lineref->route
% }
</span> <!-- route -->
<span class="dest">
%= $departure->destination
</span> <!-- dest -->
<span class="countdown">
% if ($departure->can('delay') and $departure->delay) {
<span class="delay"> (+<%= $departure->delay %>) </span>
% }
% if ($departure->can('is_cancelled') and $departure->is_cancelled) {
<span class="delay"> FÄLLT AUS </span>
% }
% else {
% if ($departure->can('countdown')) {
% if ($departure->countdown > 0) {
<%= $departure->countdown %> min
% }
% else {
sofort
% }
% }
% }
</span> <!-- countdown -->
<span class="time">
%= $departure->time
</span>
</li>
% }
</ul>
</div>
</body>
</html>
|