评论区硬切换实现

This commit is contained in:
kate522 committed 2026-08-30 17:34:29 +08:00
1 parent ed914d2eec
commit b8ef4d81a4
32 files changed
+946 -1008

No files matched your search

+10 -5
View File
@@ -273,20 +273,25 @@
// §10.10a — 拦截 vendor 评论脚本 & 解绑 vendor ajax 委托
// ══════════════════════════════════════════════════════════════
// vendor 链路:loader.js(tbquire,改造版 RequireJS)→ main.min.js 检测到
// #commentform/#postcomments 即 tbquire(["comment"]) 懒加载 comment.min.js。
// #commentform/#postcomments 即 tbquire(["comment"]) 懒加载 comment.min.js;
// 检测到 .dropdown-code/.dropdown-image 即 tbquire(["input-expand"])。
// AKSRT 自有评论脚本(comments/comment-tools/comment-fixed-input/
// comment-move-form/comment-ajax)已承担全部行为,vendor comment.min.js 的
// 7 条 body 委托会双路触发(提交 legacy action=submit_comment 无处理器,
// 即控制台「ajax请求错误」400 "0" 的来源;回复/排序/分页同理)。
// 即控制台「ajax请求错误」400 "0" 的来源;回复/排序/分页同理);
// vendor input-expand.min.js(表情/快捷回复旧链路,源文件已删除)同理不再下载。
//
// 双层防御:
// 1) tbfine 预注册空 'comment' 模块 → tbquire 不再下载 comment.min.js;
// 1) tbfine 预注册空 'comment'/'input-expand' 模块 → tbquire 不再下载;
// 2) 若模块抢在注册前加载,退化为对 7 条委托做幂等 .off。
function stubVendorCommentModule() {
if (!(window.tbfine && window.tbquire && window.tbquire.defined)) return false;
try {
if (window.tbquire.defined('comment')) return true;
window.tbfine('comment', [], function () { return {}; });
['comment', 'input-expand'].forEach(function (name) {
if (!window.tbquire.defined(name)) {
window.tbfine(name, [], function () { return {}; });
}
});
return true;
} catch (e) {
return false;