Dark mode fixed.

This commit is contained in:
Flancian 2020-11-15 02:16:20 +01:00
parent 3fb372a2b0
commit 7c19c6e72e

View file

@ -18,15 +18,15 @@
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
// Select button // Select button
const btn = document.querySelector(".theme-toggle"); const btn = document.querySelector(".theme-toggle");
// Select the stylesheet <link>
const theme = document.querySelector("#theme-link");
// Listen for a click on the button // Listen for a click on the button
btn.addEventListener("click", function() { btn.addEventListener("click", function() {
if (theme.getAttribute("href") == "{{ url_for('static',filename='css/screen-light.css')}}") { // Select the stylesheet <link>
theme.href = "{{ url_for('static',filename='css/screen-dark.css')}}"; var theme = document.querySelector("#theme-link");
if (theme.getAttribute("href") == "/static/css/screen-light.css") {
theme.href = "/static/css/screen-dark.css";
} else { } else {
theme.href = "{{ url_for('static',filename='css/screen-light.css')}}"; theme.href = "/static/css/screen-light.css";
} }
}); });
}); });