refactor: 彻底移除所有 Mermaid 支持

- 从 argontheme.js 移除所有 Mermaid 相关代码和注释
- 从 style.css 移除所有 Mermaid 样式(约 300 行)
- 移除代码高亮中跳过 mermaid 容器的逻辑
- 移除 PJAX 清理函数中的 Mermaid 引用
- 删除临时清理脚本和空文档
This commit is contained in:
2026-01-27 10:42:08 +08:00
parent 8a74a3b3f6
commit 0a8bb3a453
26 changed files with 542 additions and 11418 deletions

View File

@@ -696,23 +696,58 @@ class ArgonResourceLoader {
return this.loading.get(name);
}
// 创建新的加载 Promise
const timeoutValue = (typeof argonConfig !== 'undefined' && argonConfig.resource_load_timeout) ? parseInt(argonConfig.resource_load_timeout, 10) : 8000;
const timeout = Number.isFinite(timeoutValue) ? timeoutValue : 8000;
const promise = new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = url;
script.async = true;
script.onload = () => {
let finished = false;
let timeoutId = null;
const clearState = () => {
if (timeoutId) {
clearTimeout(timeoutId);
timeoutId = null;
}
script.onload = null;
script.onerror = null;
};
const resolveSuccess = () => {
if (finished) return;
finished = true;
clearState();
this.loaded.add(name);
this.loading.delete(name);
resolve();
};
script.onerror = () => {
const rejectFailure = (error) => {
if (finished) return;
finished = true;
clearState();
if (script.parentNode) {
script.parentNode.removeChild(script);
}
this.loading.delete(name);
reject(new Error(`Failed to load ${name} from ${url}`));
reject(error);
};
script.onload = () => {
resolveSuccess();
};
script.onerror = () => {
rejectFailure(new Error(`Failed to load ${name} from ${url}`));
};
timeoutId = setTimeout(() => {
rejectFailure(new Error(`Timeout loading ${name} from ${url}`));
}, timeout);
document.head.appendChild(script);
});