From e89727de7d12edfb3f309c485a5effbbfc9e4c2f Mon Sep 17 00:00:00 2001 From: msquare Date: Sun, 21 Aug 2016 22:19:26 +0200 Subject: add check for undefined variables in moment-countdown.js and add comments --- public/js/moment-countdown.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/js/moment-countdown.js b/public/js/moment-countdown.js index 302d75a1..9d655038 100644 --- a/public/js/moment-countdown.js +++ b/public/js/moment-countdown.js @@ -1,13 +1,14 @@ /** * Initialize all moment countdowns on the page. A moment countdown has the * class "moment-countdown" and the attribute "data-timestamp" which defines the - * countdown's goal. + * countdown's time goal. */ $(document).ready(function() { if (typeof moment !== "undefined") { - $.each($('.moment-countdown'), function(i, e) { + $.each($(".moment-countdown"), function(i, e) { var span = $(e); var text = span.html(); + /* global moment */ var timestamp = moment(parseInt(span.attr("data-timestamp") * 1000)); span.html(text.replace("%c", timestamp.fromNow())); setInterval(function() { -- cgit v1.2.3-70-g09d2