-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontests.html
More file actions
365 lines (330 loc) · 13.3 KB
/
Copy pathcontests.html
File metadata and controls
365 lines (330 loc) · 13.3 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>比赛汇总 - XCPC-Math-Finder</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<style>
body {
margin: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f4f7f6; /* 兜底背景色 */
color: #333;
scroll-behavior: smooth;
min-height: 100vh;
position: relative;
}
/* 统一的自适应、居中、降低亮度的全屏背景图 */
body::before {
content: "";
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('BG.png');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
filter: brightness(0.75); /* 降低亮度至 75% */
z-index: -1;
}
/* 顶端栏样式,与主页严格保持同步 */
header {
width: 100%;
background-color: #f39c12; /* 橙黄底 */
color: white; /* 白字 */
padding: 10px 40px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
position: fixed;
top: 0;
z-index: 1000;
}
.header-left { display: flex; align-items: baseline; gap: 15px; }
.header-left h1 { margin: 0; font-size: 1.8em; letter-spacing: 1px; }
.header-left .author { font-size: 1em; opacity: 0.9; }
.header-right-nav { display: flex; align-items: center; }
.back-btn {
background-color: rgba(255, 255, 255, 0.2);
color: white;
text-decoration: none;
padding: 8px 18px;
border-radius: 50px;
font-weight: bold;
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.4);
font-size: 0.9em;
display: flex;
align-items: center;
gap: 6px;
}
.back-btn:hover {
background-color: rgba(255, 255, 255, 0.35);
transform: scale(1.05);
}
/* 悬浮导航按钮毛玻璃化 */
.floating-nav { position: fixed; bottom: 40px; right: 40px; display: flex; flex-direction: column; gap: 15px; z-index: 1000; }
.btn-jump {
background-color: rgba(52, 152, 219, 0.8); /* 蓝色半透明 */
backdrop-filter: blur(5px);
color: white;
text-decoration: none;
padding: 12px 22px;
border-radius: 50px;
font-weight: bold;
box-shadow: 0 8px 20px rgba(0,0,0,0.15);
transition: all 0.3s;
text-align: center;
border: 1px solid rgba(255,255,255,0.2);
}
.btn-jump:hover {
background-color: rgba(41, 128, 185, 0.95);
transform: translateY(-3px);
box-shadow: 0 12px 25px rgba(0,0,0,0.25);
}
/* 已做按钮采用绿色半透明,与表格头部呼应 */
.btn-jump.btn-done {
background-color: rgba(39, 174, 96, 0.8);
}
.btn-jump.btn-done:hover {
background-color: rgba(30, 132, 73, 0.95);
}
/* 内容主容器调整 */
.container {
max-width: 1100px;
width: 100%;
margin: 90px auto 0 auto;
padding: 20px;
padding-bottom: 100px;
box-sizing: border-box;
}
.section-title {
margin-top: 40px;
margin-bottom: 12px;
color: #2c3e50;
display: flex;
align-items: center;
gap: 10px;
font-size: 1.5em;
text-shadow: 0 1px 2px rgba(255,255,255,0.6);
}
.section-divider { border: 0; height: 2px; background: linear-gradient(to right, #f39c12, transparent); margin-bottom: 25px; }
/* 表格组件重构:半透明毛玻璃 + 高级投影阴影 */
table {
width: 100%;
border-collapse: collapse;
background-color: rgba(255, 255, 255, 0.65); /* 半透明图层 */
backdrop-filter: blur(10px); /* 强力毛玻璃 */
box-shadow: 0 10px 25px rgba(0,0,0,0.06);
border-radius: 12px;
overflow: hidden;
margin-bottom: 40px;
border: 1px solid rgba(255, 255, 255, 0.4);
}
th, td { padding: 15px; text-align: left; border-bottom: 1px solid rgba(238, 238, 238, 0.4); }
/* 表格头部适当调高不透明度以压住复杂背景 */
th { background-color: rgba(52, 73, 94, 0.9); color: white; font-weight: 600; }
#done-table th { background-color: rgba(39, 174, 96, 0.9); }
td { color: #2c3e50; font-weight: 500; }
tr:hover { background-color: rgba(255, 255, 255, 0.4); }
a.link-btn { color: #2980b9; text-decoration: none; font-weight: bold; }
a.link-btn:hover { text-decoration: underline; color: #1f618d; }
input[type="checkbox"] { transform: scale(1.4); cursor: pointer; }
/* 平台专属徽章优化 */
.badge { padding: 5px 10px; border-radius: 5px; font-size: 0.85em; font-weight: bold; color: white; display: inline-block; text-align: center; min-width: 85px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.badge-cf { background-color: #2980b9; }
.badge-qoj { background-color: #e67e22; }
.badge-default { background-color: #7f8c8d; }
@media (max-width: 768px) {
/* 1. 顶端导航栏:压缩边距,缩小字号 */
header {
padding: 10px 15px;
}
.header-left h1 {
font-size: 1.2em;
}
.header-left .author {
display: none; /* 手机端空间有限,隐藏副标题/作者,保持头部干净 */
}
.header-right {
font-size: 1.2em;
gap: 15px;
}
.back-btn {
padding: 6px 12px;
font-size: 0.8em;
}
/* 2. 主页/公共头部布局:转为纵向排列 */
.sub-header {
margin-top: 70px;
flex-direction: column;
text-align: center;
gap: 10px;
}
.sub-header h2 {
font-size: 1.5em;
}
/* 3. 主页卡片网格:降维至单列 */
.main-grid {
grid-template-columns: 1fr;
gap: 30px;
}
.nav-card {
width: 100%;
height: 160px; /* 稍微压低卡片高度 */
font-size: 1.3em;
}
.capsule-group {
height: auto;
flex-direction: row; /* 数据气泡改为横向并排 */
justify-content: center;
gap: 10px;
margin-bottom: -10px;
}
/* 4. 搜索框工具栏:占满屏幕宽度 */
.search-box {
width: 100%;
}
/* 5. 数据表格降级方案:启用内部横向滚动 */
.container {
padding-left: 10px;
padding-right: 10px;
margin-top: 70px; /* 防止被顶栏遮挡 */
}
/* 将表格外层容器(如果需要)或表格本身设为块级并允许横向滚动 */
table {
display: block;
overflow-x: auto;
white-space: nowrap; /* 强制内容不换行,保障表格结构 */
-webkit-overflow-scrolling: touch; /* 提升 iOS 上的滚动顺滑度 */
}
th, td {
padding: 12px 10px;
}
/* 6. 右下角悬浮按钮:缩小并靠边,防止挡住底层表格内容 */
.floating-nav {
bottom: 20px;
right: 15px;
gap: 10px;
}
.btn-jump {
padding: 8px 16px;
font-size: 0.85em;
}
}
</style>
</head>
<body>
<header>
<div class="header-left">
<h1>XCPC-Math-Finder</h1>
<span class="author">📚 近年真题汇总</span>
</div>
<div class="header-right-nav">
<a href="index.html" class="back-btn"><i class="fa-solid fa-house"></i> 返回主页</a>
</div>
</header>
<div class="floating-nav">
<a href="#todo-section" class="btn-jump">📌 未做 (<span id="todo-count">0</span>)</a>
<a href="#done-section" class="btn-jump btn-done">✅ 已做 (<span id="done-count">0</span>)</a>
</div>
<div class="container">
<h2 id="todo-section" class="section-title">📌 未做比赛</h2>
<hr class="section-divider">
<table>
<thead>
<tr>
<th width="60px">状态</th>
<th width="100px">平台</th>
<th>比赛名称</th>
<th width="120px">操作</th>
</tr>
</thead>
<tbody id="todo-list"></tbody>
</table>
<h2 id="done-section" class="section-title">✅ 已做归档</h2>
<hr class="section-divider">
<table id="done-table">
<thead>
<tr>
<th width="60px">状态</th>
<th width="100px">平台</th>
<th>比赛名称</th>
<th width="120px">操作</th>
</tr>
</thead>
<tbody id="done-list"></tbody>
</table>
</div>
<script>
let globalData = [];
function getBadgeHtml(platform) {
if (platform === 'Codeforces') return '<span class="badge badge-cf">Codeforces</span>';
if (platform === 'QOJ') return '<span class="badge badge-qoj">QOJ</span>';
return `<span class="badge badge-default">${platform}</span>`;
}
function renderTables() {
const doneMap = JSON.parse(localStorage.getItem('xcpc_done_records')) || {};
const todoBody = document.getElementById('todo-list');
const doneBody = document.getElementById('done-list');
todoBody.innerHTML = ''; doneBody.innerHTML = '';
let todoCount = 0; let doneCount = 0;
// 严格保留逻辑:过滤 duration 脏数据,按时间戳降序排列
let processedData = globalData
.filter(contest => contest.duration !== -1)
.sort((a, b) => {
let timeA = a.timestamp || 0;
let timeB = b.timestamp || 0;
return timeB - timeA;
});
processedData.forEach(contest => {
const isDone = doneMap[contest.id] || false;
const tr = document.createElement('tr');
tr.innerHTML = `
<td>
<input type="checkbox" ${isDone ? 'checked' : ''} onchange="toggleDone('${contest.id}', ${isDone})">
</td>
<td>${getBadgeHtml(contest.platform)}</td>
<td>${contest.name}</td>
<td><a href="${contest.url}" target="_blank" class="link-btn">跳转链接 🚀</a></td>
`;
if (isDone) {
doneBody.appendChild(tr);
doneCount++;
} else {
todoBody.appendChild(tr);
todoCount++;
}
});
document.getElementById('todo-count').innerText = todoCount;
document.getElementById('done-count').innerText = doneCount;
}
function toggleDone(contestId, currentState) {
let message = currentState
? "确认要撤销归档,将其重新放回【未做】列表吗?"
: "🎉 确定已经完成这场比赛,将其归档吗?";
if (confirm(message)) {
const doneMap = JSON.parse(localStorage.getItem('xcpc_done_records')) || {};
doneMap[contestId] = !currentState;
localStorage.setItem('xcpc_done_records', JSON.stringify(doneMap));
}
renderTables();
}
fetch('recent_xcpc_contests.json')
.then(response => response.json())
.then(data => {
globalData = data;
renderTables();
})
.catch(error => {
console.error('读取数据失败:', error);
document.getElementById('todo-list').innerHTML = '<tr><td colspan="4" style="text-align:center; color:red;">数据加载失败,请确保使用 Live Server 运行。</td></tr>';
});
</script>
</body>
</html>