summaryrefslogtreecommitdiff
path: root/js/app/counter.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/app/counter.js')
-rw-r--r--js/app/counter.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/app/counter.js b/js/app/counter.js
new file mode 100644
index 0000000..dad6ec4
--- /dev/null
+++ b/js/app/counter.js
@@ -0,0 +1,24 @@
+(function() {
+ // UTC milliseconds since 1970
+ // Example conversion: date --date 2017-05-16T17:00Z+2 +%s000
+ var SHOWTIME = new Date(1494946800000),
+ DEMO_PAST = 'Last FREE Live Webinar began',
+ DEMO_CURRENT = 'FREE Live Webinar began',
+ DEMO_FUTURE = 'Next FREE Live Webinar begins';
+
+ function update() {
+ var ts = countdown(SHOWTIME, null);
+
+ var counter = document.getElementById('counter'),
+ msg = ts.toHTML('strong', null);
+
+ msg = (ts.value > 0) ?
+ DEMO_PAST+' '+msg+' ago!' :
+ DEMO_FUTURE+' in '+msg+'!';
+
+ counter.innerHTML = msg;
+
+ requestAnimationFrame(update, counter.parentNode);
+ }
+ update();
+})();