mirror of
https://ghfast.top/https://github.com/zsjy/halo-theme-dream2.0-plus.git
synced 2025-03-15 18:59:40 +08:00
perf(comment): 评论区支持动态黑暗模式切换
This commit is contained in:
parent
d4c7ca6c1b
commit
32b10fa108
@ -75,6 +75,11 @@ const commonContext = {
|
||||
} else {
|
||||
document.documentElement.classList.remove('night')
|
||||
}
|
||||
$('.comment-section>div').each(function () {
|
||||
const shadowDom = this.shadowRoot.querySelectorAll('.halo-comment-widget')[0]
|
||||
$(shadowDom)[`${isNightValue ? 'add' : 'remove'}Class`]('dark')
|
||||
$(shadowDom)[`${isNightValue ? 'remove' : 'add'}Class`]('light')
|
||||
})
|
||||
localStorage.setItem('night', isNightValue)
|
||||
isNight = isNightValue
|
||||
}
|
||||
@ -418,7 +423,7 @@ const commonContext = {
|
||||
group: target === 'Moment' ? 'moment.halo.run' : 'content.halo.run',
|
||||
kind: target,
|
||||
name: id,
|
||||
colorScheme: window.dataTheme
|
||||
colorScheme: (localStorage.getItem('night') !== 'true' ? 'light' : 'dark')
|
||||
}
|
||||
)
|
||||
})
|
||||
|
2
templates/assets/css/style.min.css
vendored
2
templates/assets/css/style.min.css
vendored
File diff suppressed because one or more lines are too long
2
templates/assets/js/common.min.js
vendored
2
templates/assets/js/common.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user