-
Notifications
You must be signed in to change notification settings - Fork 7
/
???.js
157 lines (150 loc) · 3.35 KB
/
???.js
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
// ==UserScript==
// @name ioihw2020 做题工具
// @namespace https://ioihw2020.duck-ac.cn
// @version 0.1
// @description 我啥时候也进个集训队啊
// @author memset0
// @match https://ioihw20.duck-ac.cn/
// @match https://ioihw20.duck-ac.cn/*
// @grant none
// ==/UserScript==
const colors = [
'black',
'green',
'yellow',
'red',
];
const userlist = [
"虞皓翔",
"马耀华",
"彭博",
"屠学畅",
"黄子宽",
"彭思进",
"胡昊",
"邓明扬",
"周欣",
"陈雨昕",
"叶卓睿",
"<span style=\"font-weight: bold\"><span style=\"color: black\">魏</span><span style=\"color: red\">衍芃</span></span>",
"林昊翰",
"李白天",
"代晨昕",
"张隽恺",
"徐哲安",
"郭城志",
"徐舟子",
"周镇东",
"张好风",
"袁浩天",
"魏辰轩",
"邱天异",
"张博为",
"陈峻宇",
"孙诺舟",
"蒋凌宇",
"潘佳奇",
"钱易",
"张庭川",
"丁晓漫",
"左骏驰",
"万天航",
"施良致",
"刘宇豪",
"李泽清",
"林立",
"戴傅聪",
"王泽远",
"陈胤戬",
"陆宏",
"吕秋实",
"欧阳宇鹏",
"张记僖",
"吴孟周",
"曹原",
"陈亮舟",
"卢宸昊",
"曾庆之",
"万成章",
"张景行",
"戴江齐",
"郑路明",
"周航锐",
"曹越",
"冯施源",
"罗恺",
"冷滟泽",
"杨珖",
"陶立宇",
"陈于思",
"王相文",
"孙嘉伟",
"孙若凡",
"宣毅鸣",
"谢濡键",
"孙从博",
"许庭强",
"周子衡",
"苏焜",
"管晏如",
"陈永志",
"蔡欣然",
"韩豫葳",
"张湫阳",
"丁其安",
"翁伟捷",
"吴家庆",
"潘逸飞",
"谢琳涵",
];
const db = {
load() {
return JSON.parse(localStorage.getItem('hw') || '[]');
},
dump(data) {
localStorage.setItem('hw', JSON.stringify(data || []));
},
update(pid, status) {
let data = db.load();
data[pid] = status;
db.dump(data);
},
query(pid) {
return db.load()[pid] || 0;
},
};
function render() {
$('*').each(function() {
if (this.innerHTML.match(/^ioi2021_[0-9]+$/g)) {
let uid = parseInt(this.innerHTML.match(/ioi2021_[0-9]+/g)[0].slice(8));
let name = userlist[uid];
if (name) {
console.log(uid, name);
this.innerHTML = '<span style="font-weight:normal">' + name + '</span>';
}
}
});
if (location.pathname.startsWith('/problems')) {
$(".table tr td:first-child").each(function () {
let pid = this.innerHTML.slice(1);
let status = db.query(pid);
this.style.color = colors[status];
if (status) {
this.style['font-weight'] = 'bold';
} else {
this.style['font-weight'] = 'normal';
}
console.log(pid, status);
});
}
}
if (location.pathname.startsWith('/problems')) {
$(".table tr td:first-child").click(function () {
let pid = this.innerHTML.slice(1);
let status = db.query(pid);
status = (status + 1) % colors.length;
db.update(pid, status);
render();
});
}
render();