Skip to content

Commit d9a5c4a

Browse files
committed
fix anim
optimize code
1 parent ca57f3f commit d9a5c4a

File tree

7 files changed

+120
-66
lines changed

7 files changed

+120
-66
lines changed

css/cover.css

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,24 @@
1313

1414
padding: 1rem;
1515

16-
animation: splash 2s forwards;
16+
animation: whiteSplash 2.5s forwards;
1717
text-align: center;
1818

1919
color: #333;
2020
background: #fff fixed center url(https://a.xuewuzhibu.cn/24/656d964db3c37-24.png) no-repeat;
2121
background-size: 40vw;
2222
}
2323

24-
@keyframes splash {
24+
@keyframes whiteSplash {
2525
0% {
26-
display: flex;
27-
2826
filter: brightness(10);
2927
}
3028

31-
40% {
29+
50% {
3230
filter: brightness(1);
3331
}
3432

35-
80% {
33+
90% {
3634
opacity: 1;
3735
}
3836

@@ -56,8 +54,9 @@
5654
justify-content: space-between;
5755

5856
transition: .5s;
59-
/* background: #333 fixed center url(https://a.xuewuzhibu.cn/24/656ca7c42eb90-24.jpg); */
60-
/* background-size: cover; */
57+
58+
background: #333 fixed center url(https://a.xuewuzhibu.cn/24/656ca7c42eb90-24.jpg);
59+
background-size: cover;
6160
}
6261

6362
#cover>* {
@@ -161,4 +160,39 @@
161160

162161
background: #333 fixed center url(https://a.xuewuzhibu.cn/24/656ca7c42eb90-24.jpg);
163162
background-size: cover;
163+
}
164+
165+
#cover .loadingBar {
166+
position: relative;
167+
overflow: hidden;
168+
}
169+
170+
#cover .loadingBar::after {
171+
position: absolute;
172+
z-index: 1;
173+
top: 0;
174+
left: 0;
175+
176+
display: block;
177+
178+
width: 100%;
179+
height: 100%;
180+
181+
content: '';
182+
animation: loadingBarMask 1s ease-in-out infinite;
183+
184+
background: #fff;
185+
backdrop-filter: brightness(.6) contrast(3);
186+
187+
mix-blend-mode: exclusion;
188+
}
189+
190+
@keyframes loadingBarMask {
191+
0% {
192+
left: -100%;
193+
}
194+
195+
100% {
196+
left: 200%;
197+
}
164198
}

