Skip to content

Commit

Permalink
Fix #1 and check for a download once released
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungerMax committed Mar 27, 2022
1 parent 6a2c875 commit ea6849b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
12 changes: 12 additions & 0 deletions assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,10 @@ footer div.right {
section img {
width: 90vw;
}

.countdown-text {
font-size: 4em;
}
}

@media screen and (max-width: 600px) {
Expand Down Expand Up @@ -325,11 +329,19 @@ footer div.right {
text-align: center;
justify-content: center;
}

.countdown-text {
font-size: 3.5em;
}
}

@media screen and (max-width: 450px) {
section img {
border-radius: 0px;
width: 100vw;
}

.countdown-text {
font-size: 2.5em;
}
}
21 changes: 18 additions & 3 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -97,6 +113,5 @@ window.addEventListener('load', e => {
clearTimeout(timeout);
}, 500);

updateCountdown();
setInterval(updateCountdown, ONE_SECOND);
COUNTDOWN_INTERVAL = setInterval(updateCountdown, ONE_SECOND);
});

0 comments on commit ea6849b

Please sign in to comment.