diff --git a/assets/js/modules/alwaysdark/alwaysdark.js b/assets/js/modules/alwaysdark/alwaysdark.js index 1cd57a8..e2fbaa6 100644 --- a/assets/js/modules/alwaysdark/alwaysdark.js +++ b/assets/js/modules/alwaysdark/alwaysdark.js @@ -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() } } -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index aa3532f..3f22030 100644 --- a/package.json +++ b/package.json @@ -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",