mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
feat: 增加Remark42评论系统主题色适应
feat: 增加Remark42主题评论系统自定义显示评论数
This commit is contained in:
parent
060defa475
commit
41ac7f170c
@ -362,6 +362,7 @@ remark42:
|
|||||||
language: en # https://remark42.com/docs/configuration/frontend/#locales
|
language: en # https://remark42.com/docs/configuration/frontend/#locales
|
||||||
showEmailSubscription: true
|
showEmailSubscription: true
|
||||||
simpleView: false
|
simpleView: false
|
||||||
|
maxShownComments: 15
|
||||||
|
|
||||||
# Chat Services
|
# Chat Services
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
- const { host, siteId, language } = theme.remark42
|
- const { host, siteId, language } = theme.remark42
|
||||||
script.
|
script.
|
||||||
|
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
|
||||||
var remark_config = {
|
var remark_config = {
|
||||||
host: '!{host}',
|
host: '!{host}',
|
||||||
site_id: '!{siteId}',
|
site_id: '!{siteId}',
|
||||||
components: ['embed'],
|
components: ['embed'],
|
||||||
locale: '!{language}',
|
locale: '!{language}',
|
||||||
show_email_subscription: #{theme.remark42.showEmailSubscription},
|
show_email_subscription: #{theme.remark42.showEmailSubscription},
|
||||||
|
theme: nowTheme,
|
||||||
simple_view: #{theme.remark42.simpleView}
|
simple_view: #{theme.remark42.simpleView}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +26,16 @@ script.
|
|||||||
})(remark_config.components || ['embed'], document)
|
})(remark_config.components || ['embed'], document)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeRemark42Theme(){
|
||||||
|
let theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'
|
||||||
|
window.REMARK42.changeTheme(theme)
|
||||||
|
}
|
||||||
|
|
||||||
|
let themeBtn = document.getElementById('darkmode')
|
||||||
|
themeBtn.addEventListener('click',()=>{
|
||||||
|
changeRemark42Theme()
|
||||||
|
})
|
||||||
|
|
||||||
if ('!{theme.comments.use[0]}' === 'Remark42' || !!{theme.comments.lazyload}) {
|
if ('!{theme.comments.use[0]}' === 'Remark42' || !!{theme.comments.lazyload}) {
|
||||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('remark42'), loadRemark42)
|
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('remark42'), loadRemark42)
|
||||||
else loadRemark42()
|
else loadRemark42()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user