mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-12-26 00:31:53 +00:00
feat: support mathjax in contest self reviews
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3b68e6c503
commit
ca3680727c
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
requirePHPLib('form');
|
||||
|
||||
$REQUIRE_LIB['mathjax'] = '';
|
||||
|
||||
if (!Auth::check()) {
|
||||
become403Page(UOJLocale::get('need login'));
|
||||
}
|
||||
|
@ -1109,10 +1109,10 @@ function showStandings() {
|
||||
if (show_self_reviews) {
|
||||
col_tr += '<div id="review-' + row[2][0] + '-' + i + '"></div>'
|
||||
+ '<script>'
|
||||
+ '$(function() {'
|
||||
+ '(function() {'
|
||||
+ 'var purify_result = DOMPurify.sanitize(decodeURIComponent("' + encodeURIComponent(String(col[3] || '')) + '"), {ALLOWED_TAGS: ["a", "b", "i", "u", "em", "strong", "sub", "sup", "small", "del", "br"], ALLOWED_ATTR: ["href"]});'
|
||||
+ '$("#review-' + row[2][0] + '-' + i + '")'
|
||||
+ '.html(purify_result ? \'<div class="mt-2 pt-2 border-top">\' + purify_result + \'</div>\' : \'\'); });'
|
||||
+ '.html(purify_result ? \'<div class="mt-2 pt-2 border-top">\' + purify_result + \'</div>\' : \'\'); })();'
|
||||
+ '</scr' + 'ipt>';
|
||||
} else {
|
||||
if (standings_version < 2) {
|
||||
@ -1130,8 +1130,8 @@ function showStandings() {
|
||||
if (show_self_reviews) {
|
||||
col_tr += '<td><div id="review-' + row[2][0] + '"></div>'
|
||||
+ '<script>'
|
||||
+ '$(function() { $("#review-' + row[2][0] + '")'
|
||||
+ '.html(DOMPurify.sanitize(decodeURIComponent("' + encodeURIComponent(String(row[4] || '')) + '"), {ALLOWED_TAGS: ["a", "b", "i", "u", "em", "strong", "sub", "sup", "small", "del", "br"], ALLOWED_ATTR: ["href"]})); });'
|
||||
+ '(function() { $("#review-' + row[2][0] + '")'
|
||||
+ '.html(DOMPurify.sanitize(decodeURIComponent("' + encodeURIComponent(String(row[4] || '')) + '"), {ALLOWED_TAGS: ["a", "b", "i", "u", "em", "strong", "sub", "sup", "small", "del", "br"], ALLOWED_ATTR: ["href"]})); })();'
|
||||
+ '</scr' + 'ipt></td>';
|
||||
}
|
||||
col_tr += '</tr>';
|
||||
@ -1140,7 +1140,7 @@ function showStandings() {
|
||||
table_classes: ['table', 'table-bordered', 'table-striped', 'table-text-center', 'table-vertical-middle', 'table-condensed'],
|
||||
page_len: 100,
|
||||
print_after_table: function() {
|
||||
return '<div class="text-right text-muted">' + uojLocale("contests::n participants", standings.length) + '</div>';
|
||||
return '<div class="text-right text-muted">' + uojLocale("contests::n participants", standings.length) + '</div><script>if (window.MathJax) window.MathJax.typeset();</scr' + 'ipt>';
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user