Skip to content

Commit

Permalink
fixing common problems
Browse files Browse the repository at this point in the history
  • Loading branch information
zhblue committed Sep 19, 2024
1 parent ef9335a commit 3d1c519
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 26 deletions.
22 changes: 13 additions & 9 deletions trunk/web/template/bs3/auto_refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,20 @@ function fresh_result(solution_id) {
//console.log(ra[0]);
switch (ra[0]) {
case 4:
if(user_id==ra[5]) fancy(row.cells[4]);
case 14:
row.cells[4].innerHTML += "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+"</a>";
if(user_id==ra[5]){
fancy(row.cells[4]);
row.cells[4].innerHTML += "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+"</a>";
}else{
row.cells[4].innerHTML = "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+"</a>";
}
break;
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
row.cells[4].innerHTML = "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+" :"+(oj_mark=='percent'?100-ra[4].trim():ra[4].trim())+"%</a>";
break;
case 11:
Expand All @@ -97,7 +101,7 @@ function fresh_result(solution_id) {
default:
// row.cells[4].innerHTML = "<span class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+" AC:"+ra[4].trim()+"%</span>";
}

$(row.cells[4].children[0]).attr("result",ra[0]);
auto_refresh();
}
}
Expand Down
11 changes: 7 additions & 4 deletions trunk/web/template/sidebar/auto_refresh.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ function fresh_result(solution_id) {
//console.log(ra[0]);
switch (ra[0]) {
case 4:
if(user_id==ra[5]) fancy(row.cells[4]);
//break;
case 14:
row.cells[4].innerHTML += "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+"</a>";
if(user_id==ra[5]){
fancy(row.cells[4]);
row.cells[4].innerHTML += "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+"</a>";
}else{
row.cells[4].innerHTML = "<a href=reinfo.php?sid="+solution_id+" class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+"</a>";
}
break;
case 5:
case 6:
Expand All @@ -98,7 +101,7 @@ function fresh_result(solution_id) {
default:
// row.cells[4].innerHTML = "<span class='"+judge_color[ra[0]]+"'>"+judge_result[ra[0]]+" AC:"+ra[4].trim()+"%</span>";
}

$(row.cells[4].children[0]).attr("result",ra[0]);
auto_refresh();
}
}
Expand Down
11 changes: 6 additions & 5 deletions trunk/web/template/sidebar/js.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<script src="<?php echo $OJ_CDN_URL.$path_fix."template/bs3/"?>bootstrap.min.js"></script>
<script>
$(document).ready(function(){
var msg="<marquee style='margin-top:10px;margin-bottom:10px' id=broadcast direction='left' scrollamount=3 scrolldelay=50 onMouseOver='this.stop()'"+
var msg="<marquee style='margin-top:-10px;margin-bottom:10px' id=broadcast direction='left' scrollamount=3 scrolldelay=50 onMouseOver='this.stop()'"+
" onMouseOut='this.start()' class='padding' >"+<?php echo json_encode($view_marquee_msg); ?>+"</marquee>";
<?php if ($view_marquee_msg!="") { ?>
$("#main").prepend(msg);
Expand All @@ -33,16 +33,17 @@
$("#csrf").load("<?php echo $path_fix?>csrf.php");
let left=window.innerWidth-parseInt($("#menu").css("width")) - 100;
left/=2;
/*
$("#menu").attr("style","margin-left:auto;margin-right:auto;");
var screen_width = window.screen.width;
var screen_height = window.screen.height;
if(screen_width < 800) $("#main").attr("class","");
if(screen_width < 800) $("#MainBg-C").attr("class","");
*/
$("#rankdiv").click();

<?php if(isset($OJ_BG)&&$OJ_BG!="") echo " $('body').css('background','url($OJ_BG)').css('background-repeat','no-repeat').css('background-size','100%'); " ?>


$("tr").mouseover(function(){$(this).addClass("active")});
$("tr").mouseout(function(){$(this).removeClass("active")})

});

$(".hint pre").each(function(){
Expand Down
3 changes: 2 additions & 1 deletion trunk/web/template/sidebar/problem.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,12 @@ function selectMulti( num, answer){
mangle: false,
headerIds: false
});
const md = window.markdownit();

$(".md").each(function(){
<?php if ($OJ_MARKDOWN && $OJ_MARKDOWN=="marked.js") {?>
$(this).html(marked.parse($(this).html()));
<?php }else if ($OJ_MARKDOWN && $OJ_MARKDOWN=="markdown-it") {?>
const md = window.markdownit();
$(this).html(md.render($(this).text()));
<?php } ?>
});
Expand Down
2 changes: 1 addition & 1 deletion trunk/web/template/sidebar/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@
var oj_mark='<?php echo $OJ_MARK ?>';
var user_id="<?php if (isset($_SESSION[$OJ_NAME."_user_id"]) && $OJ_FANCY_RESULT ) echo $_SESSION[$OJ_NAME."_user_id"]; ?>";
</script>
<script src="template/<?php echo $OJ_TEMPLATE?>/auto_refresh.js?v=0.520" ></script>
<script src="template/<?php echo $OJ_TEMPLATE?>/auto_refresh.js?v=0.521" ></script>

<?php include("template/$OJ_TEMPLATE/footer.php");
10 changes: 5 additions & 5 deletions trunk/web/template/sidebar/submitpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ function do_submit(){
<?php if($solution_name) { ?>document.getElementById("frmSolution").submit(); <?php } ?> //如果是指定文件名,则强制用文件post方式提交。
$.post("submit.php?ajax",$("#frmSolution").serialize(),function(data){fresh_result(data);});
$("#Submit").prop('disabled', true);
$("#TestRub").prop('disabled', true);
$("#TestRun").prop('disabled', true);
count=<?php echo $OJ_SUBMIT_COOLDOWN_TIME?> * 2 ;
handler_interval= window.setTimeout("resume();",1000);
<?php if(isset($OJ_REMOTE_JUDGE)&&$OJ_REMOTE_JUDGE) {?>$("#sk").attr("src","remote.php"); <?php } ?>
Expand Down Expand Up @@ -344,20 +344,20 @@ function do_test_run(){
//document.getElementById("frmSolution").submit();
$.post("submit.php?ajax",$("#frmSolution").serialize(),function(data){fresh_result(data);});
$("#Submit").prop('disabled', true);
$("#TestRub").prop('disabled', true);
$("#TestRun").prop('disabled', true);
problem_id.value=-problem_id.value;
count=<?php echo isset($OJ_SUBMIT_COOLDOWN_TIME)?$OJ_SUBMIT_COOLDOWN_TIME:5 ?> * 2 ;
handler_interval= window.setTimeout("resume();",1000);
}
function resume(){
count--;
var s=$("#Submit")[0];
var t=$("#TestRub")[0];
var t=$("#TestRun")[0];
if(count<0){
$("#Submit").attr("disabled",false);
$("#Submit").text("<?php echo $MSG_SUBMIT?>");
if(t!=null) $("#TestRub").attr("disabled",false);
if(t!=null) $("#TestRub").text("<?php echo $MSG_TR?>");
if(t!=null) $("#TestRun").attr("disabled",false);
if(t!=null) $("#TestRun").text("<?php echo $MSG_TR?>");
if( handler_interval) window.clearInterval( handler_interval);
if($("#vcode")!=null) $("#vcode").click();
}else{
Expand Down
2 changes: 1 addition & 1 deletion trunk/web/template/sidebar/userinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</table>
<div class="extra content">
<a><i class="check icon"></i>通过 <?php echo $AC ?> 题</a>
<a style="float: right; "><i class="star icon"></i>排名 <?php echo $Rank ?></a>
<a style="float: right; "><i class="star icon <?php if($starred) echo "active"?>"></i>排名 <?php echo $Rank ?></a>

<?php if ($email != "") { ?>
<div style="margin-top:10px;margin-bottom:10px">
Expand Down

0 comments on commit 3d1c519

Please sign in to comment.