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