forked from redd-rl/countdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
174 lines (158 loc) · 7.16 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
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
168
169
170
171
172
173
174
<div onmouseover="playMusic()">
<body>
<style>
body {
background-color: black;
}
div {
width: 500px;
height: 100px;
background-color: black;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
#shadowBox {
display: flex;
justify-content: center;
align-items: center;
background-color: rgb(0, 0, 0);
/* Fallback color */
background-color: rgba(0, 0, 0, 0.2);
/* Black w/opacity/see-through */
border: 3px solid black;
}
.rainbow {
text-align: center;
text-decoration: underline;
font-size: 62px;
background-color: white;
font-family: monospace;
letter-spacing: 5px;
}
.rainbow_text_animated {
background: linear-gradient(to right, #6666ff, #0099ff , #00ff00, #ff3399, #6666ff);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
font-size: 202px;
animation: rainbow_animation 6s ease-in-out infinite;
background-size: 400% 100%;
white-space:pre;
}
@keyframes rainbow_animation {
0%,100% {
background-position: 0 0;
}
50% {
background-position: 100% 0;
}
}
</style>
<!-- Display the countdown timer in an element -->
<p id="demo"></p>
<script>
// Set the date we're counting down to
var currentYear = new Date().getFullYear();
var countDownDate = new Date("Feb 14, " + currentYear + " 12:00:00 AM GMT+1 (CET)").getTime();
var now = new Date().getTime();
if (countDownDate < now) {
var currentYear = new Date().getFullYear()+1;
var countDownDate = new Date("Feb 14, " + currentYear + " 12:00:00 AM GMT+1 (CET)").getTime();
} else {
var currentYear = new Date().getFullYear();
var countDownDate = new Date("Feb 14, " + currentYear + " 12:00:00 AM GMT+1 (CET)").getTime();
}
// Update the count down every 1 second
var x = setInterval(function() {
// Get today's date and time
var now = new Date().getTime();
var distance = countDownDate - now;
// Calculate the number of days until the countdown date
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
// Calculate the number of years until the countdown date
var startDate = new Date();
var endDate = new Date(countDownDate);
var years = endDate.getFullYear() - startDate.getFullYear();
if (startDate.getMonth() > endDate.getMonth() || (startDate.getMonth() == endDate.getMonth() && startDate.getDate() > endDate.getDate())) {
years--;
}
// Calculate the number of days until the countdown date
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
// Subtract the number of days in previous years
days -= years * 365;
// Adjust for any leap years that have occurred
for (var i = startDate.getFullYear(); i < endDate.getFullYear(); i++) {
if (isLeapYear(i)) {
days--;
}
}
// Check if a year is a leap year
function isLeapYear(year) {
if (year % 4 != 0) {
return false;
} else if (year % 400 == 0) {
return true;
} else if (year % 100 == 0) {
return false;
} else {
return true;
}
}
// Calculate the number of hours, minutes, and seconds until the countdown date
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
if (years != 0) {
document.getElementsByClassName("rainbow_text_animated")[0].textContent = years + " y\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += days + " d\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += hours + " h\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += minutes + " m\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += seconds + " s\r\n";
} else if (days != 0) {
document.getElementsByClassName("rainbow_text_animated")[0].textContent = days + " d\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += hours + " h\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += minutes + " m\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += seconds + " s\r\n";
} else if (hours != 0) {
document.getElementsByClassName("rainbow_text_animated")[0].textContent = hours + " h\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += minutes + " m\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += seconds + " s\r\n";
} else if (minutes != 0) {
document.getElementsByClassName("rainbow_text_animated")[0].textContent = minutes + " m\r\n";
document.getElementsByClassName("rainbow_text_animated")[0].textContent += seconds + " s\r\n";
} else {
document.getElementsByClassName("rainbow_text_animated")[0].textContent += seconds + " s\r\n";
}
// code written up by chatgpt xx love you mwah
}, 1000);
</script>
<audio autoplay=1 loop id="bgmusic">
<source src="https://cdn.discordapp.com/attachments/382404542245109772/1057180414139179018/yt1s.com_-_Hyper_Spoiler.mp3" type="audio/mp3">
Your browser does not support the audio element.
</audio>
<script>
try {
var audio = document.getElementById("bgmusic");
audio.volume = 0.2;
var hasInit = false;
function playMusic()
{
if(!hasInit)
{
hasInit = true;
audio.play();
}
}
} catch (error) {
console.log("error lol")
}
</script>
<div id="shadowBox">
<h1 class="rainbow_text_animated" id="demo"> Sample Text </h1>
</div>
</body>
</div>