diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-02-26 21:27:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-02-26 21:27:35 +0100 |
commit | 046b1b0f77dccc884033a18a1907d4ca20413c48 (patch) | |
tree | 1b9910d0f339675034cd9fe872d9f1a477c85629 | |
parent | d06126063590da2487b2e1664d56136b9e545208 (diff) |
add option to hide delays < 5 minutes
-rw-r--r-- | cgi/index.pl | 7 | ||||
-rw-r--r-- | cgi/templates/layouts/default.html.ep | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/cgi/index.pl b/cgi/index.pl index a525cf6..40ab878 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -6,7 +6,7 @@ use Travel::Status::DE::DeutscheBahn; use 5.014; use utf8; -our $VERSION = '0.03'; +our $VERSION = '0.04'; my $refresh_interval = 900; @@ -37,6 +37,7 @@ sub handle_request { my @platforms = split( /,/, $self->param('platforms') // q{} ); my $template = $self->param('mode') // 'multi'; + my $hide_low_delay = $self->param('hidelowdelay') // 0; $self->stash( departures => [] ); $self->stash( title => 'db-fakedisplay' ); @@ -89,10 +90,12 @@ sub handle_request { if ( $info eq '+0' ) { $info = undef; } + if ($hide_low_delay and $info) { + $info =~ s{ ^ (?: ca\. \s* )? \+ [ 1 2 3 4 ] $ }{}x; + } if ($info) { $info =~ s{ ^ (?: ca\. \s* )? \+ (\d+) }{Verspätung ca. $1 Min}x; - $info =~ s{ 1 \s Minute\Kn }{}x; } push( @departures, diff --git a/cgi/templates/layouts/default.html.ep b/cgi/templates/layouts/default.html.ep index 6e46cdc..02b2639 100644 --- a/cgi/templates/layouts/default.html.ep +++ b/cgi/templates/layouts/default.html.ep @@ -214,6 +214,9 @@ <%= text_field 'platforms' %> (optional) <br/> + <%= check_box 'hidelowdelay' => 1 %> + <span class="fielddesc fieldoptional">hide delay < 5 minutes</span> + <br/> <span class="fielddesc fieldoptional">display type</span> <%= select_field mode => [['combined' => 'multi'], ['platform' => 'single']] %> <%= submit_button 'Display' %> |