Skip to content

Commit

Permalink
Remove theming dependence on jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
alshedivat committed Oct 30, 2021
1 parent 032ff48 commit d500e08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 7 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@
{% endif %}
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | relative_url }}">

{% if site.enable_darkmode %}
<!-- Dark Mode -->
<script src="{{ '/assets/js/theme.js' | relative_url }}"></script>
<script src="{{ '/assets/js/dark_mode.js' | relative_url }}"></script>
{% endif %}

6 changes: 0 additions & 6 deletions _includes/scripts/misc.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
{% if site.enable_darkmode %}
<!-- Dark Mode -->
<script src="{{ '/assets/js/theme.js' | relative_url }}"></script>
<script src="{{ '/assets/js/dark_mode.js' | relative_url }}"></script>
{% endif %}

{% if site.enable_tooltips %}
<!-- Enable Tooltips -->
<script type="text/javascript">
Expand Down
3 changes: 2 additions & 1 deletion assets/js/dark_mode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
$(document).ready(function() {
document.addEventListener('DOMContentLoaded', function() {
const mode_toggle = document.getElementById("light-toggle");

mode_toggle.addEventListener("click", function() {
toggleTheme(localStorage.getItem("theme"));
});
});

0 comments on commit d500e08

Please sign in to comment.