1(function($) { 2 3 $.fn.countdown = function(options, callback) { 4 5 var settings = { 'date': null } 6 7 if (options) { 8 $.extend(settings, options) 9 } 10 11 this_sel = $(this); 12 13 function count_ecec() { 14 15 16 17 eventDate = Date.parse(settings['date']) / 1000; 18 currentDate = Math.floor( $.now() / 1000 ); 19 20 if (eventDate <= currentDate ) { 21 callback.call(this); 22 clearInterval(interval); 23 } 24 25 seconds = eventDate - currentDate; 26 27 if (this_sel.find('.years').length > 0) { 28 years = Math.floor( seconds / ( 60 * 60 * 24 * 365 ) ); 29 seconds -= years * 60 * 60 * 24 * 365 ; 30 } 31 32 if (this_sel.find('.days').length > 0) { 33 days = Math.floor( seconds / ( 60 * 60 * 24 ) ); 34 seconds -= days * 60 * 60 * 24 ; 35 } 36 if (this_sel.find('.hours').length > 0) { 37 hours = Math.floor( seconds / ( 60 * 60) ); 38 seconds -= hours * 60 * 60 ; 39 } 40 if (this_sel.find('.mins').length > 0) { 41 minutes = Math.floor( seconds / 60 ); 42 seconds -= minutes * 60 ; 43 } 44 45 46 if (this_sel.find('.years').length > 0) { 47 years = (String(years).length < 2 ? '0' + years : years); 48 } 49 50 if (this_sel.find('.days').length > 0) { 51 days = (String(days).length < 2 ? '0' + days : days); 52 } 53 if (this_sel.find('.hours').length > 0) { 54 hours = (String(hours).length !==2 ? '0' + hours : hours); 55 } 56 if (this_sel.find('.mins').length > 0) { 57 minutes = (String(minutes).length !==2 ? '0' + minutes : minutes); 58 } 59 seconds = (String(seconds).length !==2 ? '0' + seconds : seconds); 60 61 if (!isNaN(eventDate)) { 62 if (this_sel.find('.years').length > 0) { 63 this_sel.find('.years').text(years); 64 } 65 if (this_sel.find('.days').length > 0) { 66 this_sel.find('.days').text(days); 67 } 68 if (this_sel.find('.hours').length > 0) { 69 this_sel.find('.hours').text(hours); 70 } 71 if (this_sel.find('.mins').length > 0) { 72 this_sel.find('.mins').text(minutes); 73 } 74 this_sel.find('.secs').text(seconds); 75 } 76 77 78 } 79 80 count_ecec(); 81 interval = setInterval(count_ecec, 1000); 82 83 84 } 85 86}) (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.