-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsprint.html
167 lines (151 loc) · 6.55 KB
/
sprint.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
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
<!doctype html>
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="jquery-3.5.1.min.js"></script>
<script>
function getSprints()
{
var sprints = [
{"name":"CPP-并发-软考-QT", "end":"2023-03-31", "tips":"时间还可以挤一挤"},
{"name":"CPP-并发-实验", "end":"2023-02-28", "tips":"如何处理崩坏"},
{"name":"网络-并发-实验", "end":"2023-01-31", "tips":"珍惜每一秒钟"},
{"name":"网络-并发-实验-概率论", "end":"2022-12-31", "tips":"学东西前先搞明白框架,目的和意义"},
{"name":"操作系统-概率论", "end":"2022-11-30", "tips":"晚上刷数学题会比较催眠"},
{"name":"软考", "end":"2022-11-07", "tips":"论文花一周是可以搞定的"},
{"name":"软考", "end":"2022-11-07", "tips":"看完视频需要多刷题"}
];
return sprints;
}
function getBonus()
{
var bonus = [
{"date": "2023-2-26","task":{"早睡": 1,"早起": 1, "游戏":2, "家务":1, "锻炼":0},"explore":{"CPP":1}},
{"date": "2023-2-22","task":{"早睡": 1,"早起": 1, "游戏":2, "家务":1, "锻炼":0},"explore":{"CPP":1}},
{"date": "2023-2-21","task":{"早睡": 1,"早起": 1, "游戏":2, "家务":1, "锻炼":0},"explore":{"CPP":1}},
{"date": "2023-2-7","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":1, "锻炼":0},"explore":{"并发":1, "相亲":99}},
{"date": "2023-2-6","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":1, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-2-5","task":{"早睡": 0,"早起": 0, "游戏":0, "家务":2, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-2-4","task":{"早睡": 0,"早起": 0, "游戏":0, "家务":2, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-2-3","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":2, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-2-2","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":1, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-2-1","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":1, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-1-31","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":1, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-1-30","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":1, "锻炼":0},"explore":{"灯具":1}},
{"date": "2023-1-29","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":2, "锻炼":0},"explore":{"架子":1, "衣架":1, "加油快递":1}},
{"date": "2023-1-24","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":2, "锻炼":0},"explore":{"并发":1}},
{"date": "2023-1-17","task":{"早睡": 0,"早起": 0, "游戏":2, "家务":2, "锻炼":2},"explore":{}},
{"date": "2023-1-16","task":{"早睡": 1,"早起": 1, "游戏":2, "家务":2, "锻炼":2},"explore":{}}
];
return bonus;
}
function showTips()
{
var sprints = getSprints();
var rand = Math.floor(Math.random() * sprints.length);
var name = sprints[rand]["name"];
var tips = sprints[rand]["tips"];
document.getElementById("tips").innerHTML = name + ":" + tips;
}
function showSprint()
{
var sprints = getSprints();
var end = sprints[0]["end"];
var name = sprints[0]["name"];
name = "<a href=\"https://github.com/ChengangDev/focus/blob/main/sprint.html\">" + name + "</a>";
document.getElementById("name").innerHTML = name;
var one_day_time = 1000 * 3600 * 24;
var one_hour_time = 1000 * 3600;
var one_minute_time = 1000 * 60;
var today = new Date();
var endDay = new Date(end);
var timeDiff = endDay.getTime() - today.getTime();
if(timeDiff < 0)
timeDiff = 0;
var days = timeDiff / one_day_time;
timeDiff = timeDiff % one_day_time;
var hours = timeDiff / one_hour_time;
timeDiff = timeDiff % one_hour_time;
var minute = timeDiff / one_minute_time;
timeDiff = timeDiff % one_minute_time;
var second = timeDiff / 1000;
var text = parseInt(days) + "天"
+ String(parseInt(hours)).padStart(2, '0') + "时"
+ String(parseInt(minute)).padStart(2, '0') + "分"
+ String(parseInt(second)).padStart(2, '0') + "秒";
document.getElementById("time").innerHTML = text;
//alert(document.getElementById("time").innerHTML);
}
function showBonus()
{
var bonus = getBonus();
var today = new Date();
var yesterday = new Date();
var year = today.getFullYear();
var month = today.getMonth();
var days = today.getDate();
var task_bonus = 0;
var explore_bonus = 0;
var task_inc = 0;
var explore_inc = 0;
for(var i = 0; i < bonus.length; ++i)
{
var one = bonus[i];
var date = new Date(one["date"]);
if(date.getFullYear() != year)
{
console.log(JSON.stringify(one));
break;
}
var task = one["task"];
for(var key in task)
{
task_bonus = task_bonus + task[key];
if( date.getMonth() == month && date.getDate() == days )
task_inc = task_inc + task[key];
}
var explore = one["explore"];
for(var key in explore)
{
explore_bonus = explore_bonus + explore[key];
if( date.getMonth() == month && date.getDate() == days )
explore_inc = task_inc + explore[key];
}
}
document.getElementById("task").innerHTML = "task: " + String(task_inc) + " ↑" + String();
document.getElementById("explore").innerHTML = "explore: " + String(explore_inc) + " ↑" + String();
}
$(function(){
showSprint();
showTips();
showBonus();
setInterval(function(){showSprint()}, 1000);
setInterval(function(){showTips()}, 10000);
setInterval(function(){showBonus()}, 10000);
//alert("111");
});
</script>
<style>
</style>
</head>
<body>
<div style="text-align: center; padding: 80px">
<h1 id="time">14天</h1>
<h2 id="name">软考</h2>
<h4 id="task">task: 1 ↑ 1</h4>
<h4 id="explore">explore: 99 ↑ 1</h4>
<h6 id="tips"></h6>
</div>
<div style="text-align: center; padding: 1px">
<h7>DP</h7>
<h7>Keyboard</h7>
<h7>Kitchen</h7>
<h7>IKEA</h7>
<h7>Option</h7>
<h7>Option+Unreal</h7>
</div>
</body>
<footer>
</footer>
<html>