diff --git a/_includes/comments/remark42.html b/_includes/comments/remark42.html index 8ab159e..f17e91d 100644 --- a/_includes/comments/remark42.html +++ b/_includes/comments/remark42.html @@ -6,7 +6,7 @@ max_shown_comments: 10, // theme: 'light', - theme: document.documentElement.hasAttribute("data-mode")? "dark": "light", + theme: document.documentElement.hasAttribute("data-mode") ? "dark" : "light", locale: 'en', show_email_subscription: false @@ -22,7 +22,19 @@ } })(remark_config.components || ['embed']); + var targetDiv = document.getElementById("sidebar").getElementsByClassName("mode-toggle")[0]; + + if (targetDiv != null) { + targetDiv.addEventListener("click", () => { + if (document.documentElement.hasAttribute("data-mode")) { + window.REMARK42.changeTheme('dark'); + } else { + window.REMARK42.changeTheme('light'); + } + }) + } +
-
+ \ No newline at end of file