updated deploy scripts and fixed countdown
This commit is contained in:
parent
f3b1599857
commit
a9ed350d54
1425
assets/js/index.js
1425
assets/js/index.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -5,10 +5,11 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "run-p start-jekyll start-parcel",
|
||||
"build": "JEKYLL_ENV=production jekyll build",
|
||||
"build": "yarn build-jekyll && yarn build-parcel",
|
||||
"start-jekyll": "bundle exec jekyll serve",
|
||||
"start-parcel": "parcel src/index.js -d assets/js",
|
||||
"build-jekyll": "JEKYLL_ENV=production jekyll build",
|
||||
"build-parcel": "parcel build src/index.js -d ./_site/assets/js",
|
||||
"deploy-dev": "yarn build && scp -r -P 7833 ./_site/* amemasu@185.203.114.165:/var/www/dev.reclaimfutures.org",
|
||||
"deploy-prod": "yarn build && scp -r -P 7833 ./_site/* amemasu@185.203.114.165:/var/www/reclaimfutures.org"
|
||||
},
|
||||
@ -19,7 +20,6 @@
|
||||
"parcel-bundler": "^1.12.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"countdown": "^2.6.0",
|
||||
"spacetime": "^6.6.3"
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
import scrollHandler from './modules/scrollHandler';
|
||||
import clock from './modules/clock';
|
||||
import countdownBanner from './modules/countdown';
|
||||
import countdownTimer from './modules/countdown';
|
||||
|
||||
const app = () => {
|
||||
scrollHandler();
|
||||
clock();
|
||||
countdownBanner();
|
||||
|
||||
countdownTimer();
|
||||
setInterval(countdownTimer, 1000);
|
||||
};
|
||||
|
||||
app();
|
||||
|
@ -1,37 +1,32 @@
|
||||
import countdown from 'countdown';
|
||||
|
||||
const banner = document.getElementById('full-banner');
|
||||
const cdTime = banner?.querySelector('.cd-time');
|
||||
let bannerVisible = false;
|
||||
|
||||
function getCountdown() {
|
||||
return countdown(
|
||||
new Date(),
|
||||
new Date('Wed Sep 18 2020 10:30:00 GMT+0200 (Central European Summer Time)'),
|
||||
0,
|
||||
3)
|
||||
.toString();
|
||||
}
|
||||
const targetDate = new Date('Wed Sep 18 2020 10:30:00 GMT+0200 (Central European Summer Time)');
|
||||
|
||||
function setCountdown() {
|
||||
const cd = getCountdown();
|
||||
if (cdTime.innerHTML !== cd) {
|
||||
cdTime.innerHTML = cd;
|
||||
|
||||
function countdownTimer() {
|
||||
const difference = +new Date(targetDate) - +new Date();
|
||||
let remaining = '';
|
||||
|
||||
if (difference > 0) {
|
||||
const parts = {
|
||||
days: Math.floor(difference / (1000 * 60 * 60 * 24)),
|
||||
hours: Math.floor((difference / (1000 * 60 * 60)) % 24),
|
||||
minutes: Math.floor((difference / 1000 / 60) % 60),
|
||||
seconds: Math.floor((difference / 1000) % 60),
|
||||
};
|
||||
|
||||
remaining = Object.keys(parts)
|
||||
.map((part) => {
|
||||
if (!parts[part]) return;
|
||||
return `${parts[part]} ${part}`;
|
||||
})
|
||||
.join(' ');
|
||||
|
||||
cdTime.innerText = remaining;
|
||||
} else {
|
||||
banner.querySelector('h1').innerHTML = `ReclaimFutures is now <span class="now-live">[LIVE]</span> <a href="/watch">→ click here to watch</a>`;
|
||||
}
|
||||
}
|
||||
|
||||
const countdownBanner = () => {
|
||||
if (banner) {
|
||||
banner.classList.add('hidden');
|
||||
getCountdown();
|
||||
|
||||
if (!bannerVisible) {
|
||||
banner.classList.remove('hidden');
|
||||
bannerVisible = true;
|
||||
}
|
||||
|
||||
setInterval(setCountdown, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
export default countdownBanner;
|
||||
export default countdownTimer;
|
||||
|
@ -1633,11 +1633,6 @@ cosmiconfig@^5.0.0:
|
||||
js-yaml "^3.13.1"
|
||||
parse-json "^4.0.0"
|
||||
|
||||
countdown@^2.6.0:
|
||||
version "2.6.0"
|
||||
resolved "https://registry.yarnpkg.com/countdown/-/countdown-2.6.0.tgz#677fb8e3a9d4cc4e76415901ba253b518af34177"
|
||||
integrity sha1-Z3+446nUzE52QVkBuiU7UYrzQXc=
|
||||
|
||||
create-ecdh@^4.0.0:
|
||||
version "4.0.4"
|
||||
resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e"
|
||||
|
Loading…
Reference in New Issue
Block a user