1function section_timer(){ 2 3 let js_timer = document.querySelector('.js-timer'); 4 5 if (js_timer) { 6 console.log(js_timer.getAttribute('data-time')); 7 8 // Set the date we're counting down to 9 var countDownDate = new Date(js_timer.getAttribute('data-datetime')).getTime(); 10 // var countDownDate = Number(js_timer.getAttribute('data-time')); 11 12 // Update the count down every 1 second 13 var x = setInterval(function() { 14 15 // Get today's date and time 16 var now = new Date().getTime(); 17 18 // Find the distance between now and the count down date 19 var distance = countDownDate - now; 20 21 // Time calculations for days, hours, minutes and seconds 22 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 23 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 24 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 25 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 26 27 if(days<0) days = 0; 28 if(hours<0) hours = 0; 29 if(minutes<0) minutes = 0; 30 if(seconds<0) seconds = 0; 31 32 // Display the result in the element with id="demo" 33 // var display = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; 34 35 js_timer.querySelector('.d-day .value').innerHTML = days; 36 js_timer.querySelector('.d-day .label').innerHTML = days>1 ? js_timer.querySelector('.d-day').getAttribute('data-plural') : js_timer.querySelector('.d-day').getAttribute('data-singular'); 37 38 js_timer.querySelector('.d-hour .value').innerHTML = hours; 39 js_timer.querySelector('.d-hour .label').innerHTML = hours>1 ? js_timer.querySelector('.d-hour').getAttribute('data-plural') : js_timer.querySelector('.d-hour').getAttribute('data-singular'); 40 41 js_timer.querySelector('.d-minute .value').innerHTML = minutes; 42 js_timer.querySelector('.d-minute .label').innerHTML = minutes>1 ? js_timer.querySelector('.d-minute').getAttribute('data-plural') : js_timer.querySelector('.d-minute').getAttribute('data-singular'); 43 44 js_timer.querySelector('.d-second .value').innerHTML = seconds; 45 js_timer.querySelector('.d-second .label').innerHTML = seconds>1 ? js_timer.querySelector('.d-second').getAttribute('data-plural') : js_timer.querySelector('.d-second').getAttribute('data-singular'); 46 47 // If the count down is finished, write some text 48 if (distance < 0) { 49 clearInterval(x); 50 // document.getElementById("demo").innerHTML = "EXPIRED"; 51 } 52 }, 1000); 53 54 55 } 56} 57 58document.addEventListener('DOMContentLoaded', function(){ 59 section_timer() 60}, false);
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.