From ea6849bff94d06d7251aef028e5d113ece1916de Mon Sep 17 00:00:00 2001 From: youngermax <60242131+YoungerMax@users.noreply.github.com> Date: Sun, 27 Mar 2022 08:35:00 -0400 Subject: [PATCH] Fix #1 and check for a download once released --- assets/css/index.css | 12 ++++++++++++ assets/js/index.js | 21 ++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/assets/css/index.css b/assets/css/index.css index 10560e2..6f3ae28 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -290,6 +290,10 @@ footer div.right { section img { width: 90vw; } + + .countdown-text { + font-size: 4em; + } } @media screen and (max-width: 600px) { @@ -325,6 +329,10 @@ footer div.right { text-align: center; justify-content: center; } + + .countdown-text { + font-size: 3.5em; + } } @media screen and (max-width: 450px) { @@ -332,4 +340,8 @@ footer div.right { border-radius: 0px; width: 100vw; } + + .countdown-text { + font-size: 2.5em; + } } \ No newline at end of file diff --git a/assets/js/index.js b/assets/js/index.js index 45d81c0..47d802c 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -9,7 +9,8 @@ const DOWNLOAD_BUTTON = document.querySelector('.download-button'); const DOWNLOAD_LINK = document.querySelector('.download-link'); const COUNTDOWN_TEXT = document.querySelector('.countdown-text'); -const COUNTDOWN_DATE = new Date("Mar 27, 2022 17:00:00 EST"); +const COUNTDOWN_DATE = new Date("Mar 27, 2022 17:15:00 GMT-0400"); +var COUNTDOWN_INTERVAL = null; const ONE_SECOND = 1000; const ONE_MINUTE = ONE_SECOND * 60; @@ -62,7 +63,22 @@ function updateCountdown() { COUNTDOWN_TEXT.textContent = `${dayCount}:${hourCount}:${minuteCount}:${secondCount}`; } else { + clearInterval(COUNTDOWN_INTERVAL); COUNTDOWN_TEXT.textContent = "Released! 🥳"; + + var checkForDownload = setInterval(() => { + new Promise((resolve, reject) => { + resolve(getLatestReleaseDownloadUrl()); + }).then(url => { + if (url == null) { + DOWNLOAD_BUTTON.textContent = "Download coming soon!"; + } else { + clearInterval(checkForDownload); + DOWNLOAD_BUTTON.textContent = "Download Installer (Java 8)"; + DOWNLOAD_LINK.href = url; + } + }); + }, 5000); } } @@ -97,6 +113,5 @@ window.addEventListener('load', e => { clearTimeout(timeout); }, 500); - updateCountdown(); - setInterval(updateCountdown, ONE_SECOND); + COUNTDOWN_INTERVAL = setInterval(updateCountdown, ONE_SECOND); }); \ No newline at end of file