fix: Halo评论组件暗色模式

This commit is contained in:
Airbo ZH 2023-02-10 18:06:55 +08:00 committed by airbo
parent 68b261dd1f
commit bbffe461a7
6 changed files with 18 additions and 3 deletions

View File

@ -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')
}
}
}

View File

@ -205,6 +205,7 @@ rm.switchDarkMode = function () {
navFn.switchDarkMode();
rm.hideRightMenu();
heo.darkModeStatus();
halo.darkComment();
}
rm.copyUrl = function (id) {

View File

@ -117,7 +117,7 @@
<span>你无需删除空行,直接评论以获取最佳展示效果</span>
</div>
</div>
<halo:comment group="content.halo.run" kind="SinglePage" th:attr="name='links'"/>
<halo:comment group="content.halo.run" kind="SinglePage" th:attr="name='links'" colorScheme="document.documentElement.getAttribute('data-theme')" />
</div>
</div>
</main>

View File

@ -14,6 +14,8 @@
<script th:src="@{/assets/js/heo.js}"></script>
<script th:src="@{/assets/js/halo.js}"></script>
<link rel="stylesheet" th:href="@{/assets/zhheo/zhheoblog.css}">
<link rel="stylesheet" th:href="@{/assets/zhheo/custom.css}">

View File

@ -26,7 +26,7 @@
</div>
</div>
<halo:comment group="content.halo.run" kind="SinglePage"
th:attr="name=${singlePage.metadata.name}"/>
th:attr="name=${singlePage.metadata.name}" colorScheme="document.documentElement.getAttribute('data-theme')" />
</div>
</div>

View File

@ -229,7 +229,7 @@
<span>你无需删除空行,直接评论以获取最佳展示效果</span>
</div>
</div>
<halo:comment group="content.halo.run" kind="Post" th:attr="name=${post.metadata.name}"/>
<halo:comment group="content.halo.run" kind="Post" th:attr="name=${post.metadata.name}" colorScheme="document.documentElement.getAttribute('data-theme') />
</div>
</div>