Clean up JS a little before the D.I.E. date
This commit is contained in:
parent
202094b660
commit
d142a26e1f
@ -30,25 +30,27 @@ var countDownDate = new Date("Aug 17, 2021 00:00:00").getTime();
|
|||||||
// Update the count down every 1 second
|
// Update the count down every 1 second
|
||||||
var x = setInterval(function () {
|
var x = setInterval(function () {
|
||||||
|
|
||||||
// Get today's date and time
|
// Get today's date and time
|
||||||
var now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
|
|
||||||
// Find the distance between now and the count down date
|
// Find the distance between now and the count down date
|
||||||
var distance = countDownDate - now;
|
var distance = countDownDate - now;
|
||||||
|
|
||||||
// Time calculations for days, hours, minutes and seconds
|
// Time calculations for days, hours, minutes and seconds
|
||||||
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
|
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
|
||||||
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) /
|
||||||
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
(1000 * 60 * 60));
|
||||||
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||||
|
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
||||||
|
|
||||||
// Display the result in the element with id="dethKlok"
|
// Display the result in the element with id="dethKlok"
|
||||||
document.getElementById("dethKlok").innerHTML = days + "d " + hours + "h " +
|
document.getElementById("dethKlok").innerHTML = days + "d " + hours + "h " +
|
||||||
minutes + "m " + seconds + "s ";
|
minutes + "m " + seconds + "s ";
|
||||||
|
|
||||||
// If the count down is finished, write some text
|
// If the count down is finished, write some text
|
||||||
if (distance < 0) {
|
if (distance < 0) {
|
||||||
clearInterval(x);
|
clearInterval(x);
|
||||||
document.getElementById("dethKlok").innerHTML = "DONE. Rest in pieces";
|
document.getElementById("dethKlok").innerHTML =
|
||||||
}
|
"DONE. Deprecated as of Aug 17, 2021 💀";
|
||||||
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user