20 lines
600 B
JavaScript
20 lines
600 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 = (context.JK.nowUTC().getTime() - createdAt.getTime());
|
|
$duration.text(context.JK.prettyPrintSeconds( parseInt(millisElapsed / 1000)));
|
|
});
|
|
}, 333);
|
|
}
|
|
|
|
|
|
})(window, jQuery);
|
|
|