mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-25 10:58:41 +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
|
<?php
|
||||||
requirePHPLib('form');
|
requirePHPLib('form');
|
||||||
|
|
||||||
|
$REQUIRE_LIB['mathjax'] = '';
|
||||||
|
|
||||||
if (!Auth::check()) {
|
if (!Auth::check()) {
|
||||||
become403Page(UOJLocale::get('need login'));
|
become403Page(UOJLocale::get('need login'));
|
||||||
}
|
}
|
||||||
|
@ -1109,10 +1109,10 @@ function showStandings() {
|
|||||||
if (show_self_reviews) {
|
if (show_self_reviews) {
|
||||||
col_tr += '<div id="review-' + row[2][0] + '-' + i + '"></div>'
|
col_tr += '<div id="review-' + row[2][0] + '-' + i + '"></div>'
|
||||||
+ '<script>'
|
+ '<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"]});'
|
+ '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 + '")'
|
+ '$("#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>';
|
+ '</scr' + 'ipt>';
|
||||||
} else {
|
} else {
|
||||||
if (standings_version < 2) {
|
if (standings_version < 2) {
|
||||||
@ -1130,8 +1130,8 @@ function showStandings() {
|
|||||||
if (show_self_reviews) {
|
if (show_self_reviews) {
|
||||||
col_tr += '<td><div id="review-' + row[2][0] + '"></div>'
|
col_tr += '<td><div id="review-' + row[2][0] + '"></div>'
|
||||||
+ '<script>'
|
+ '<script>'
|
||||||
+ '$(function() { $("#review-' + row[2][0] + '")'
|
+ '(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"]})); });'
|
+ '.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>';
|
+ '</scr' + 'ipt></td>';
|
||||||
}
|
}
|
||||||
col_tr += '</tr>';
|
col_tr += '</tr>';
|
||||||
@ -1140,7 +1140,7 @@ function showStandings() {
|
|||||||
table_classes: ['table', 'table-bordered', 'table-striped', 'table-text-center', 'table-vertical-middle', 'table-condensed'],
|
table_classes: ['table', 'table-bordered', 'table-striped', 'table-text-center', 'table-vertical-middle', 'table-condensed'],
|
||||||
page_len: 100,
|
page_len: 100,
|
||||||
print_after_table: function() {
|
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