-
Notifications
You must be signed in to change notification settings - Fork 0
/
accounts.html
119 lines (116 loc) · 6.18 KB
/
accounts.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CF/AT 账号</title>
<link rel="stylesheet" type="text/css" href="/css/main.css">
<link rel="stylesheet" type="text/css" href="/css/codeforces.css">
<link rel="stylesheet" type="text/css" href="/css/atcoder.css">
<link rel="stylesheet" type="text/css" href="/css/contest.css">
<script language=javascript src="./script/main.js"></script>
<script language=javascript src="./script/codeforces.js"></script>
<script language=javascript src="./script/atcoder.js"></script>
<script language=javascript src="./script/contest.js"></script>
<script>
/* Initialize */
var only_cf = parseInt(getQueryVariable('only-cf'));
if (only_cf != 1) only_cf = 0;
var only_at = parseInt(getQueryVariable('only-at'));
if (only_at != 1) only_at = 0;
var only_rui_er = parseInt(getQueryVariable('only-rui_er'));
if (only_rui_er != 0) only_rui_er = 1;
var type = parseInt(getQueryVariable('type'));
if (type != 0) type = 1;
/* generating table */
var url = "accounts.json";
var request = new XMLHttpRequest();
request.open("get", url);
request.send(null);
request.onload = function () {
if (request.status == 200) {
var json = JSON.parse(request.responseText);
var html = `
<table class='data' border='1' style='width: 100%;'>
<caption>CF/AT 账号</caption>
<thead>
<tr>
<th style='width: 7%;'>OJ</th>
<th style='width: 10%;'>用户名</th>
<th style='width: 18%;'>组织</th>
<th style='width: 15%;'>rating</th>
<th style='width: 15%;'>最高 rating</th>
<th style='width: 8%;'>contribution</th>
<th style='width: 8%;'>rated 比赛</th>
<th style='width: 8%;'>provisional</th>
<th style='width: 11%;'>最后比赛</th>
</tr>
</thead>
<tbody>
`;
var to = json.length - 1;
var from = 0;
var shown = 0;
console.log("from", from, "to", to);
for (var x = from; x <= to; x++) {
if(only_cf == 1 && json[x]['oj'] != 'CodeForces') continue;
if(only_at == 1 && json[x]['oj'] != 'AtCoder') continue;
if(only_rui_er == 1 && json[x]['username'].search("rui_er") == -1) continue;
console.log(x, json[x]);
if(json[x]['oj'] == 'CodeForces') {
html += `
<tr>
<td>${json[x]['oj']}</td>
<td><a href="https://www.codeforces.com/profile/${json[x]['username']}">${getCFUser2(getCFLevel(true, json[x]['rating']), json[x]['rating'], json[x]['username'], type)}</a></td>
<td>${json[x]['affiliation']}</td>
<td>${getCFUser(getCFLevel(true, json[x]['rating']), json[x]['rating'], type)}</td>
<td>${getCFUser(getCFLevel(true, json[x]['max-rating']), json[x]['max-rating'], type)}</td>
<td>${getCFDelta(json[x]['contribution'])}</td>
<td>${json[x]['rated-matches']}</td>
<td>${showNA()}</td>
<td>${json[x]['last-competed']}</td>
</tr>
`;
}
else {
html += `
<tr>
<td>${json[x]['oj']}</td>
<td><a href="https://atcoder.jp/users/rui_er">${getATUser2(getATLevel(true, json[x]['rating']), json[x]['username'])}</a></td>
<td>${json[x]['affiliation']}</td>
<td>${getATUser(getATLevel(true, json[x]['rating']), json[x]['rating'])}</td>
<td>${getATUser(getATLevel(true, json[x]['max-rating']), json[x]['max-rating'])}</td>
<td>${showNA()}</td>
<td>${json[x]['rated-matches']}</td>
<td>${getATProvisional(json[x]['provisional'])}</td>
<td>${json[x]['last-competed']}</td>
</tr>
`;
}
shown += 1;
}
html += `
</tbody>
</table>
`;
document.getElementById("record-table").innerHTML = html;
document.getElementById("details").innerHTML = `
<p>总记录数:<strong>${to - from + 1}</strong></p>
<p>已显示记录数:<strong>${shown}</strong></p>
<p>可以使用 ?only-cf(0/1, default: 0)、?only-at(0/1, default: 0)、?only-rui_er(0/1, default: 1) 来限制页面显示范围。</p>
<p>默认使用改进版颜色(1000~1199N、IM、IGM 的显示不同),若希望显示 CF 原来的颜色,请加上 ?type=0。</p>
<a class="btn" href="/">主页</a> | <a class="btn" href="/accounts.html">CF/AT 账号</a> | <a class="btn" href="/contests.html">CF/AT 比赛</a> | <a class="btn" href="https://www.cnblogs.com/ruierqwq/p/cf-1900-to-2400-at-1600-to-2399.html" target="_blank">CF 1900~2400 | AT 1600~2399 做题笔记</a>
`;
}
}
</script>
</head>
<body>
<div class="main">
<fieldset class="container">
<legend>CF/AT 账号</legend>
<div id="details">数据生成中……</div>
<div id="record-table">表格生成中……</div>
</fieldset>
</div>
</body>
</html>