From 046b1b0f77dccc884033a18a1907d4ca20413c48 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 26 Feb 2013 21:27:35 +0100 Subject: add option to hide delays < 5 minutes --- cgi/index.pl | 7 +++++-- 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)
+ <%= check_box 'hidelowdelay' => 1 %> + hide delay < 5 minutes +
display type <%= select_field mode => [['combined' => 'multi'], ['platform' => 'single']] %> <%= submit_button 'Display' %> -- cgit v1.2.3