Browse Source

Auto fit problem title font size on submission page

master
Menci 8 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 %> <% this.title = '提交记录 #' + judge.id %>
<% include header %> <% include header %>
<script src="https://cdn.staticfile.org/textfit/2.3.1/textFit.min.js"></script>
<span id="submission_content"><% include submission_content %></span> <span id="submission_content"><% include submission_content %></span>
<% include footer %> <% include footer %>

9
views/submission_content.ejs

@ -29,7 +29,7 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
%> %>
<div class="padding"> <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> <thead>
<tr> <tr>
<th>编号</th> <th>编号</th>
@ -46,7 +46,7 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
<tbody> <tbody>
<tr> <tr>
<td>#<%= judge.id %></td> <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) { %> <% if (judge.allowedSeeResult) { %>
<td class="status <%= getStatusMeta(judge.result.status).toLowerCase().split(' ').join('_') %>"> <td class="status <%= getStatusMeta(judge.result.status).toLowerCase().split(' ').join('_') %>">
<i class="<%= icon[getStatusMeta(judge.status)] || 'remove' %> icon"></i> <i class="<%= icon[getStatusMeta(judge.status)] || 'remove' %> icon"></i>
@ -72,6 +72,11 @@ else problemUrl = syzoj.utils.makeUrl(['problem', judge.problem_id]);
</tr> </tr>
</tbody> </tbody>
</table> </table>
<script>
var e = document.getElementById('text-fit');
textFit(e, { maxFontSize: 14 });
document.getElementById('status_table').style.visibility = '';
</script>
<% if (judge.allowedSeeCode) { %> <% if (judge.allowedSeeCode) { %>
<div class="ui existing segment" style="position: relative; "> <div class="ui existing segment" style="position: relative; ">
<% if (judge.allowedRejudge) { %> <% if (judge.allowedRejudge) { %>

6
views/submissions.ejs

@ -1,4 +1,5 @@
<% this.title = '提交记录' %> <% this.title = '提交记录' %>
<script src="https://cdn.staticfile.org/textfit/2.3.1/textFit.min.js"></script>
<% include header %> <% include header %>
<% include util %> <% include util %>
<div class="padding"> <div class="padding">
@ -60,7 +61,7 @@
<% } %> <% } %>
</div> </div>
</form> </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> <thead>
<tr> <tr>
<th>编号</th> <th>编号</th>
@ -80,6 +81,9 @@
<% } %> <% } %>
</tbody> </tbody>
</table> </table>
<script>
document.getElementById('table').style.visibility = '';
</script>
<br> <br>
<% include page %> <% include page %>
</div> </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]); 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="<%= 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) { %> <% if (!judge.hidden) { %>
<td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>"> <td><a href="<%= syzoj.utils.makeUrl(['submission', judge.id]) %>">
<span class="status <%= getStatusMeta(judge.status).toLowerCase().split(' ').join('_') %>"> <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>隐藏</td>
<% } %> <% } %>
<td><a href="<%= syzoj.utils.makeUrl(['user', judge.user_id]) %>"><%= judge.user.username %></a><% if (judge.user.nameplate) { %><%- judge.user.nameplate %><% } %></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)) { %> <% if (isPending(judge.status)) { %>
<script> <script>
function update_judge_<%= judge.id %>() { function update_judge_<%= judge.id %>() {
@ -49,3 +53,4 @@ else url = syzoj.utils.makeUrl(['submissions', judge.id, 'ajax']);
update_judge_<%= judge.id %>(); update_judge_<%= judge.id %>();
</script> </script>
<% } %> <% } %>
</td>

Loading…
Cancel
Save