~jbauer/simple-web-countdown

cb9a46bd00106ab192fa24e85caf70b7f3ddd741 — Jake Bauer 11 months ago 57401a8 master
Fix display of !!!HYPE!!! message
1 files changed, 9 insertions(+), 6 deletions(-)

M index.html
M index.html => index.html +9 -6
@@ 45,18 45,21 @@
	let x = setInterval(function() {
		let now = new Date().getTime();
		distance = countdownDate - now;
		clock = document.getElementById("clock");
		if (distance < 0) {
			clearInterval(x);
			clock.innerHTML = "!!!HYPE!!!";
			document.getElementById("event").innerHTML = "It's " + eventName + " time!";
		}

		let days = Math.floor(distance / (1000 * 60 * 60 * 24));
		let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
		let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
		let seconds = Math.floor((distance % (1000 * 60)) / 1000);

		clock = document.getElementById("clock");
		clock.innerHTML = days + "d " + ("00" + hours).slice(-2) + ":" +
			("00" + minutes).slice(-2) + ":" + ("00" + seconds).slice(-2);

		if (distance < 0) {
			clearInterval(x);
			clock.innerHTML = "!!!HYPE!!!";
			document.getElementById("event").innerHTML = "It's " + eventName + " time!";
		}
	}, 1000);
	</script>
</body>