diff options
Diffstat (limited to 'templates/layouts/app.html.ep')
-rw-r--r-- | templates/layouts/app.html.ep | 197 |
1 files changed, 118 insertions, 79 deletions
diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep index b98f4c6..c557bee 100644 --- a/templates/layouts/app.html.ep +++ b/templates/layouts/app.html.ep @@ -4,8 +4,8 @@ <title><%= stash('title') // 'DBF' %></title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="keywords" content="Abfahrtsmonitor, Bahnhofstafel, Abfahrten, Abfahrtstafel, ICE, IC, RE, RB, S-Bahn"> - <meta name="description" content="Inoffizieller Abfahrtsmonitor für innerdeutsche Zugfahrten"> + <meta name="keywords" content="Abfahrtsmonitor, Bahnhofstafel, Abfahrten, Abfahrtstafel, Nahverkehr, Regionalverkehr, Fernverkehr, ICE, IC, RE, RB, S-Bahn"> + <meta name="description" content="<%= stash('description') // 'Inoffizieller Abfahrtsmonitor für Nah-, Reginol- und Fernverkehr' %>"> <meta name="theme-color" content="#00838f"> <link rel="icon" type="image/png" href="/static/icons/icon-16x16.png" sizes="16x16"> <link rel="icon" type="image/png" href="/static/icons/icon-32x32.png" sizes="32x32"> @@ -18,7 +18,7 @@ <meta http-equiv="refresh" content="<%= $self->stash('refresh_interval') %>"/> % } - % my $av = 'v69'; # asset version + % my $av = 'v110'; # asset version % if (session('theme') and session('theme') eq 'dark' or param('dark')) { %= stylesheet "/static/${av}/css/dark.min.css", id => 'theme' % } @@ -27,14 +27,14 @@ % } <script> function addStyleSheet(name, id) { - var path = '/static/<%=$av%>/css/' + name + '.min.css'; - var old = document.getElementById(id); + const path = '/static/<%=$av%>/css/' + name + '.min.css'; + const old = document.getElementById(id); if (old && (old.href != path)) { old.href = path; - document.cookie = 'theme=' + name; + document.cookie = 'theme=' + name + ';SameSite=None;Secure'; } } - var otherTheme = { + const otherTheme = { 'dark': 'light', 'light': 'dark', }; @@ -43,24 +43,18 @@ currentTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; } addStyleSheet(currentTheme, 'theme'); - - function toggleTheme() { - currentTheme = otherTheme[currentTheme] || 'light'; - localStorage.setItem('theme', currentTheme); - addStyleSheet(currentTheme, 'theme'); - } </script> %= stylesheet "/static/${av}/css/material-icons.css" %= stylesheet "/static/${av}/css/jquery-ui.min.css" %= javascript '/static/js/jquery-3.4.1.min.js', defer => undef %= javascript "/static/${av}/js/jquery-ui.min.js", defer => undef %= javascript "/static/${av}/js/dbf.min.js", defer => undef + % if (not stash('hide_opts')) { + %= javascript "/dyn/${av}/autocomplete.js", defer => undef + % } % if (stash('with_geostop')) { %= javascript "/static/${av}/js/geostop.min.js", defer => undef % } - % if (stash('with_geotrain')) { - %= javascript "/static/${av}/js/geotrain.min.js", defer => undef - % } % if (stash('with_map')) { %= stylesheet "/static/${av}/leaflet/leaflet.css" %= javascript "/static/${av}/leaflet/leaflet.js" @@ -83,16 +77,17 @@ </span> % } <ul id="nav-mobile" style="float: right;"> - <li class="waves-effect waves-light"> - <a onClick="javascript:toggleTheme()"><span class="visually-hidden">Farbschema invertieren</span><i class="material-icons" aria-hidden="true">invert_colors</i></a> - </li> + % if (stash('api_link')) { + <li class="waves-effect waves-light"> + <a href="<%= stash('api_link') %>"><span class="visually-hidden"><%= stash('api_text') %></span><i class="material-icons" aria-hidden="true"><%= stash('api_icon') %></i></a> + </li> + % } % if (stash('hide_opts')) { <li><a href="/"><span class="visually-hidden">Hauptseite</span><i class="material-icons" aria-hidden="true">edit</i></a></li> % } % else { <li><a href="#stationinput"><span class="visually-hidden">Menü</span><i class="material-icons" aria-hidden="true">edit</i></a></li> % } - <li><a href="/_autostop"><span class="visually-hidden">Stationen in der Umgebung suchen</span><i class="material-icons" aria-hidden="true">my_location</i></a></li> </ul> </div> </nav> @@ -122,37 +117,36 @@ Bitte eine Station aus der Liste auswählen</div> %= form_for _redirect => begin +%= hidden_field efa => param('efa') +%= hidden_field hafas => param('hafas') <div> <div class="field"> - <div class="desc">Zug / Station</div> - <div> -% if (stash('stationlist')) { +% if (stash('stationlist')) { %= select_field input => stash('stationlist') -% } -% elsif (stash('input')) { - %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder DS100-Kürzel', id => 'stationinput' -% } -% else { - %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder DS100-Kürzel', id => 'stationinput', autofocus => 'autofocus' -% } - </div> +% } +% elsif (stash('input')) { + %= text_field 'input', class => 'station', placeholder => 'Stationsname oder Fahrtnummer', id => 'stationinput' +% } +% else { + %= text_field 'input', class => 'station', placeholder => 'Stationsname oder Fahrtnummer', id => 'stationinput', autofocus => 'autofocus' +% } </div> <div class="field"> - %= submit_button 'Abfahrtsmonitor' + %= submit_button 'Abfahrtstafel' + </div> + % if (stash('input')) { + <div class="geolink"> + <a class="button" href="<%= url_for('_autostop')->to_abs->scheme('https')->query({efa => param('efa'), hafas => param('hafas')}) %>">Stationen in der Umgebung suchen</a> + </div> + % } + <div class="backendlink"> + <a class="button button-light" href="<%= url_for('_backend')->query({efa => param('efa'), hafas => param('hafas')}) %>">Backend: <%= param('efa') ? param('efa') . ' (EFA)' : param('hafas') ? param('hafas') . ' (HAFAS)' : 'DB (IRIS-TTS)' %></a> </div> <div class="break"></div> <div class="moresettings-header moresettings-header-collapsed button button-light">Weitere Einstellungen</div> <div class="moresettings moresettings-collapsed"> <div class="field"> <div class="desc"> - %= check_box 'rt' => 1, id => 'id_show_realtime' - <label for="id_show_realtime"> - Zeiten inkl. Verspätung angeben - </label> - </div> - </div> - <div class="field"> - <div class="desc"> %= check_box 'hidelowdelay' => 1, id => 'id_hidelowdelay' <label for="id_hidelowdelay"> Verspätungen erst ab 5 Minuten anzeigen @@ -163,15 +157,7 @@ Bitte eine Station aus der Liste auswählen</div> <div class="desc"> %= check_box 'detailed' => 1, id => 'id_detailed' <label for="id_detailed"> - Mehr Details (u.a. Zugnummern und Zugbildungsplan) - </label> - </div> - </div> - <div class="field"> - <div class="desc"> - %= check_box 'no_related' => 1, id => 'id_no_related' - <label for="id_no_related"> - Betriebliche Bahnhofstrennungen berücksichtigen (z.B. "Hbf (Fern+Regio)" vs. "Hbf (S)") + Mehr Details </label> </div> </div> @@ -179,7 +165,7 @@ Bitte eine Station aus der Liste auswählen</div> <div class="desc"> %= check_box 'past' => 1, id => 'past' <label for="past"> - Bereits abgefahrene Züge anzeigen + Fahrten der vergangenen 60 Minuten zeigen </label> </div> </div> @@ -187,13 +173,13 @@ Bitte eine Station aus der Liste auswählen</div> <div class="desc"> %= check_box 'hide_opts' => 1, id => 'id_hide_opts' <label for="id_hide_opts"> - Formular verstecken (für Infoscreens) + Formular verstecken </label> </div> </div> <div class="field"> <div class="desc"> - Nur Züge über + Nur Fahrten über </div> <div> %= text_field 'via', placeholder => 'Bahnhof 1, Bhf2, ... (oder regulärer Ausdruck)', class => 'station' @@ -233,32 +219,66 @@ Bitte eine Station aus der Liste auswählen</div> </div> <!-- input-field --> <div class="notes"> - <div class="developers-header developers-header-collapsed button button-light">API- und Entwickler-Hinweise</div> + <div class="developers-header developers-header-collapsed button button-light">API</div> <div class="developers developers-collapsed"> <ul> - <li>DBF-Abfahrtstafeln können gerne als iframe eingebunden oder in - fest installierten Vollbild-Browserfenstern verwendet werden. - Für eine kleine Ansicht (z.B. iframe in einer normalen Website) - empfiehlt sich das "App"-Frontend. Für eine große Ansicht - (z.B. als alleinstehender Infoscreen) gibt es den "Infoscreen"-Modus.</li> - <li>Die Parameter <span style="font-family: monospace;">mode=json&version=3</span> - (alternativ <span style="font-family: - monospace;">https://dbf.finalrewind.org/Bahnhofsname.json?version=3</span>) - bieten ein JSON-IRIS-Interface. Die route-Elemente können zusätzlich - die Felder "isAdditional" oder "isCancelled" enthalten, der Rest sollte - selbsterklärend sein. Im Fehlerfall fehlt das "departures"-Element, - stattdessen wird ein "error"-Element mit Fehlermeldung zurückgegeben. - Bitte maximal 30 Anfragen pro Minute und insbesondere nur eine Anfrage - pro Station und Minute – eine höhere Auflösung haben die Backenddaten - ohnehin nicht.</li> - <li>Ein JSON-Interface für Zugdetails ist in Arbeit.</li> - <li>Mit <span style="font-family: monospace;">limit</span> kann die Anzahl der - angezeigten / im JSON enthaltenen Abfahrten eingeschränkt werden, z.B. - <span style="font-family: monospace;">limit=10</span> für die ersten zehn.</li> - <li>Dieser Dienst ist Open Source-Software und kann leicht auf eigenen Servern - <a href="https://github.com/derf/db-fakedisplay/blob/master/README.md">installiert</a> - werden. Automatisierte Crawler, die mehrere Dutzend Stationen pro Minute - abfragen, bitte nur auf eigenen Instanzen betreiben.</li> + % if (0) { + <li>You're welcome to embed DBF departure boards as iframes or use them + in full-screen browser setups. The App frontend works best for + small screens, whereas the legacy Infoscreen mode is better suited + for large displays.</li> + <li>The departure board supports names, EVA IDs, and (in IRIS mode) + DS100/Ril100 codes as station identifiers.</li> + <li>Requests for train details can optionally be suffixed with the + DD.MM.[YYYY] date of the requested trip, e.g. "ICE 921 (1.1.)" or + "ICE 921 @ 1.1.". The date refers to the scheduled departure at the + train's origin station.</li> + <li>A JSON IRIS API is avaliable via + <span style="font-family: monospace;">mode=json&version=3</span> + (or just <span style="font-family: monospace;">https://dbf.finalrewind.org/Station.json?version=3</span>). + Route elements may contain "isAdditional" and "isCancelled"; the rest + should be self-explanatory. Please do not send more than 30 requests + per minute and only one request per station per minute.</li> + <li>There is no JSON API for train details yet.</li> + <li>The optional <span style="font-family: monospace;">limit</span> + parameter limits the number of returnd departures; e.g. + <span style="font-family: monospace;">limit=10</span> will result in no more than ten.</li> + <li>DBF is available as Open Source software + (<a href="https://github.com/derf/db-fakedisplay/blob/master/README.md">installation instructions</a>). + Please use your own installation for automated crawlers that request dozens of stations per minute.</li> + % } + % else { + <li>DBF-Abfahrtstafeln können gerne als iframe eingebunden oder in + fest installierten Vollbild-Browserfenstern verwendet werden. + Für eine kleine Ansicht (z.B. iframe in einer normalen Website) + empfiehlt sich das "App"-Frontend. Für eine große Ansicht + (z.B. als alleinstehender Infoscreen) gibt es den "Infoscreen"-Modus.</li> + <li>Die Abfahrtstafel unterstützt Namen, EVA-IDs, und (im IRIS-Backend) + DS100/Ril100-Codes zur Identifikation von Stationen.</li> + <li>Abfahrten werden mit Echtzeitdaten bzw. Prognosen angegeben und + danach sortiert. Mit dem Parameter + <span style="font-family: monospace;">rt=0</span> wwerden stattdessen + Plandaten angegeben und zur Sortierung genutzt.</li> + <li>Bei HAFAS-Backends können optional Details für spezifische Fahrten im + DD.MM.[YYYY]-Format abgefragt werden, z.B. "ICE 921 (1.1.)" oder + "ICE 921 @ 1.1.". Das Datum bezieht sich auf die geplante + Abfahrtszeit am Startbahnhof der Fahrt.</li> + <li>Viele Seiten sind auch als JSON verfügbar, wahlweise mittels + <span style="font-family: monospace;">Accept: application/json</span> oder + durch <span style="font-family: monospace;">.json</span> in der URL. + HAFAS- und IRIS-Abfahrtstafeln liefern mit dem GET-Parameter <span style="font-family: monospace;">version=3</span> eine stabile JSON-API. + Alle anderen Endpunkte (sowie Abfahrtstafeln mit <span style="font-family: monospace;">version=raw</span>) erlauben direkten Zugriff auf die serialisierten Travel::Status::DE::{EFA,HAFAS,IRIS}-Objekte ohne stabile API.</li> + <li>Bitte maximal 30 Anfragen pro Minute und insbesondere nur eine Anfrage + pro Station und Minute – eine höhere Auflösung haben die Backenddaten + ohnehin nicht.</li> + <li>Mit <span style="font-family: monospace;">limit</span> kann die Anzahl der + angezeigten / im JSON enthaltenen Abfahrten eingeschränkt werden, z.B. + <span style="font-family: monospace;">limit=10</span> für die ersten zehn.</li> + <li>Dieser Dienst ist Open Source-Software und kann leicht auf eigenen Servern + <a href="https://github.com/derf/db-fakedisplay/blob/master/README.md">installiert</a> + werden. Automatisierte Crawler, die mehrere Dutzend Stationen pro Minute + abfragen, bitte nur auf eigenen Instanzen betreiben.</li> + % } </ul> </div> <!-- developers --> </div> <!-- notes --> @@ -266,13 +286,32 @@ Bitte eine Station aus der Liste auswählen</div> </div> <!-- container --> <div class="container"> +<div class="config"> +Farbschema: +<a onClick="javascript:setTheme('light')">hell</a> +· +<a onClick="javascript:setTheme('dark')">dunkel</a> +· +<a onClick="javascript:setTheme('default')">automatisch</a> +<!--Language: +<br/> +<a onClick="javascript:setLang('de')">DE</a> +· +<a onClick="javascript:setLang('en')">EN</a> +· +<a onClick="javascript:setLang('default')">system language</a> +--> +</div> <!-- config --> +</div> <!-- container --> +% } +% if (not stash('hide_footer')) { +<div class="container"> <div class="about"> -<a href="_about">Über DBF</a> +<a href="_about">DBF</a> v<%= stash('version') // '???' %> · <a href="_datenschutz" rel="nofollow">Datenschutz</a> · -<a href="_impressum" rel="nofollow">Impressum</a><br/> -Version <%= stash('version') // '???' %> +<a href="_impressum" rel="nofollow">Impressum</a> </div> <!-- about --> </div> <!-- container --> % } |