/**
* jQuery Tabs plugin 1.0.0
*
* @author Drfuri
*/
(function($) {
$.fn.mf_countdown = function() {
return this.each(function() {
var $this = $(this),
diff = $this.data('expire');
var updateClock = function(distance) {
var days = Math.floor(distance / (60 * 60 * 24));
var hours = Math.floor((distance % (60 * 60 * 24)) / (60 * 60));
var minutes = Math.floor((distance % (60 * 60)) / (60));
var seconds = Math.floor(distance % 60);
$this.html(
'' + (days < 10 ? '0' : '') + days + '' + martfuryData.days + '' +
':' +
'' + (hours < 10 ? '0' : '') + hours + '' + martfuryData.hours + '' +
':' +
'' + (minutes < 10 ? '0' : '') + minutes + '' + martfuryData.minutes + '' +
':' +
'' + (seconds < 10 ? '0' : '') + seconds + '' + martfuryData.seconds + ''
);
};
updateClock(diff);
var countdown = setInterval(function() {
diff = diff - 1;
updateClock(diff);
if ( diff < 0 ) {
clearInterval(countdown);
}
}, 1000);
});
};
/* Init tabs */
$(function() {
$('.martfury-countdown').mf_countdown();
});
})(jQuery);