fixed 关于页面bug
This commit is contained in:
1 parent
f1494d10dd
commit
371ec8adca
154 files changed
+767
-738
No files matched your search
@@ -175,28 +175,14 @@ document.addEventListener("pjax:complete", function () {
|
||||
pjax_reload()
|
||||
// 初始化代码复制
|
||||
initCodeCopy()
|
||||
// 激活返回顶部插件
|
||||
$(function () {
|
||||
$.scrollUp({
|
||||
animation: 'fade',
|
||||
scrollImg: true
|
||||
});
|
||||
});
|
||||
// 重载评论
|
||||
if (document.querySelector("#Comments")) {
|
||||
Artalk.init({
|
||||
el: '#Comments', // 绑定元素的 Selector
|
||||
server: 'https://artalk.usj.cc', // 后端地址
|
||||
site: '优世界', // 你的站点名
|
||||
// 使用全局变量或 DOM 读取 pageKey,这里需要注意 Pjax 切换时如何获取新页面的 pid
|
||||
// 由于 Pjax 只是替换 HTML,我们需要从新页面的 DOM 中提取 pid
|
||||
// 建议在 single.html 中埋一个隐藏元素存储 pid,或者直接依赖 window.location (但用户想要 /post/id)
|
||||
// 修正:Pjax 切换后,HTML 已经更新,如果我们在 artalk.html 中输出了正确的配置脚本,
|
||||
// 那么这段 JS 代码其实是在旧页面加载的 static js 中。
|
||||
// Artalk.init 在 mypjax.js 中被调用时,参数是写死的或者从当前环境获取。
|
||||
// 必须动态获取当前页面的 pid。
|
||||
// 方案:在 layouts/_default/single.html 中添加一个 hidden input 存储 pid
|
||||
// 然后在这里读取。
|
||||
// 使用全局变量或 DOM 读取 pageKey
|
||||
// 必须动态获取当前页面的 pid (RelPermalink)
|
||||
pageKey: document.getElementById('data-pid')?.innerText || location.pathname,
|
||||
flatMode: true,
|
||||
emoticons: '/emotion/OwO.json'
|
||||
|
||||
Reference in new issue
Block a user