Browse Source

Auto fit problem title font size on submission page

pull/6/head
Menci 7 years ago
parent
commit
235e16e312
  1. 1
      views/submission.ejs
  2. 9
      views/submission_content.ejs
  3. 6
      views/submissions.ejs
  4. 9
      views/submissions_item.ejs

1
views/submission.ejs

@ -1,4 +1,5 @@
<% this.title = '提交记录 #' + judge.id %>
<% include header %>
<script src="https://cdn.staticfile.org/textfit/2.3.1/textFit.min.js"></script>
<span id="submission_content"><% include submission_content %></span>
<% include footer %>

9
views/submission_content.ejs

@ -29,7 +29,7 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
%>
<div class="padding">
<table class="ui very basic center aligned table" id="status_table">
<table class="ui very basic center aligned table" id="status_table" style="visibility: hidden; ">
<thead>
<tr>
<th>编号</th>
@ -46,7 +46,7 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
<tbody>
<tr>
<td>#<%= judge.id %></td>
<td><a href="<%= problemUrl %>">#<%= judge.problem_id %>. <%= judge.problem.title %></a></td>
<td><a style="width: 220px; height: 22px; display: block; margin: 0 auto; " id="text-fit" href="<%= problemUrl %>">#<%= judge.problem_id %>. <%= judge.problem.title %></a></td>
<% if (judge.allowedSeeResult) { %>
<td class="status <%= getStatusMeta(judge.result.status).toLowerCase().split(' ').join('_') %>">
<i class="<%= icon[getStatusMeta(judge.status)] || 'remove' %> icon"></i>
@ -72,6 +72,11 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
</tr>
</tbody>
</table>
<script>
var e = document.getElementById('text-fit');
textFit(e, { maxFontSize: 14 });
document.getElementById('status_table').style.visibility = '';
</script>
<% if (judge.allowedSeeCode) { %>
<div class="ui existing segment" style="position: relative; ">
<% if (judge.allowedRejudge) { %>

6
views/submissions.ejs

@ -1,4 +1,5 @@
<% this.title = '提交记录' %>
<script src="https://cdn.staticfile.org/textfit/2.3.1/textFit.min.js"></script>
<% include header %>
<% include util %>
<div class="padding">
@ -60,7 +61,7 @@
<% } %>
</div>
</form>
<table class="ui very basic center aligned table" style="white-space: nowrap; ">
<table class="ui very basic center aligned table" style="white-space: nowrap; visibility: hidden; " id="table">
<thead>
<tr>
<th>编号</th>
@ -80,6 +81,9 @@
<% } %>
</tbody>
</table>
<script>
document.getElementById('table').style.visibility = '';
</script>
<br>
<% include page %>
</div>

9
views/submissions_item.ejs

@ -5,7 +5,11 @@ if (typeof contest !== 'undefined' && contest) problemUrl = syzoj.utils.makeUrl(
else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
%>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>">#<%= judge.id %></a></td>
<td><a href="<%= problemUrl %>">#<%= judge.problem_id %>. <%= judge.problem.title %></a></td>
<td><a style="width: 220px; height: 22px; display: block; margin: 0 auto; " id="text-fit-<%= judge.id %>" href="<%= problemUrl %>">#<%= judge.problem_id %>. <%= judge.problem.title %></a></td>
<script>
var e = document.getElementById('text-fit-<%= judge.id %>');
textFit(e, { maxFontSize: 14 });
</script>
<% if (!judge.hidden) { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>">
<span class="status <%= getStatusMeta(judge.status).toLowerCase().split(' ').join('_') %>">
@ -29,7 +33,7 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
<td>隐藏</td>
<% } %>
<td><a href="<%= syzoj.utils.makeUrl(['user', judge.user_id]) %>"><%= judge.user.username %></a><% if (judge.user.nameplate) { %><%- judge.user.nameplate %><% } %></td>
<td><%= syzoj.utils.formatDate(judge.submit_time) %></td>
<td><%= syzoj.utils.formatDate(judge.submit_time) %>
<% if (isPending(judge.status)) { %>
<script>
function update_judge_<%= judge.id %>() {
@ -49,3 +53,4 @@ else url = syzoj.utils.makeUrl(['submissions', judge.id, 'ajax']);
update_judge_<%= judge.id %>();
</script>
<% } %>
</td>

Loading…
Cancel
Save