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
@@ -20,17 +20,8 @@ function themeSweep(newTheme, callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
// Toast Message Helper
|
||||
window.showToast = function(text, type) {
|
||||
if (window.Toast) {
|
||||
var t = type || 'info';
|
||||
if (typeof window.Toast[t] === 'function') {
|
||||
window.Toast[t](text);
|
||||
} else {
|
||||
window.Toast.info(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
// Toast 快捷方式已统一迁到 modules/toast.js(Message.js/Qmsg 适配层),
|
||||
// 这里不再重复定义 window.showToast,避免双实现漂移。
|
||||
|
||||
// Theme Toggle Logic
|
||||
window.initThemeToggle = function() {
|
||||
|
||||
Reference in new issue
Block a user