2014-02-28 06:40:19 +00:00
|
|
|
(function(context, $) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
context.JK = context.JK || {};
|
|
|
|
|
context.JK.TickDuration = function(customSelector) {
|
|
|
|
|
setInterval(function() {
|
2014-02-28 19:28:17 +00:00
|
|
|
$.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)
|
2014-09-14 23:17:16 +00:00
|
|
|
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);
|
|
|
|
|
|