summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-08-26 09:17:28 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-08-26 09:17:28 +0200
commitf4d71b4d9fb4191c07a9c200d32626175568b4fa (patch)
tree1903cec1805df51d9b2d9d08e00e7f0a708e04be /scripts
parent559a1cedd7814d101743f718f1db2760338ab51f (diff)
obtain autocompletion from database2.1.1
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/asset-rebuild4
-rwxr-xr-xscripts/update-autocomplete43
2 files changed, 1 insertions, 46 deletions
diff --git a/scripts/asset-rebuild b/scripts/asset-rebuild
index 07c7d82..eb6a140 100755
--- a/scripts/asset-rebuild
+++ b/scripts/asset-rebuild
@@ -6,12 +6,10 @@
set -x
-scripts/update-autocomplete
-
for theme in dark light; do
sassc -t compressed sass/src/${theme}/index.scss public/static/css/${theme}.min.css
done
-for file in autocomplete geolocation travelynx-actions; do
+for file in geolocation travelynx-actions; do
uglifyjs public/static/js/${file}.js -c -m > public/static/js/${file}.min.js
done
diff --git a/scripts/update-autocomplete b/scripts/update-autocomplete
deleted file mode 100755
index bfb6914..0000000
--- a/scripts/update-autocomplete
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use 5.020;
-
-use JSON;
-use File::Slurp qw(write_file);
-use List::Util qw(uniq);
-use Travel::Status::DE::IRIS::Stations;
-
-my @station_names
- = uniq map { $_->[1] } Travel::Status::DE::IRIS::Stations::get_stations();
-my $station_list = q{};
-
-for my $station (@station_names) {
- $station_list .= sprintf( "\t\t\t\"%s\": null,\n", $station );
-}
-
-my $autocomplete = <<"EOF";
-/*
- * Copyright (C) 2020 DB Station&Service AG, Europaplatz 1, 10557 Berlin
- * Copyright (C) 2020 Birte Kristina Friesel
- *
- * SPDX-License-Identifier: CC-BY-4.0
- */
-document.addEventListener('DOMContentLoaded', function() {
- var elems = document.querySelectorAll('.autocomplete');
- M.Autocomplete.init(elems, {
- minLength: 3,
- limit: 50,
- data: {
-$station_list
- }
- });
-});
-EOF
-
-write_file(
- "public/static/js/autocomplete.js",
- { binmode => ':encoding(utf-8)' },
- $autocomplete
-);