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:
62
assets/vendor/external/mathjax2/MathJax.js
vendored
Normal file
62
assets/vendor/external/mathjax2/MathJax.js
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/* MathJax 2 - Local Fallback */
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
console.warn('MathJax 2 本地备用版本 - 功能受限');
|
||||
|
||||
// 创建简化的 MathJax 对象
|
||||
window.MathJax = window.MathJax || {};
|
||||
|
||||
window.MathJax.Hub = {
|
||||
Config: function(config) {
|
||||
console.log('MathJax 2 配置已设置(备用版本)');
|
||||
this.config = config;
|
||||
},
|
||||
|
||||
Queue: function(callback) {
|
||||
if (typeof callback === 'function') {
|
||||
setTimeout(callback, 100);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
Typeset: function(element) {
|
||||
console.warn('MathJax 2 渲染功能不可用 - 使用备用版本');
|
||||
// 简单的样式处理
|
||||
var mathElements = element ?
|
||||
element.querySelectorAll('script[type*="math"]') :
|
||||
document.querySelectorAll('script[type*="math"]');
|
||||
|
||||
mathElements.forEach(function(script) {
|
||||
var span = document.createElement('span');
|
||||
span.textContent = script.textContent;
|
||||
span.style.fontStyle = 'italic';
|
||||
span.style.color = '#666';
|
||||
span.title = '数学公式渲染服务不可用';
|
||||
script.parentNode.insertBefore(span, script);
|
||||
script.style.display = 'none';
|
||||
});
|
||||
},
|
||||
|
||||
Register: {
|
||||
StartupHook: function(hook, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
setTimeout(callback, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 自动配置
|
||||
if (window.MathJax.Hub.Config) {
|
||||
window.MathJax.Hub.Config({
|
||||
messageStyle: "none",
|
||||
tex2jax: {
|
||||
inlineMath: [["$", "$"], ["\\\\(", "\\\\)"]],
|
||||
displayMath: [['$$','$$']],
|
||||
processEscapes: true,
|
||||
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user