Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/uPagge/uBlogger.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruPagge <upagge@mail.ru>2020-12-09 20:07:36 +0300
committeruPagge <upagge@mail.ru>2020-12-09 20:07:36 +0300
commit76a23ebe787a258545e8c963fc0fb38a3dcbae67 (patch)
treeeb31de42dd0c1c6bfa948898402149bc8521f1a3 /src
parentfdbc5b61d0f7a5950c6398f8cb5149973ce33690 (diff)
Theme switch remark42
Diffstat (limited to 'src')
-rw-r--r--src/js/theme.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/js/theme.js b/src/js/theme.js
index 06cd237..719f0fd 100644
--- a/src/js/theme.js
+++ b/src/js/theme.js
@@ -83,8 +83,13 @@ 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');
- else document.body.setAttribute('theme', 'dark');
+ 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');
for (let event of this.switchThemeEventSet) event();