From 64874520b905bc35c24fe29db6f88590654bea1b Mon Sep 17 00:00:00 2001 From: Eddie Wen Date: Tue, 28 Nov 2017 11:20:32 +0800 Subject: [PATCH] feat: show `XX` in timer after hackathon --- src/js/index.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/js/index.js b/src/js/index.js index 1bf3656..91cd633 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -15,14 +15,28 @@ const reversedCatTyping = [...catTyping].reverse().join(''); /** * first shot */ -updateTime(countdown()); +const outcome = countdown(); -/** - * execute it every second - */ -setInterval(() => { - updateTime(countdown()); -}, 1000); +if (!outcome) { + updateTime(outcome); + + /** + * execute it every second + */ + setInterval(() => { + updateTime(countdown()); + }, 1000); +} else { + /** + * oops! hackathon is over + */ + const $timer = document.querySelector('.countdown-timer'); + + $timer.querySelector('.days > .value').innerText = 'XX'; + $timer.querySelector('.hours > .value').innerText = 'XX'; + $timer.querySelector('.minutes > .value').innerText = 'XX'; + $timer.querySelector('.seconds > .value').innerText = 'XX'; +} const comingAgain = (typeObject, inputString) => { document.body.classList.add('invert');