summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-03-23 15:23:26 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-03-23 15:23:26 +0100
commit2539e9f0aec1a54dae2646d8a02d27d71c660966 (patch)
treea15b43bbe37db4e9a77995ff0d8245d66e117165 /public
parent150c5a137f8c34faf6936c8c64a4949224c319c9 (diff)
Allow light/dark/auto rather than just light/dark for theme
Replaces the theme switcher in the nav bar with a less intrusive link at the bottom. Closes #125
Diffstat (limited to 'public')
-rw-r--r--public/static/js/travelynx-actions.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js
index 52ca482..d20eab7 100644
--- a/public/static/js/travelynx-actions.js
+++ b/public/static/js/travelynx-actions.js
@@ -9,6 +9,15 @@ var j_arrival = 0;
var j_dest = '';
var j_stops = [];
var j_token = '';
+
+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 upd_journey_data() {
$('.countdown').each(function() {
const journey_token = $(this).data('token');