Skip to content

Commit 63b7f0e

Browse files
Added Day 43
1 parent 497cdb8 commit 63b7f0e

1 file changed

Lines changed: 112 additions & 0 deletions

File tree

public/43/index.html

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="icon" href="/assets/icon.png" />
7+
<title>Day 43/100</title>
8+
</head>
9+
<body>
10+
<main>
11+
<div class="progress-bar" id="progress-bar"></div>
12+
<div class="progress-text" id="progress-text">0%</div>
13+
</main>
14+
15+
<style>
16+
@font-face {
17+
font-family: "SpaceMono";
18+
src: url("/assets/SpaceMono-Bold.woff2") format("woff2");
19+
font-weight: 700;
20+
}
21+
22+
body {
23+
margin: 0;
24+
overflow: hidden;
25+
display: flex;
26+
justify-content: center;
27+
align-items: center;
28+
width: 100vw;
29+
height: 100vh;
30+
background-color: #000;
31+
}
32+
33+
main {
34+
width: 100vw;
35+
max-width: 300px;
36+
height: 100vh;
37+
display: flex;
38+
flex-direction: column;
39+
align-items: center;
40+
justify-content: center;
41+
}
42+
43+
.progress-bar {
44+
padding-left: 20px;
45+
padding-right: 20px;
46+
display: flex;
47+
align-items: center;
48+
gap: 5px;
49+
}
50+
51+
.progress-bar-digit,
52+
.progress-text {
53+
color: #fff;
54+
font-size: min(max(4vw, 16px), 48px);
55+
font-family: "SpaceMono", monospace;
56+
font-weight: 700;
57+
}
58+
</style>
59+
60+
<script>
61+
const progressBar = document.getElementById("progress-bar");
62+
const string = "UPLOAD_COMPLETED";
63+
for (let i = 0; i < string.length; i++) {
64+
const progressBarItem = document.createElement("div");
65+
progressBarItem.classList.add("progress-bar-digit");
66+
progressBarItem.id = `progress-bar-digit-${i + 1}`;
67+
progressBarItem.setAttribute("data-value", string[i]);
68+
progressBarItem.textContent = string[i];
69+
progressBar.appendChild(progressBarItem);
70+
}
71+
72+
var progress = 0;
73+
let interval = setInterval(() => {
74+
progress++;
75+
document.getElementById("progress-text").textContent = `${Math.round(
76+
progress * (100 / string.length)
77+
)}%`;
78+
if (progress >= string.length) {
79+
clearInterval(interval);
80+
}
81+
}, 400);
82+
83+
let interval2;
84+
85+
function getRandomDigit() {
86+
let letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ-?!";
87+
let digit = letters[Math.floor(Math.random() * letters.length)];
88+
return digit;
89+
}
90+
91+
function startFlicker() {
92+
interval2 = setInterval(() => {
93+
for (let i = 0; i < string.length; i++) {
94+
if (i > progress) {
95+
document.getElementById(
96+
`progress-bar-digit-${i + 1}`
97+
).textContent = getRandomDigit();
98+
} else {
99+
document.getElementById(
100+
`progress-bar-digit-${i + 1}`
101+
).textContent = document
102+
.getElementById(`progress-bar-digit-${i + 1}`)
103+
.getAttribute("data-value");
104+
}
105+
}
106+
}, 50);
107+
}
108+
109+
startFlicker();
110+
</script>
111+
</body>
112+
</html>

0 commit comments

Comments
 (0)