1$(function(){ 2 jQuery.fn.dwTimer = function(options) { 3 var options = $.extend({ 4 timerLoop: false, 5 startDate: false, 6 endDate: false 7 }, options); 8 9 //vars 10 var timeoutID; 11 12 //j vars 13 var $this = this; 14 var $dayContainer = $this.find(".timerDayValue"); 15 var $hourContainer = $this.find(".timerHourValue"); 16 var $minuteContainer = $this.find(".timerMinuteValue"); 17 var $secondContainer = $this.find(".timerSecondValue"); 18 19 //functions 20 var calculateValues = function(){ 21 22 //set vars 23 curDate = new Date(); 24 25 //calculate 26 var remainingDate = new Date(endDate.getTime() - curDate.getTime()); 27 var remainingSecond = Math.floor((remainingDate / 1000) % 60); 28 var remainingMinute = Math.floor((remainingDate / 1000 / 60) % 60); 29 var remainingHour = Math.floor((remainingDate / (1000 * 60 * 60)) % 24); 30 var remainingDay = Math.floor(remainingDate / (1000 * 60 * 60 * 24)); 31 32 //write DOM 33 $dayContainer.text(remainingDay); 34 $hourContainer.text(remainingHour); 35 $minuteContainer.text(remainingMinute); 36 $secondContainer.text(remainingSecond); 37 38 }; 39 40 // set end time value 41 if(options["timerLoop"] > 0 && options["startDate"] > 0){ //loop mode 42 43 var endDate = new Date(options["startDate"] * 1000); // timestamp msec (php time() * 1000) 44 var curDate = new Date(); 45 46 //set end date form option 47 endDate.setDate(endDate.getDate() + parseInt(options["timerLoop"])); // set tmp endDate 48 49 //loop mode 50 while(endDate.getTime() <= curDate.getTime()){ 51 endDate.setDate(endDate.getDate() + parseInt(options["timerLoop"])); 52 } 53 54 }else if(options["endDate"] != ""){ 55 56 var endDate = new Date(options["endDate"] * 1000); // timestamp msec (php time() * 1000) 57 var curDate = new Date(); 58 59 } 60 61 timeoutID = setInterval(function(){ 62 calculateValues(); 63 }, 1000); 64 65 //start timer 66 calculateValues(); 67 68 }; 69});
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.