Skip to content

Commit

Permalink
Merge pull request #38 from ppeetteerrs/dev
Browse files Browse the repository at this point in the history
Fixed light mode flashing. Fixed URL parsing (but now directory links are not supported, though it is not standard Obsidian behaviour)
  • Loading branch information
ppeetteerrs authored Jun 27, 2022
2 parents 726a7da + f3be8c7 commit fef8fdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions zola/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ document.getElementById("mode").addEventListener("click", () => {
}
});

// enforce local storage setting but also fallback to user-agent preferences
if (localStorage.getItem("theme") === "dark" || (!localStorage.getItem("theme") && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
document.body.classList.add("dark");
}

// Collapsible sidebar code (it's ugly but I don't care)
var sections = $(".collapsible-section");
if (!sidebar_collapsed) {
Expand Down
5 changes: 5 additions & 0 deletions zola/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
</head>
{% block body %}{% set page_class="home" %}{% endblock body %}
<body class="{{ page_class }}">
<script>
if (localStorage.getItem("theme") === "dark" || (!localStorage.getItem("theme") && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
document.body.classList.add("dark");
}
</script>
{% block header %}
{{ macros_header::header(current_section="/") }}
{% endblock header %}
Expand Down

0 comments on commit fef8fdc

Please sign in to comment.