feat: 完善外部资源备用机制和日志系统

- 在header.php中添加用户角色检测,传递给前端JavaScript
- 更新Open Sans字体CSS文件,支持本地woff2字体文件备用
- 修改footer.php中MathJax 3/2和KaTeX加载机制,添加onerror备用处理
- 优化resource-loader.js日志系统,使用ArgonLogger替代console.log
- 仅管理员用户显示控制台日志,普通用户和游客不显示调试信息
- 完善资源加载错误处理,统一使用ArgonLogger记录警告信息
This commit is contained in:
2026-01-11 20:37:03 +08:00
parent a01f161bca
commit ea167c379a
17 changed files with 1621 additions and 60 deletions

View File

@@ -0,0 +1,72 @@
/* 字体备用系统 - 确保在任何情况下都有合适的字体显示 */
/* 全局字体备用栈 */
:root {
--font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-family-serif: Georgia, Cambria, "Times New Roman", Times, serif;
--font-family-mono: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
--font-family-chinese: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
}
/* 当 Open Sans 不可用时的备用 */
body, .open-sans-fallback {
font-family: "Open Sans", var(--font-family-sans);
}
/* 当 Noto Serif SC 不可用时的备用 */
.noto-serif-fallback {
font-family: "Noto Serif SC", var(--font-family-chinese), var(--font-family-serif);
}
/* 通用中文字体备用 */
.chinese-text {
font-family: var(--font-family-chinese);
}
/* 确保代码字体始终可用 */
code, pre, .monospace {
font-family: var(--font-family-mono);
}
/* 字体加载失败时的样式调整 */
.font-loading-error {
font-family: var(--font-family-sans) !important;
}
.font-loading-error::before {
content: "";
display: inline-block;
width: 0;
height: 0;
}
/* 响应式字体大小 */
@media (max-width: 768px) {
body {
font-size: 14px;
line-height: 1.5;
}
}
@media (min-width: 769px) {
body {
font-size: 16px;
line-height: 1.6;
}
}
/* 确保图标字体备用 */
.fa, .fas, .far, .fal, .fab {
font-family: "Font Awesome 5 Free", "Font Awesome 5 Pro", "FontAwesome", sans-serif;
}
/* 当图标字体不可用时显示文字 */
.fa-home::after { content: "首页"; }
.fa-user::after { content: "用户"; }
.fa-search::after { content: "搜索"; }
.fa-menu::after { content: "菜单"; }
.fa-close::after { content: "关闭"; }
.fa-arrow-left::after { content: "←"; }
.fa-arrow-right::after { content: "→"; }
.fa-arrow-up::after { content: "↑"; }
.fa-arrow-down::after { content: "↓"; }