summaryrefslogtreecommitdiff
path: root/js/app/counter.js
blob: dad6ec4d8403fa50eca1066c8a83f5f2d33396ad (plain)
  1. (function() {
  2. // UTC milliseconds since 1970
  3. // Example conversion: date --date 2017-05-16T17:00Z+2 +%s000
  4. var SHOWTIME = new Date(1494946800000),
  5. DEMO_PAST = 'Last FREE Live Webinar began',
  6. DEMO_CURRENT = 'FREE Live Webinar began',
  7. DEMO_FUTURE = 'Next FREE Live Webinar begins';
  8. function update() {
  9. var ts = countdown(SHOWTIME, null);
  10. var counter = document.getElementById('counter'),
  11. msg = ts.toHTML('strong', null);
  12. msg = (ts.value > 0) ?
  13. DEMO_PAST+' '+msg+' ago!' :
  14. DEMO_FUTURE+' in '+msg+'!';
  15. counter.innerHTML = msg;
  16. requestAnimationFrame(update, counter.parentNode);
  17. }
  18. update();
  19. })();