✨ feat: 添加 MathJax 字体文件并优化代码加载逻辑
This commit is contained in:
@@ -184,7 +184,28 @@
|
||||
|
||||
aceAssetsPromise = new Promise(function (resolve, reject) {
|
||||
var aceScriptSrc = aceBase + '/ace.js';
|
||||
var languageToolsSrc = aceBase + '/ext-language_tools.js';
|
||||
var existing = documentRef.querySelector('script[data-hustoj-ace-js="' + aceScriptSrc + '"]');
|
||||
var loadLanguageTools = function () {
|
||||
var languageTools = documentRef.querySelector('script[data-hustoj-ace-js="' + languageToolsSrc + '"]');
|
||||
var done = function () {
|
||||
finish();
|
||||
};
|
||||
|
||||
if (languageTools) {
|
||||
languageTools.addEventListener('load', done, { once: true });
|
||||
languageTools.addEventListener('error', done, { once: true });
|
||||
return;
|
||||
}
|
||||
|
||||
languageTools = documentRef.createElement('script');
|
||||
languageTools.src = languageToolsSrc;
|
||||
languageTools.async = true;
|
||||
languageTools.setAttribute('data-hustoj-ace-js', languageToolsSrc);
|
||||
languageTools.onload = done;
|
||||
languageTools.onerror = done;
|
||||
documentRef.head.appendChild(languageTools);
|
||||
};
|
||||
var finish = function () {
|
||||
if (global.ace && global.ace.config && typeof global.ace.config.set === 'function') {
|
||||
global.ace.config.set('basePath', aceBase);
|
||||
@@ -194,9 +215,9 @@
|
||||
|
||||
if (existing) {
|
||||
if (global.ace) {
|
||||
finish();
|
||||
loadLanguageTools();
|
||||
} else {
|
||||
existing.addEventListener('load', finish, { once: true });
|
||||
existing.addEventListener('load', loadLanguageTools, { once: true });
|
||||
existing.addEventListener('error', reject, { once: true });
|
||||
}
|
||||
return;
|
||||
@@ -206,7 +227,7 @@
|
||||
script.src = aceScriptSrc;
|
||||
script.async = true;
|
||||
script.setAttribute('data-hustoj-ace-js', aceScriptSrc);
|
||||
script.onload = finish;
|
||||
script.onload = loadLanguageTools;
|
||||
script.onerror = function () {
|
||||
reject(new Error('Failed to load ' + aceScriptSrc));
|
||||
};
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
web/template/syzoj/output/chtml/fonts/woff-v2/MathJax_Zero.woff
Normal file
BIN
web/template/syzoj/output/chtml/fonts/woff-v2/MathJax_Zero.woff
Normal file
Binary file not shown.
@@ -65,7 +65,7 @@ if ($pr_flag) {
|
||||
|
||||
.sample-box pre {
|
||||
margin: 0;
|
||||
padding: 16px 18px;
|
||||
padding: 48px 18px 16px;
|
||||
overflow: auto;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user