diff options
author | msquare <msquare@notrademark.de> | 2016-08-21 22:19:26 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-08-21 22:19:26 +0200 |
commit | e89727de7d12edfb3f309c485a5effbbfc9e4c2f (patch) | |
tree | 2428f51b2baaa94415c191edf959de40692b672c /public/js | |
parent | e80e2e9c2b4a77eae19864af8d5b30bbf9a25fd5 (diff) |
add check for undefined variables in moment-countdown.js and add comments
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/moment-countdown.js | 5 |
1 files changed, 3 insertions, 2 deletions
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() { |