Commit edc03d0f authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

update autocomplete list of station names (and add update script)

parent b48dd6f4
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+26 −0
Original line number Diff line number Diff line
#!/usr/bin/env perl

use strict;
use warnings;
use 5.020;

use JSON;
use File::Slurp qw(write_file);
use Travel::Status::DE::IRIS::Stations;

my @station_names = map { $_->[1] } Travel::Status::DE::IRIS::Stations::get_stations();

my $station_json = JSON->new->utf8->encode([@station_names]);

my $autocomplete = <<"EOF";
\$(function() {
	var stations = $station_json;
	\$('input.station').autocomplete({
		delay: 0,
		minLength: 3,
		source: stations
	});
});
EOF

write_file("public/static/js/autocomplete.js", $autocomplete);