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:
BIN
assets/vendor/external/fonts/files/opensans-300-latin.woff2
vendored
Normal file
BIN
assets/vendor/external/fonts/files/opensans-300-latin.woff2
vendored
Normal file
Binary file not shown.
BIN
assets/vendor/external/fonts/files/opensans-400-latin.woff2
vendored
Normal file
BIN
assets/vendor/external/fonts/files/opensans-400-latin.woff2
vendored
Normal file
Binary file not shown.
BIN
assets/vendor/external/fonts/files/opensans-600-latin.woff2
vendored
Normal file
BIN
assets/vendor/external/fonts/files/opensans-600-latin.woff2
vendored
Normal file
Binary file not shown.
72
assets/vendor/external/fonts/font-fallback.css
vendored
Normal file
72
assets/vendor/external/fonts/font-fallback.css
vendored
Normal 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: "↓"; }
|
||||
28
assets/vendor/external/fonts/open-sans.css
vendored
28
assets/vendor/external/fonts/open-sans.css
vendored
@@ -1,32 +1,50 @@
|
||||
/* Open Sans Font - Local Fallback */
|
||||
/* Open Sans Font - 完整本地备用版本 */
|
||||
|
||||
/* 300 weight - latin */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
font-display: swap;
|
||||
src: local('Open Sans Light'), local('OpenSans-Light');
|
||||
src: url('files/opensans-300-latin.woff2') format('woff2'),
|
||||
local('Open Sans Light'), local('OpenSans-Light');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* 400 weight - latin */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: local('Open Sans Regular'), local('OpenSans-Regular');
|
||||
src: url('files/opensans-400-latin.woff2') format('woff2'),
|
||||
local('Open Sans Regular'), local('OpenSans-Regular');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* 600 weight - latin */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold');
|
||||
src: url('files/opensans-600-latin.woff2') format('woff2'),
|
||||
local('Open Sans SemiBold'), local('OpenSans-SemiBold');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* 700 weight - latin */
|
||||
@font-face {
|
||||
font-family: 'Open Sans';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-display: swap;
|
||||
src: local('Open Sans Bold'), local('OpenSans-Bold');
|
||||
src: url('files/opensans-700-latin.woff2') format('woff2'),
|
||||
local('Open Sans Bold'), local('OpenSans-Bold');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
/* 备用字体栈 */
|
||||
body, .font-sans-serif {
|
||||
font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
}
|
||||
Reference in New Issue
Block a user