perf(comments): 评论加载提速 + 骨架屏 + 友链弹窗 pjax 修复 + toast 统一 Message.js
优化: - initArtalk 加节点级幂等守卫(mount.__atkInited,失败回滚), 消除 artalk.html/mypjax 多入口导致的 4× comments + 4× pv 重复请求 - fetch 包装层对无 body 的 GET/HEAD 去掉多余 content-type, 消掉 Artalk 对 GET /comments 的 CORS 预检(按完整 URL 缓存, 每篇文章都重付一次 RTT)。实测评论列表 +1150~1565ms → +626ms 修复: - 评论列表骨架屏改注入 .atk-list-body(原骨架在 #Comments 内, 被 Artalk.init 清空),list-loaded/故障/12s 兜底移除 - 友链申请弹窗抽成 modules/friendlink.js 进 page-only bundle (原内联脚本在 #pjax-container 外,pjax 后 flApplyOpenModal 未定义) - toast 统一走本地化 Message.js/Qmsg 适配层(保留 window.Toast/showToast 旧 API) 文档: - README / 架构总览 更新;新增 评论加载优化方案.md
This commit is contained in:
1 parent
9e972f2b61
commit
50a906e07c
14 files changed
+1018
-486
No files matched your search
@@ -229,6 +229,16 @@
|
||||
</div>
|
||||
<!-- JS -->
|
||||
<!-- <script src="/js/Artalk.js"></script> -->
|
||||
<!-- ── /api/v2/conf 内联快照 ─────────────────────────────────────────────
|
||||
构建期由 .cnb.yml 拉一次 /api/v2/conf 落到 data/artalk_conf.json,这里原样内联。
|
||||
artalk.js 对匿名 /conf 请求直接本地合成响应,省掉一次跨境 RTT ——
|
||||
Artalk 内部 conf 与评论列表是「严格串行」的,去掉这一跳首屏即少一整个往返。
|
||||
文件不存在时(本地预览 / 拉取失败)不输出,前端自动回退到远程请求。 -->
|
||||
{{ with site.Data.artalk_conf }}
|
||||
{{- $snapJson := . | jsonify }}
|
||||
{{- $snapJson = replace $snapJson "</" "<\\/" }}
|
||||
<script>window.__artalkConfSnapshot = {{ $snapJson | safeJS }};</script>
|
||||
{{ end }}
|
||||
<script>
|
||||
// Configuration for Artalk and AI Comment
|
||||
window.artalkConfig = {
|
||||
|
||||
Reference in new issue
Block a user