mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
fc25c65afc
Fixes issues introduced in #1797. @int-y1 please refrain from using ES6 in the future if it's unnecessary, especially in .js files.
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
jQuery(function ($) {
|
|
$(document).on('martor:preview', function (e, $content) {
|
|
function update_math() {
|
|
MathJax.typesetPromise([$content[0]]).then(function () {
|
|
$content.find('.tex-image').hide();
|
|
$content.find('.tex-text').show();
|
|
});
|
|
}
|
|
|
|
var $jax = $content.find('.require-mathjax-support');
|
|
if ($jax.length) {
|
|
if (!('MathJax' in window)) {
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: $jax.attr('data-config'),
|
|
dataType: 'script',
|
|
cache: true,
|
|
success: function () {
|
|
window.MathJax.startup = {typeset: false};
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.min.js',
|
|
dataType: 'script',
|
|
cache: true,
|
|
success: update_math
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
update_math();
|
|
}
|
|
}
|
|
})
|
|
});
|