mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2024-09-21 08:23:20 +00:00
增加比赛排名页面的自动刷新
This commit is contained in:
parent
4529ce191c
commit
2334982f31
@ -416,4 +416,5 @@ def contest_rank_page(request, contest_id):
|
||||
|
||||
return render(request, "oj/contest/contest_rank.html",
|
||||
{"contest": contest, "contest_problems": contest_problems,
|
||||
"result": sorted(result, cmp=_cmp, reverse=True)})
|
||||
"result": sorted(result, cmp=_cmp, reverse=True),
|
||||
"auto_refresh": request.GET.get("auto_refresh", None) == "true"})
|
||||
|
@ -50,6 +50,7 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="checkbox" id="auto-refresh" {% if auto_refresh %}checked{% endif %} onchange="if(this.checked){location.href='?auto_refresh=true'}else{location.href=location.href.split('?')[0]}"> 自动刷新
|
||||
{% else %}
|
||||
<p>还没有结果</p>
|
||||
{% endif %}
|
||||
@ -60,4 +61,11 @@
|
||||
|
||||
|
||||
{% block js_block %}
|
||||
{% if auto_refresh %}
|
||||
<script>
|
||||
setTimeout(function(){
|
||||
location.reload();
|
||||
}, 5000);
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user