fixed 移动端bug 评论手动刷新 bug

This commit is contained in:
Vaica committed 2026-01-23 16:20:37 +08:00
1 parent 8ac8faa642
commit 9e00544b19
1 file changed
+22 -14
+22 -14
View File
@@ -1,5 +1,5 @@
<!-- CSS -->
<link href="/css/Artalk.css" rel="stylesheet" />
<!-- <link href="/css/Artalk.css" rel="stylesheet" /> -->
<style>
.atk-loading{
background: #FFFFFF;
@@ -19,18 +19,26 @@
<!-- Artalk -->
<div id="Comments" uk-scrollspy="target: div,span,img; cls: uk-animation-slide-bottom-small;"></div>
<!-- JS -->
<script src="/js/Artalk.js"></script>
<!-- <script src="/js/Artalk.js"></script> -->
<script>
if (document.querySelector("#Comments")) {
var isDark = document.documentElement.getAttribute('data-theme') === 'dark';
Artalk.init({
el: '#Comments',
server: 'https://artalk.usj.cc',
site: '优世界',
pageKey: '{{ .RelPermalink }}',
flatMode: true,
darkMode: isDark,
emoticons: '/emotion/OwO.json'
// 等待 DOM 加载完成,确保 Artalk.js (在 footer 的 bundle.js 中) 已加载
document.addEventListener("DOMContentLoaded", function() {
if (document.querySelector("#Comments")) {
// 检查 Artalk 是否已定义
if (typeof Artalk !== 'undefined') {
var isDark = document.documentElement.getAttribute('data-theme') === 'dark';
Artalk.init({
el: '#Comments',
server: 'https://artalk.usj.cc',
site: '优世界',
pageKey: '{{ .RelPermalink }}',
flatMode: true,
darkMode: isDark,
emoticons: '/emotion/OwO.json'
});
} else {
console.error('Artalk is not defined. Bundle js may not be loaded yet.');
}
}
});
}
</script>
</script>