1/** 2 * jQuery Tabs plugin 1.0.0 3 * 4 * @author Drfuri 5 */ 6(function ($) { 7 $.fn.ecomus_countdown = function () { 8 return this.each(function () { 9 var $this = $(this), 10 diff = $this.data('expire'), 11 icon = $this.data('icon'); 12 13 var updateClock = function (distance) { 14 var days = Math.floor(distance / (60 * 60 * 24)); 15 var hours = Math.floor((distance % (60 * 60 * 24)) / (60 * 60)); 16 var minutes = Math.floor((distance % (60 * 60)) / (60)); 17 var seconds = Math.floor(distance % 60); 18 var texts = $this.data('text'); 19 var icons = icon ? icon : ''; 20 var daySimple = texts.day ? texts.day : texts.days; 21 var hourSimple = texts.hour ? texts.hour : texts.hours; 22 var minuteSimple = texts.minute ? texts.minute : texts.minutes; 23 var secondSimple = texts.second ? texts.second : texts.seconds; 24 25 $this.html( 26 icons + 27 '<span class="days timer"><span class="digits">' + days + '</span><span class="text">' + (days == 1 ? daySimple : texts.days) + '</span><span class="divider">:</span></span>' + 28 '<span class="hours timer"><span class="digits">' + (hours < 10 ? '0' : '') + hours + '</span><span class="text">' + (hours == 1 ? hourSimple : texts.hours) + '</span><span class="divider">:</span></span>' + 29 '<span class="minutes timer"><span class="digits">' + (minutes < 10 ? '0' : '') + minutes + '</span><span class="text">' + (minutes == 1 ? minuteSimple : texts.minutes) + '</span><span class="divider">:</span></span>' + 30 '<span class="seconds timer"><span class="digits">' + (seconds < 10 ? '0' : '') + seconds + '</span><span class="text">' + (seconds == 1 ? secondSimple : texts.seconds) + '</span></span>' 31 ); 32 }; 33 34 updateClock(diff); 35 36 var countdown = setInterval(function () { 37 diff = diff - 1; 38 var new_diff = diff < 0 ? 0 : diff; 39 updateClock(new_diff); 40 41 if (diff < 0) { 42 clearInterval(countdown); 43 } 44 }, 1000); 45 }); 46 }; 47 48 /* Init tabs */ 49 $(function () { 50 $('.ecomus-countdown').ecomus_countdown(); 51 52 $(document.body).on('ecomus_countdown', function (e, $el) { 53 $el.ecomus_countdown(); 54 }); 55 }); 56})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.