diff options
Diffstat (limited to 'templates/layouts/app.html.ep')
-rw-r--r-- | templates/layouts/app.html.ep | 155 |
1 files changed, 102 insertions, 53 deletions
diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep index 2307069..1578298 100644 --- a/templates/layouts/app.html.ep +++ b/templates/layouts/app.html.ep @@ -5,7 +5,7 @@ <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="description" content="<%= stash('description') // 'Inoffizieller Abfahrtsmonitor für innerdeutsche Zugfahrten' %>"> <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 = 'v63'; # asset version + % my $av = 'v96'; # 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,6 +117,7 @@ Bitte eine Station aus der Liste auswählen</div> %= form_for _redirect => begin +%= hidden_field hafas => param('hafas') <div> <div class="field"> <div class="desc">Zug / Station</div> @@ -130,16 +126,21 @@ Bitte eine Station aus der Liste auswählen</div> %= select_field input => stash('stationlist') % } % elsif (stash('input')) { - %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder DS100-Kürzel', id => 'stationinput' + %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder Ril100-Kürzel', id => 'stationinput' % } % else { - %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder DS100-Kürzel', id => 'stationinput', autofocus => 'autofocus' + %= text_field 'input', class => 'station', placeholder => 'Zug, Stationsname oder Ril100-Kürzel', id => 'stationinput', autofocus => 'autofocus' % } </div> </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({hafas => param('hafas')}) %>">Stationen in der Umgebung suchen</a> + </div> + % } <div class="break"></div> <div class="moresettings-header moresettings-header-collapsed button button-light">Weitere Einstellungen</div> <div class="moresettings moresettings-collapsed"> @@ -163,7 +164,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) + Mehr Details </label> </div> </div> @@ -171,7 +172,7 @@ Bitte eine Station aus der Liste auswählen</div> <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)") + Betriebliche Bahnhofstrennungen berücksichtigen (z.B. "Hbf (Fern+Regio)" vs. "Hbf (S)") </label> </div> </div> @@ -179,7 +180,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 + Bereits abgefahrene Züge anzeigen </label> </div> </div> @@ -187,7 +188,7 @@ 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> @@ -233,32 +234,65 @@ 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>Zugdetails können optional für spezifische Abfahrtsdaten 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 Zugfahrt.</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> + % } </ul> </div> <!-- developers --> </div> <!-- notes --> @@ -266,13 +300,28 @@ Bitte eine Station aus der Liste auswählen</div> </div> <!-- container --> <div class="container"> +<div class="config"> +Farbschema: +<a onClick="javascript:setTheme('light')">light</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> <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 --> % } |