feat: mathjax support on user_self_review page
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-09-22 10:38:06 +08:00
parent 1b955c5913
commit 0c21b31517
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -11,6 +11,7 @@
$username = UOJContext::user()['username']; $username = UOJContext::user()['username'];
$REQUIRE_LIB['mathjax'] = '';
?> ?>
<?php echoUOJPageHeader(UOJLocale::get('contests::contest self reviews')) ?> <?php echoUOJPageHeader(UOJLocale::get('contests::contest self reviews')) ?>
@ -64,7 +65,7 @@
$result .= '<td><div id="' . $problem_review_id . '"></div></td>'; $result .= '<td><div id="' . $problem_review_id . '"></div></td>';
$esc_problem_self_review = rawurlencode($problem_self_review != null ? $problem_self_review['content'] : ''); $esc_problem_self_review = rawurlencode($problem_self_review != null ? $problem_self_review['content'] : '');
$result .= '<script type="text/javascript">' $result .= '<script type="text/javascript">'
. "$(function() { $('#$problem_review_id').html(DOMPurify.sanitize(decodeURIComponent(\"{$esc_problem_self_review}\"), $dom_sanitize_config)); });" . "(function() { $('#$problem_review_id').html(DOMPurify.sanitize(decodeURIComponent(\"{$esc_problem_self_review}\"), $dom_sanitize_config)); })();"
. '</script>'; . '</script>';
if ($i == 0) { if ($i == 0) {
@ -73,7 +74,7 @@
$esc_contest_self_review = rawurlencode($contest_self_review != null ? $contest_self_review['content'] : ''); $esc_contest_self_review = rawurlencode($contest_self_review != null ? $contest_self_review['content'] : '');
$result .= '<td rowspan="' . $n_contest_problems . '"><div id="' . $contest_review_id . '"></div></td>'; $result .= '<td rowspan="' . $n_contest_problems . '"><div id="' . $contest_review_id . '"></div></td>';
$result .= '<script type="text/javascript">' $result .= '<script type="text/javascript">'
. "$(function() { $('#$contest_review_id').html(DOMPurify.sanitize(decodeURIComponent(\"{$esc_contest_self_review}\"), $dom_sanitize_config)); });" . "(function() { $('#$contest_review_id').html(DOMPurify.sanitize(decodeURIComponent(\"{$esc_contest_self_review}\"), $dom_sanitize_config)); })();"
. '</script>'; . '</script>';
} }
@ -85,5 +86,5 @@
echoLongTable($col_names, $from, $cond, $tail, $header_row, $print_row, $config); echoLongTable($col_names, $from, $cond, $tail, $header_row, $print_row, $config);
?> ?>
<script>if (window.MathJax) MathJax.typeset();</script>
<?php echoUOJPageFooter() ?> <?php echoUOJPageFooter() ?>