-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
106 lines (89 loc) · 3.01 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
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="https://iaziz786.com/favicon.svg">
<link rel="icon" type="image/png" sizes="16x16" href="https://iaziz786.com/favicon.svg">
<link rel="icon" type="image/png" sizes="32x32" href="https://iaziz786.com/favicon.svg">
<link rel="apple-touch-icon" href="https://iaziz786.com/favicon.svg">
<link rel="mask-icon" href="https://iaziz786.com/favicon.svg">
<title>Time is limited.</title>
<style>
body,
html {
height: 100%;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
background: #E25E3E;
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
;
}
.progress-container {
width: 400px;
height: 50px;
background: #FFBB5C;
margin: 20px 0;
border: 5px solid black;
border-radius: 5px;
position: relative;
}
.progress-bar {
height: 100%;
background: #C63D2F;
position: absolute;
left: 0;
top: 0;
}
.progress-text {
font-size: 20px;
margin-bottom: 5px;
color: #FFF5E0;
text-align: center;
}
.progress-main {
margin: 15px;
}
</style>
</head>
<body>
<div class="progress-main">
<h1 class="progress-text">Time is limited.</h1>
<div class="progress-text" id="yearText"></div>
<div class="progress-container">
<div class="progress-bar" id="yearProgress"></div>
</div>
<div class="progress-text" id="dayText"></div>
<div class="progress-container">
<div class="progress-bar" id="dayProgress"></div>
</div>
</div>
<script>
const calculateProgress = (start, end, current) => {
const totalDuration = end - start;
const elapsed = current - start;
return (elapsed / totalDuration) * 100;
};
const updateProgress = () => {
const now = new Date();
const yearStart = new Date(now.getFullYear(), 0, 1);
const yearEnd = new Date(now.getFullYear() + 1, 0, 1);
const dayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const dayEnd = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1);
const yearProgress = calculateProgress(yearStart, yearEnd, now);
const dayProgress = calculateProgress(dayStart, dayEnd, now);
// Update year progress
document.getElementById('yearText').innerText = `Year Progress: ${yearProgress.toFixed(6)}%`;
document.getElementById('yearProgress').style.width = `${yearProgress}%`;
// Update day progress
document.getElementById('dayText').innerText = `Day Progress: ${dayProgress.toFixed(4)}%`;
document.getElementById('dayProgress').style.width = `${dayProgress}%`;
// Request the next frame
requestAnimationFrame(updateProgress);
};
// Initial update and set up continuous updates
updateProgress();
</script>
</body>
</html>