-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
97 lines (88 loc) · 3.49 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta property="og:type" content="website">
<meta property="og:url" content="https://teamolhuang.github.io/">
<meta property="og:title" content="雋曄放假計算機 | 您最值得信賴的雋曄放假計算小夥伴">
<meta property="og:description" content="要約柏德之門,但又不知道雋曄到底什麼時候放假了嗎?「雋曄放假計算機」是您最棒的助手。">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>雋曄放假計算機</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
background: linear-gradient(to right,
rgba(255, 0, 0, 0.3),
rgba(255, 165, 0, 0.3),
rgba(255, 255, 0, 0.3),
rgba(0, 128, 0, 0.3),
rgba(0, 0, 255, 0.3),
rgba(75, 0, 130, 0.3),
rgba(238, 130, 238, 0.3));
background-size: 200% 100%;
animation: flow 30s infinite linear;
font-family: Arial, sans-serif;
}
@keyframes flow {
0% {
background-position: 0% 50%;
}
100% {
background-position: 100% 50%;
}
}
h1 {
color: white;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
h3 {
color: white;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
countdown {
color: white;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body>
<div>
<h1>雋曄還有幾天放假 ??</h1><br/>
<h3><div class="countdown" id="countdown"></div></h3> <!-- Added div for displaying the countdown -->
</div>
<script>
function countdownToTargetDay() {
const targetStartDate = new Date('2024-09-15');
const targetIntervalDays = 5;
const now = new Date();
let nextTargetDate = targetStartDate;
// Find the next target day
while (nextTargetDate < now) {
nextTargetDate.setDate(nextTargetDate.getDate() + targetIntervalDays);
}
const timeDiff = nextTargetDate - now;
const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000);
const isHoliday = days >= (targetIntervalDays - 1);
if (!isHoliday)
document.getElementById('countdown').innerText = `快了,距離雋曄放假還有\n${days} 天, ${hours} 小時, ${minutes} 分, ${seconds} 秒`;
else {
document.body.style.backgroundColor = "#000000";
document.getElementById('countdown').innerText = `放假了啦!但是\n距離雋曄上班還剩下\n${hours} 小時, ${minutes} 分, ${seconds} 秒\n可憐阿`;
}
// Update countdown every second
setTimeout(countdownToTargetDay, 1000);
return isHoliday;
}
// Initial call to the function
countdownToTargetDay();
</script>
</body>
</html>