diff --git a/index.html b/index.html index 4b07cd9..4c0f70f 100755 --- a/index.html +++ b/index.html @@ -11,13 +11,13 @@

ångstromCTF

A cybersecurity competition for high schoolers.

-
-
-

March 13 to 18

-
8 PM EDT
+
+
+

We'll be back!

+
Spring 2021
- -
+ +
@@ -47,10 +47,17 @@

March 13 to 18

-

Past years:

- + +

Past years:

+
+ 2020 + + 2019 + + 2018 + + 2017 +

Sponsors

diff --git a/timer.js b/timer.js index 5ecfc9c..238589a 100644 --- a/timer.js +++ b/timer.js @@ -3,15 +3,43 @@ function setValue (name, value) { node.textContent = value } +function setClass (name, c){ + var node = document.getElementById(name) + node.classList = c +} + function setProgress (name, ratio) { node = document.getElementById('progress-'+name) node.setAttribute('stroke-dashoffset', (1 - ratio) * 6.28 * 50) } + function step (timestamp) { var present = new Date() - var competition = Date.parse("2020-03-18T20:00:00.000-04:00") - var delta = (competition - present) / 1000 + + var delta; + + var competitionStart = Date.parse("2020-03-13T20:00:00.000-04:00"), + competitionEnd = Date.parse("2020-03-18T20:00:00.000-04:00") + + + if (competitionEnd - present < 0){ + // actf ended + document.getElementById("timer").remove() + + setClass("push", "dib mb3") + + return + + } else if (competitionStart - present < 0){ + // actf is going on + delta = (competitionEnd - present) / 1000 + + } else { + // actf has not started + delta = (competitionStart - present) / 1000 + } + delta = delta > 0 ? delta : 0 setValue('day', Math.floor(delta / 86400)) setProgress('day', delta / 31536000) @@ -24,7 +52,13 @@ function step (timestamp) { delta = delta % 60 setValue('second', Math.floor(delta)) setProgress('second', delta / 60) + window.requestAnimationFrame(step) } window.requestAnimationFrame(step) + + + + +