From a702051aef4b32fca7fd516a34415fcbb1e8c871 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 3 Dec 2023 12:07:07 +0100 Subject: Move theme switcher to bottom; add 'use device theme' --- lib/DBInfoscreen/I18N/en.pm | 1 - public/static/js/collapse.js | 13 +++++++++++++ sass/app.scss | 21 +++++++++++++++++---- templates/layouts/app.html.ep | 36 +++++++++++++++++++++--------------- 4 files changed, 51 insertions(+), 20 deletions(-) diff --git a/lib/DBInfoscreen/I18N/en.pm b/lib/DBInfoscreen/I18N/en.pm index 50790c5..8557781 100644 --- a/lib/DBInfoscreen/I18N/en.pm +++ b/lib/DBInfoscreen/I18N/en.pm @@ -36,7 +36,6 @@ our %Lexicon = ( 'Nur Abfahrt' => 'departure only', 'Nur Ankunft' => 'arrival only', 'Anzeigen' => 'Submit', - 'Über DBF' => 'About', 'Datenschutz' => 'Privacy', 'Impressum' => 'Imprint', diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js index 2beead1..30e111e 100644 --- a/public/static/js/collapse.js +++ b/public/static/js/collapse.js @@ -4,6 +4,19 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +function setLang(lang) { + document.cookie = 'lang=' + lang; + location.reload(); +} + +function setTheme(theme) { + localStorage.setItem('theme', theme); + if (!otherTheme.hasOwnProperty(theme)) { + theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; + } + addStyleSheet(theme, 'theme'); +} + function reload_app() { // TODO use a variable instead of window.location.href, as // window.location.href may be /z/... diff --git a/sass/app.scss b/sass/app.scss index b561c77..f63c85c 100644 --- a/sass/app.scss +++ b/sass/app.scss @@ -30,6 +30,7 @@ a { p, div.about, +div.config, div.input-field, div.notes { max-width: 94%; @@ -669,15 +670,27 @@ div.candidatelist a .traininfo { padding-bottom: 0.3em; } -div.about { +div.config { margin-top: 2em; font-family: Sans-Serif; color: $fg2; + + a { + color: $link-color; + cursor: pointer; + text-decoration: none; + } } -div.about a { - color: $link-color; - text-decoration: none; +div.about { + margin-top: 1em; + font-family: Sans-Serif; + color: $fg2; + + a { + color: $link-color; + text-decoration: none; + } } .notice { diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep index 1795471..7e8e38a 100644 --- a/templates/layouts/app.html.ep +++ b/templates/layouts/app.html.ep @@ -27,14 +27,14 @@ % } %= stylesheet "/static/${av}/css/material-icons.css" %= stylesheet "/static/${av}/css/jquery-ui.min.css" @@ -88,9 +82,6 @@ <%= stash('api_text') %> % } -
  • - Farbschema invertieren -
  • % if (stash('hide_opts')) {
  • Hauptseite
  • % } @@ -296,13 +287,28 @@
    +
    +Theme: +dark +· +light +· +device theme + +
    -<%= l 'Über DBF' %> +DBF v<%= stash('version') // '???' %> · <%= l 'Datenschutz' %> · -<%= l 'Impressum' %>
    -Version <%= stash('version') // '???' %> +<%= l 'Impressum' %>
    % } -- cgit v1.2.3