20 lines
591 B
JavaScript
20 lines
591 B
JavaScript
(function(context, $) {
|
|
|
|
"use strict";
|
|
|
|
context.JK = context.JK || {};
|
|
context.JK.TickDuration = function(customSelector) {
|
|
setInterval(function() {
|
|
$.each($(customSelector ? customSelector : '.inprogress .tick-duration'), function(index, item) {
|
|
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)));
|
|
});
|
|
}, 333);
|
|
}
|
|
|
|
|
|
})(window, jQuery);
|
|
|