summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Favre <gnomus@gnomus.de>2014-08-24 16:44:36 +0200
committerFelix Favre <gnomus@gnomus.de>2014-08-24 16:44:36 +0200
commit88dfb2e3a8d3c3ef5fb9007e72491baeb7f6373f (patch)
tree85747fc125c3a2e8ff270f575287617f7b3d7744
parent1f43c46a2c604e8892bace6437ef19e26c4459e1 (diff)
Countdown implementation
-rw-r--r--public/js/moment-countdown.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/public/js/moment-countdown.js b/public/js/moment-countdown.js
index e69de29b..999cfcf5 100644
--- a/public/js/moment-countdown.js
+++ b/public/js/moment-countdown.js
@@ -0,0 +1,11 @@
+$(document).ready(function() {
+ $.each($('.moment-countdown'), function(i, e) {
+ var span = $(e);
+ var text = span.html();
+ var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000));
+ span.html(text.replace("%c", timestamp.fromNow()));
+ setInterval(function() {
+ span.html(text.replace("%c", timestamp.fromNow()));
+ }, 1000);
+ });
+}); \ No newline at end of file