css/main.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ footer {
6666
/* 选中 */
6767
::selection {
6868
background: rgba(255, 255, 255, .1);
69-
text-shadow: #fa7 -.05em -.01em .1em, #f7a .05em .01em .1em;
69+
text-shadow: #7af -.05em -.01em .1em, #a7f .05em .01em .1em;
7070
}
7171

7272
/*
@@ -108,7 +108,7 @@ footer {
108108

109109
@keyframes hilit {
110110
from {
111-
color: #fa7;
111+
color: #daf;
112112
}
113113

114114
to {
@@ -295,7 +295,7 @@ a {
295295

296296
a:hover {
297297
color: #fff !important;
298-
background: linear-gradient(120deg, #fa7, #f7a);
298+
background: linear-gradient(120deg, #7af, #a7f);
299299
box-shadow: .2em .2em .5em rgba(0, 0, 0, .2);
300300
}
301301

index.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
</div>
6161
<div class="space-between">
6262
<p>Tips: ?</p>
63-
<p>Loading...</p>
63+
<p class="loadingBar">Loading...</p>
6464
</div>
6565
</div>
6666

@@ -94,13 +94,13 @@ <h2 id="mainslogan">考试时钟</h2>
9494
</div>
9595
</a>
9696
<div id="typelist" style="width:100%;">
97-
<a onclick="subject.to(23)">23届</a>
98-
<a onclick="subject.to(24)">高三日常</a>
99-
<a onclick="subject.to(241)">高三理科</a>
100-
<a onclick="subject.to(242)">高三文科</a>
101-
<a onclick="subject.to(251)">高二物理</a>
102-
<a onclick="subject.to(252)">高二历史</a>
103-
<a onclick="subject.to(261)">高一</a>
97+
<a onclick="subject.switch(23)">23届</a>
98+
<a onclick="subject.switch(24)">高三日常</a>
99+
<a onclick="subject.switch(241)">高三理科</a>
100+
<a onclick="subject.switch(242)">高三文科</a>
101+
<a onclick="subject.switch(251)">高二物理</a>
102+
<a onclick="subject.switch(252)">高二历史</a>
103+
<a onclick="subject.switch(261)">高一</a>
104104
<a onclick="setTemp()"><i class="fa-regular fa-square-plus"></i> 临时</a>
105105
<a onclick="setTimer()"><i class="fa-solid fa-stopwatch"></i> 倒计时</a>
106106

@@ -227,7 +227,7 @@ <h2 id="mainslogan">考试时钟</h2>
227227
</p>
228228
<p><i class="fa-solid fa-hashtag"></i> 考试时钟相关疑问、需求或反馈请前往野生技协群:89 4656 456,多名管理在线回复</p>
229229
<p><i class="fa-solid fa-file-arrow-up"></i>
230-
ver_7.0.1 ys & φ</p>
230+
ver_7.0.2 优化部分源代码</p>
231231
</div>
232232
</footer>
233233
</div>

js/clock.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
// 这里可以修改today.date
66
// 测试结束后一定要删除测试数据
77
// 否则“今天”就是today.date
8-
var today = new Date;
8+
let today = new Date;
99

1010
today = {
1111
date: today.getFullYear() + "-" + fixDigit(today.getMonth() + 1) + "-" + fixDigit(today.getDate()),
1212
week: parseInt((today - new Date(2022, 1, 6)) / 6048E5),
1313
day: today.getDay(),
1414
weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][today.getDay()],
1515
// 夏季作息:5月1日~9月30日
16-
summer: today.getMonth() > 3 && today.getMonth() < 9,
16+
isSummer: today.getMonth() > 3 && today.getMonth() < 9
1717
};
18+
console.log(today);
19+
1820
// 各个对象内置功能
19-
var exam = {};
20-
var subject = {
21+
let subject = {
2122
get name() { return document.getElementById("subject").innerHTML; },
2223
set name(name) { document.getElementById("subject").innerHTML = name; },
2324
get duration() {
@@ -30,17 +31,18 @@ var subject = {
3031
// get _end() { },
3132
// set _end(end) { },
3233
};
33-
var slogan = {
34-
// 这块有机会再写
3534

35+
let exams = {};
3636

37+
let slogan = {
38+
// 这块有机会再写
3739
};
38-
var timer = {
39-
// 这块也一样,有机会再写
40-
4140

41+
let timer = {
42+
// 这块也一样,有机会再写
4243
};
43-
subject.to = function (to) {
44+
45+
subject.switch = function (type) {
4446
// 切换类型时需要重置的内容
4547
if (SP.debug) now = new Date(0);
4648
this.name = "";
@@ -49,9 +51,13 @@ subject.to = function (to) {
4951
timer.progress = slogan.main = slogan.sub = slogan.subnum = 0;
5052
slogan.$main = "沉着冷静&emsp;诚信考试";
5153
slogan.$sub = [""];
52-
this.on = to in exam ? to : this.on;
53-
document.getElementById("type").innerHTML = exam[this.on]();
54-
if (SP.debug == null) playCover("正在传送到坐标 <span class='shield'>?type=" + this.on + "</span>,请稍候");
54+
this.current = type in exams ? type : this.current;
55+
console.log(this.current);
56+
exams[this.current]();
57+
slogan.update();
58+
document.getElementById("type").innerHTML = subject.type;
59+
60+
if (SP.debug == null) playCover("正在传送到坐标 <span class='shield'>?type=" + this.current + "</span>,请稍候");
5561
// document.getElementsByClassName("card")[0].style.filter = "blur(.5em)";
5662
// 想提升应用启动速度,就把延迟改小点
5763
setTimeout(function () {
@@ -80,7 +86,7 @@ function setTimer(min) {
8086
subject.end = new Date(0);
8187
if (!(min = prompt("倒计时分钟数", 20)))
8288
return console.warn(send("由于操作取消,未生成临时科目。"));
83-
var end = new Date(now);
89+
let end = new Date(now);
8490
end.setMinutes(end.getMinutes() + +min);
8591
$("⏱️", today.date, fixDigit(now.getHours()) + ":" + fixDigit(now.getMinutes()), fixDigit(end.getHours()) + ":" + fixDigit(end.getMinutes()));
8692
console.log(send("添加了一个 " + today.date + " 从 " + getClock(subject.start) + " 到 " + getClock(subject.end) + " 的倒计时"));
@@ -94,7 +100,7 @@ function setTimer(min) {
94100
@param toEnd 结束时间(格式为 hh:mm)
95101
@param toMainslogan 大标语
96102
@param toSubslogan 小标语
97-
@param toAdmit 提前入场分钟数,默认为exam对象中的$admit
103+
@param toAdmit 提前入场分钟数,默认为exams对象中的$admit
98104
*/
99105
function $(toSubject, toDate, toStart, toEnd, toMainslogan, toSubslogan, toAdmit) {
100106
if (now < subject.end) {
@@ -126,7 +132,7 @@ slogan.update = function () {
126132
timer.update = function () {
127133
document.getElementById("clock").innerHTML = getClock(now);
128134
if (now >= subject.end) {
129-
exam[subject.on]();
135+
exams[subject.current]();
130136
subject.duration = subject.duration;
131137
// document.getElementById("subject").innerHTML = subject.name;
132138
// document.getElementById("duration").innerHTML = subject.duration;

js/cover.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ function playCover(msg) {
55
// document.getElementById("covermsg").innerHTML = msg;
66
// eleCoverbar.style.width = "100%";
77
eleCover.style.display = "flex";
8-
setTimeout(function () { eleCover.style.opacity = ""; }, 0);
9-
setTimeout(function () { eleCover.style.opacity = "0"; }, 2000);
10-
setTimeout(function () { eleCover.style.display = ""; }, 2500);
8+
setTimeout(function () {
9+
eleCover.style.opacity = "";
10+
}, 0);
11+
setTimeout(function () {
12+
eleCover.style.opacity = "0";
13+
}, 2000);
14+
setTimeout(function () {
15+
eleCover.style.display = "";
16+
}, 2500);
1117
return msg;
1218
}

js/exam.js

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ console.groupEnd();
44
/*
55
* 适用于宝鸡中学的考试科目列表
66
*/
7-
today.gone22 = parseInt((Date.now() - new Date(2022, 5, 9)) / 864E5);
8-
today.cee24 = parseInt((new Date(2024, 5, 8) - Date.now()) / 864E5);
9-
exam["2022-05-14"] = function () {
10-
slogan.$main = today.cee22 + "天后 峰顶相会";
11-
$("晚修", today.date, "22:30", "23:30");
12-
return today.date + "临时";
7+
8+
let specialDate = {
9+
gone22: parseInt((Date.now() - new Date(2022, 5, 9)) / 864E5),
10+
cee24: parseInt((new Date(2024, 5, 8) - Date.now()) / 864E5),
11+
}
12+
13+
14+
exams["2022-05-14"] = {
15+
title: "临时考练",
16+
mainSlogan: `${specialDate.cee22}天后 峰顶相会`,
17+
schedule() {
18+
$("考练", today.date, "22:30", "23:30");
19+
}
1320
};
14-
exam[23] = function () {
21+
22+
exams[23] = function () {
23+
subject.type = "23届走了";
1524
slogan.$main = "留好照片 因为我们就要出发";
1625
slogan.$sub = [
1726
"1025天前,2020年8月13日,我拿到了录取通知书。",
@@ -35,10 +44,10 @@ exam[23] = function () {
3544
"今天是2023年6月4日,我们也即将要离开了。",
3645
"我和宝中的故事,未完待续。",
3746
];
38-
return "23届走了";
3947
}
40-
exam[24] = function () {
41-
slogan.$main = "距离高考" + today.cee24 + "天";
48+
exams[24] = function () {
49+
subject.type = "高三日常";
50+
slogan.$main = `距离高考${specialDate.cee24}天`;
4251
subject.$admit = 2;
4352
// 夏季作息时间,上午竟然要上五节课
4453
// 秋季作息时间竟然也是
@@ -51,7 +60,7 @@ exam[24] = function () {
5160
$("第3节", today.date, "09:50", "10:30");
5261
$("第4节", today.date, "10:40", "11:20");
5362
$("第5节", today.date, "11:30", "12:10");
54-
if (today.summer) {
63+
if (today.isSummer) {
5564
$("第6节", today.date, "14:25", "15:05", null, null, 5);
5665
$("第7节", today.date, "15:15", "15:55");
5766
$("第8节", today.date, "16:10", "16:50", null, null, 7);
@@ -71,29 +80,29 @@ exam[24] = function () {
7180
$("晚三", today.date, "20:40", "22:10", null, null, 7);
7281
$("晚修", today.date, "22:20", "23:30");
7382
}
74-
return "高三日常";
7583
}
76-
exam[241] = function () {
84+
exams[241] = function () {
85+
subject.type = "高三理科";
7786
slogan.$sub = ["高二第一学期期末暨模块结业考试(理科):请以实际铃声为准。"];
7887
$("数学", "2023-01-29", "14:00", "16:00");
7988
$("化学", "2023-01-29", "16:30", "18:10");
8089
$("语文", "2023-01-30", "07:40", "10:10");
8190
$("生物", "2023-01-30", "10:40", "12:20");
8291
$("英语", "2023-01-30", "14:00", "16:00");
8392
$("物理", "2023-01-30", "16:30", "18:00");
84-
return "高三理科";
8593
};
86-
exam[242] = function () {
94+
exams[242] = function () {
95+
subject.type = "高三文科";
8796
slogan.$sub = ["高二第一学期期末暨模块结业考试(文科):请以实际铃声为准。"];
8897
$("数学", "2023-01-29", "14:00", "16:00");
8998
$("历史", "2023-01-29", "16:30", "18:10");
9099
$("语文", "2023-01-30", "07:40", "10:10");
91100
$("地理", "2023-01-30", "10:40", "12:20");
92101
$("英语", "2023-01-30", "14:00", "16:00");
93102
$("政治", "2023-01-30", "16:30", "18:00");
94-
return "高三文科";
95103
};
96-
exam[251] = function () {
104+
exams[251] = function () {
105+
subject.type = "高二物理";
97106
slogan.$sub = ["高二第一学期期中考试:请以实际铃声为准。"];
98107
$("语文", "2023-11-10", "07:40", "10:10");
99108
$("化学", "2023-11-10", "10:40", "12:10");
@@ -103,9 +112,9 @@ exam[251] = function () {
103112
$("生物", "2023-11-11", "10:30", "12:00");
104113
$("物理", "2023-11-11", "14:00", "15:30");
105114
$("政治", "2023-11-11", "16:00", "17:30");
106-
return "高二物理";
107115
};
108-
exam[252] = function () {
116+
exams[252] = function () {
117+
subject.type = "高二历史";
109118
slogan.$sub = ["高二第一学期期中考试:请以实际铃声为准。"];
110119
$("语文", "2023-11-10", "07:40", "10:10");
111120
$("化学", "2023-11-10", "10:40", "12:10");
@@ -115,9 +124,9 @@ exam[252] = function () {
115124
$("生物", "2023-11-11", "10:30", "12:00");
116125
$("历史", "2023-11-11", "14:00", "15:30");
117126
$("政治", "2023-11-11", "16:00", "17:30");
118-
return "高二历史";
119127
};
120-
exam[261] = function () {
128+
exams[261] = function () {
129+
subject.type = "高一";
121130
slogan.$sub = ["高一第一学期期中考试:请以实际铃声为准。"];
122131
$("语文", "2023-11-10", "08:00", "10:00");
123132
$("生物", "2023-11-10", "10:30", "12:00");
@@ -127,5 +136,4 @@ exam[261] = function () {
127136
$("化学", "2023-11-11", "10:30", "12:00");
128137
$("物理", "2023-11-11", "14:00", "15:30");
129138
$("地理", "2023-11-11", "16:00", "17:00");
130-
return "高一";
131139
};

0 commit comments

Comments
 (0)