jam-cloud/web/app/assets/javascripts/tickDuration.js

20 lines
590 B
JavaScript
Raw Permalink Normal View History

2014-02-28 06:40:19 +00:00
(function(context, $) {
"use strict";
context.JK = context.JK || {};
context.JK.TickDuration = function(customSelector) {
setInterval(function() {
$.each($(customSelector ? customSelector : '.inprogress .tick-duration'), function(index, item) {
2014-02-28 06:40:19 +00:00
var $duration = $(item);
var createdAt = new Date(Number($duration.attr('data-created-at')) * 1000)
var millisElapsed = (new Date().getTime() - createdAt.getTime());
$duration.text(context.JK.prettyPrintSeconds(parseInt(millisElapsed / 1000)));
2014-02-28 06:40:19 +00:00
});
}, 333);
}
})(window, jQuery);