Files
hustoj/web/template/sidebar/discuss.php

62 lines
1.7 KiB
PHP

<?php $show_title="$MSG_BBS - $OJ_NAME"; ?>
<?php
$view_discuss=ob_get_contents();
ob_end_clean();
require_once(dirname(__FILE__)."/../../lang/$OJ_LANG.php");
?>
<?php include("template/$OJ_TEMPLATE/header.php");?>
<?php include("include/bbcode.php");?>
<script src="include/vditor-adapter.js"></script>
<div class="padding">
<h1><?php echo $news_title ?></h1>
<div class="ui existing segment">
<?php echo $view_discuss?>
</div>
</div>
<script>
function addMarkdownInputOutputLabels() {
for(let i=1;i<10;i++){
$(".language-input"+i).parent().each(function(){
if ($(this).prev('.hustoj-md-io-label').length === 0) {
$(this).before("<div class='hustoj-md-io-label'><?php echo $MSG_Input?>"+i+":</div>");
}
});
$(".language-output"+i).parent().each(function(){
if ($(this).prev('.hustoj-md-io-label').length === 0) {
$(this).before("<div class='hustoj-md-io-label'><?php echo $MSG_Output?>"+i+":</div>");
}
});
}
}
function styleMarkdownTables() {
$(".md table tr td").css({
"border": "1px solid grey",
"text-align": "center",
"width": "200px",
"height": "30px"
});
$(".md table th").css({
"border": "1px solid grey",
"width": "200px",
"height": "30px",
"background-color": "#9e9e9ea1",
"text-align": "center"
});
}
$(document).ready(function(){
HustOJVditor.renderMarkdownBlocks('.md', {
useTextContent: true
}).then(function () {
addMarkdownInputOutputLabels();
styleMarkdownTables();
}).catch(function (error) {
console.error('Failed to render discuss markdown.', error);
});
});
</script>
<?php include("template/$OJ_TEMPLATE/footer.php");?>