diff options
author | uPagge <upagge@mail.ru> | 2020-12-12 22:39:21 +0300 |
---|---|---|
committer | uPagge <upagge@mail.ru> | 2020-12-12 22:39:21 +0300 |
commit | 200ca5c5b597c3d7dcd66c82a0532b4f40a7b0f5 (patch) | |
tree | eeff1e42a47f0e92f9c3a2c87985c0ceb45e6db8 /src | |
parent | 3e5a10b37b7174351ce307975c3f1960b39a7edc (diff) |
theme save fix
Diffstat (limited to 'src')
-rw-r--r-- | src/js/theme.js | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/js/theme.js b/src/js/theme.js index 211f0ce..d025311 100644 --- a/src/js/theme.js +++ b/src/js/theme.js @@ -81,18 +81,16 @@ class Theme { } initSwitchTheme() { - this.util.forEach(document.getElementsByClassName('theme-switch'), $themeSwitch => { $themeSwitch.addEventListener('click', () => { if (document.body.getAttribute('theme') === 'dark') { document.body.setAttribute('theme', 'light'); - window.REMARK42.changeTheme('light'); } else { document.body.setAttribute('theme', 'dark'); - window.REMARK42.changeTheme('dark'); } this.isDark = !this.isDark; window.localStorage && localStorage.setItem('theme', this.isDark ? 'dark' : 'light'); + window.REMARK42.changeTheme(document.body.getAttribute('theme') === 'dark' ? 'dark' : 'light'); for (let event of this.switchThemeEventSet) event(); }, false); }); @@ -597,13 +595,6 @@ class Theme { initComment() { if (this.config.comment) { - if (this.config.comment.remark42) { - if (this.isDark) { - window.REMARK42.changeTheme('dark'); - } else { - window.REMARK42.changeTheme('light'); - } - } if (this.config.comment.gitalk) { this.config.comment.gitalk.body = decodeURI(window.location.href); const gitalk = new Gitalk(this.config.comment.gitalk); |