From bbffe461a7f3e3481b8f4c89bd853fcc91ca4032 Mon Sep 17 00:00:00 2001 From: Airbo ZH Date: Fri, 10 Feb 2023 18:06:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Halo=E8=AF=84=E8=AE=BA=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=9A=97=E8=89=B2=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/assets/js/halo.js | 12 ++++++++++++ templates/assets/zhheo/rightmenu.js | 1 + templates/links.html | 2 +- templates/modules/head.html | 2 ++ templates/page.html | 2 +- templates/post.html | 2 +- 6 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 templates/assets/js/halo.js diff --git a/templates/assets/js/halo.js b/templates/assets/js/halo.js new file mode 100644 index 00000000..69f98c99 --- /dev/null +++ b/templates/assets/js/halo.js @@ -0,0 +1,12 @@ +let halo = { + darkComment : ()=>{ + if(document.querySelector('#comment div').shadowRoot.querySelector('.halo-comment-widget').classList != null){ + let commentDOMclass = document.querySelector('#comment div').shadowRoot.querySelector('.halo-comment-widget').classList + if(commentDOMclass.contains('light')) + commentDOMclass.replace('light','dark') + else + commentDOMclass.replace('dark','light') + } + + } +} \ No newline at end of file diff --git a/templates/assets/zhheo/rightmenu.js b/templates/assets/zhheo/rightmenu.js index 463a82c1..80a45f0f 100644 --- a/templates/assets/zhheo/rightmenu.js +++ b/templates/assets/zhheo/rightmenu.js @@ -205,6 +205,7 @@ rm.switchDarkMode = function () { navFn.switchDarkMode(); rm.hideRightMenu(); heo.darkModeStatus(); + halo.darkComment(); } rm.copyUrl = function (id) { diff --git a/templates/links.html b/templates/links.html index 084310c4..ecf192be 100644 --- a/templates/links.html +++ b/templates/links.html @@ -117,7 +117,7 @@ 你无需删除空行,直接评论以获取最佳展示效果 - + diff --git a/templates/modules/head.html b/templates/modules/head.html index ed75c642..d675babc 100644 --- a/templates/modules/head.html +++ b/templates/modules/head.html @@ -14,6 +14,8 @@ + + diff --git a/templates/page.html b/templates/page.html index ef52ffd4..9c512ab7 100644 --- a/templates/page.html +++ b/templates/page.html @@ -26,7 +26,7 @@ + th:attr="name=${singlePage.metadata.name}" colorScheme="document.documentElement.getAttribute('data-theme')" /> diff --git a/templates/post.html b/templates/post.html index 85702b22..1d6120c8 100644 --- a/templates/post.html +++ b/templates/post.html @@ -229,7 +229,7 @@ 你无需删除空行,直接评论以获取最佳展示效果 - +