diff --git a/themes/Ying/assets/js/mypjax.js b/themes/Ying/assets/js/mypjax.js index 60109f1b..db6b19a5 100644 --- a/themes/Ying/assets/js/mypjax.js +++ b/themes/Ying/assets/js/mypjax.js @@ -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 }) } // 重载评论弹幕 diff --git a/themes/Ying/layouts/_default/tiaozhuan.html b/themes/Ying/layouts/_default/tiaozhuan.html index 51d696b1..57052bc2 100644 --- a/themes/Ying/layouts/_default/tiaozhuan.html +++ b/themes/Ying/layouts/_default/tiaozhuan.html @@ -5,156 +5,270 @@ + 即将离开{{ site.Title }} - -