Skip to content

Commit

Permalink
Merge pull request #5 from anoduck/develop
Browse files Browse the repository at this point in the history
perf(alwaysdark.js): simplified Code Base
  • Loading branch information
anoduck authored Jan 20, 2025
2 parents e87feac + aad9ac8 commit bfad3f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions assets/js/modules/alwaysdark/alwaysdark.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
document.addEventListener("DOMContentLoaded", function() {
const theme = 'dark'
const darkOn = false
const storedTheme = () => localStorage.getItem('theme');
var checkbox = document.querySelector('input.navbar-mode-selector');

if (checkbox != null) {
if (storedTheme() != theme || checkbox.checked != darkOn) {
if (checkbox !== null) {
while (storedTheme() !== theme) {
checkbox.click()
localStorage.setItem('theme', theme)
window.reload()
}
}
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anoduck/mod-alwaysdark",
"version": "0.1.0",
"version": "0.1.3",
"description": "A template to define a Hugo module compatible with Hinode",
"keywords": [
"hugo",
Expand Down

0 comments on commit bfad3f4

Please sign in to comment.