fixed 评论区夜间模式bug
This commit is contained in:
1 parent
e4572b0a95
commit
af491dac12
2 files changed
+249
-121
No files matched your search
@@ -177,15 +177,29 @@ document.addEventListener("pjax:complete", function () {
|
||||
initCodeCopy()
|
||||
// 重载评论
|
||||
if (document.querySelector("#Comments")) {
|
||||
var isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
||||
// 默认配置作为后备
|
||||
var serverUrl = 'https://artalk.usj.cc';
|
||||
var siteName = '优世界';
|
||||
var emoticons = '/emotion/OwO.json';
|
||||
|
||||
// 尝试从 window.siteConfig 获取配置
|
||||
if (window.siteConfig && window.siteConfig.artalk) {
|
||||
serverUrl = window.siteConfig.artalk.server || serverUrl;
|
||||
siteName = window.siteConfig.artalk.site || siteName;
|
||||
emoticons = window.siteConfig.artalk.emoticons || emoticons;
|
||||
}
|
||||
|
||||
Artalk.init({
|
||||
el: '#Comments', // 绑定元素的 Selector
|
||||
server: 'https://artalk.usj.cc', // 后端地址
|
||||
site: '优世界', // 你的站点名
|
||||
server: serverUrl, // 后端地址
|
||||
site: siteName, // 你的站点名
|
||||
// 使用全局变量或 DOM 读取 pageKey
|
||||
// 必须动态获取当前页面的 pid (RelPermalink)
|
||||
pageKey: document.getElementById('data-pid')?.textContent?.trim() || location.pathname,
|
||||
flatMode: true,
|
||||
emoticons: '/emotion/OwO.json'
|
||||
darkMode: isDark,
|
||||
emoticons: emoticons
|
||||
})
|
||||
}
|
||||
// 重载评论弹幕
|
||||
|
||||
Reference in new issue
Block a user