1(function($){ 2 $.fn.lofCountDown = function( options ) { 3 return this.each(function() { 4 // get instance of the lofCountDown. 5 new $.lofCountDown( this, options ); 6 }); 7 } 8 $.lofCountDown = function( obj, options ){ 9 10 this.options = $.extend({ 11 autoStart : true, 12 LeadingZero:true, 13 DisplayFormat:"<div>%%D%% Days</div><div>%%H%% Hours</div><div>%%M%% Minutes</div><div>%%S%% Seconds</div>", 14 FinishMessage:"Expired", 15 CountActive:true, 16 TargetDate:null 17 }, options || {} ); 18 if( this.options.TargetDate == null || this.options.TargetDate == '' ){ 19 return ; 20 } 21 this.timer = null; 22 this.element = obj; 23 this.CountStepper = -1; 24 this.CountStepper = Math.ceil(this.CountStepper); 25 this.SetTimeOutPeriod = (Math.abs(this.CountStepper)-1)*1000 + 990; 26 var dthen = new Date(this.options.TargetDate); 27 var dnow = new Date(); 28 if( this.CountStepper > 0 ) { 29 ddiff = new Date(dnow-dthen); 30 } 31 else { 32 ddiff = new Date(dthen-dnow); 33 } 34 gsecs = Math.floor(ddiff.valueOf()/1000); 35 this.CountBack(gsecs, this); 36 37 }; 38 $.lofCountDown.fn = $.lofCountDown.prototype; 39 $.lofCountDown.fn.extend = $.lofCountDown.extend = $.extend; 40 $.lofCountDown.fn.extend({ 41 calculateDate:function( secs, num1, num2 ){ 42 var s = ((Math.floor(secs/num1))%num2).toString(); 43 if ( this.options.LeadingZero && s.length < 2) { 44 s = "0" + s; 45 } 46 return "<b>" + s + "</b>"; 47 }, 48 CountBack:function( secs, self ){ 49 if (secs < 0) { 50 self.element.innerHTML = '<div class="lof-labelexpired"> '+self.options.FinishMessage+"</div>"; 51 return; 52 } 53 clearInterval(self.timer); 54 DisplayStr = self.options.DisplayFormat.replace(/%%D%%/g, self.calculateDate( secs,86400,100000) ); 55 DisplayStr = DisplayStr.replace(/%%H%%/g, self.calculateDate(secs,3600,24)); 56 DisplayStr = DisplayStr.replace(/%%M%%/g, self.calculateDate(secs,60,60)); 57 DisplayStr = DisplayStr.replace(/%%S%%/g, self.calculateDate(secs,1,60)); 58 self.element.innerHTML = DisplayStr; 59 if (self.options.CountActive) { 60 self.timer = null; 61 self.timer = setTimeout( function(){ 62 self.CountBack((secs+self.CountStepper),self); 63 },( self.SetTimeOutPeriod ) ); 64 } 65 } 66 67 }); 68 $(document).ready(function(){ 69 $('[data-countdown="countdown"]').each(function(index, el) { 70 var $this = $(this); 71 var $date = $this.data('date').split("-"); 72 let days=!!$(this).data('day')?$(this).data('day'):"Days"; 73 let hours=!!$(this).data('hour')?$(this).data('hour'):"Hours"; 74 let mins=!!$(this).data('min')?$(this).data('min'):"Mins"; 75 let secs=!!$(this).data('sec')?$(this).data('sec'):"Secs"; 76 $this.lofCountDown({ 77 TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5], 78 DisplayFormat:"<div class=\"countdown-times\"><div class=\"day\">
78%%D%% "+days+"</div><div class=\"hours\">%%H%% "+hours+"</div><div class=\"minutes\">%%M%% "+mins+"</div><div class=\"seconds\">%%S%% "+secs+"</div></div>", 79 FinishMessage: "Expired" 80 }); 81 }); 82 }); 83})(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.