1// Pakcet counter 2document.addEventListener('DOMContentLoaded', function () { 3 if (document.querySelector('.blockPacketCounter')) { 4 const packetCounter = document.querySelector('.blockPacketCounter'); 5 const remainingPacketsValue = document.querySelectorAll('.remainingPacketsValue mark'); 6 const decrementPerHour = 1; 7 const dateStartAttr = packetCounter.getAttribute('data-date-start'); 8 const dateStart = new Date(dateStartAttr).getTime(); 9 const totalPackages = packetCounter.getAttribute('data-packet-qty'); 10 let remainingPackages = totalPackages; 11 12 if (dateStart && totalPackages && remainingPacketsValue) { 13 let startDateCountDown = setInterval(function () { 14 const currentDate = new Date().getTime(); 15 const timePassed = currentDate - dateStart; 16 const hoursElapsed = Math.floor(timePassed / (1000 * 60 * 60)); 17 18 remainingPackages = totalPackages - hoursElapsed * decrementPerHour; 19 20 if (remainingPackages <= 10) { 21 clearInterval(startDateCountDown); 22 } 23 24 remainingPacketsValue.forEach((el) => { 25 el.innerText = remainingPackages > 10 ? remainingPackages : 10; 26 el.classList.add('visible'); 27 }); 28 }, 1000); 29 } 30 } 31}); 32 33// Contact form - disabling fields 34document.addEventListener('DOMContentLoaded', function () { 35 if(document.querySelector('#contactForm')) { 36 const contactForm = document.querySelector('#contactForm'); 37 const locations = contactForm.querySelector('select'); 38 const btnSubmit = contactForm.querySelector('#btnSubmit'); 39 const btnOffer = contactForm.querySelector('#btnOffer'); 40 41 locations.addEventListener('change', function (e) { 42 const locationsValue = e.target.value; 43 44 if(locationsValue === '1' || locationsValue === '2-10' || locationsValue === '11-20') { 45 btnSubmit.style.display = 'none'; 46 btnOffer.style.display = 'flex'; 47 } else { 48 btnSubmit.style.display = 'flex'; 49 btnOffer.style.display = 'none'; 50 } 51 }); 52 } 53}); 54 55// Pricing loader 56document.addEventListener('DOMContentLoaded', function () { 57 const loader = document.querySelector('.pricing-loader'); 58 const calculator = document.querySelector('.calculator'); 59 60 if(loader && calculator) { 61 setTimeout(() => { 62 calculator.classList.add('loaded'); 63 loader.classList.add('pricing-loader--hidden'); 64 }, 1500); 65 66 setTimeout(() => { 67 loader.style.zIndex = '0'; 68 }, 2500); 69 } 70}); 71 72// Form submit 73window.addEventListener('DOMContentLoaded', () => { 74 document.body.addEventListener( 'kb-advanced-form-success', function( event ) { 75 if(event.detail.uniqueId === '10722-cpt-id' || event.detail.uniqueId === '10977-cpt-id' || event.detail.uniqueId === '10979-cpt-id') { 76 const pdfBtn = document.querySelector('#pdfBtn'); 77 const pdfLink = pdfBtn.querySelector('.kb-button'); 78 79 if(pdfLink.href.length !== '') { 80 window.open(pdfLink.href, '_blank'); 81 } 82 } 83 }, false ); 84}); 85 86// Audit form - disabling fields 87document.addEventListener('DOMContentLoaded', function () { 88 if(document.querySelector('#auditForm')) { 89 const contactForm = document.querySelector('#auditForm'); 90 const locations = contactForm.querySelector('#locations'); 91 92 function checkNumberLocations(e) { 93 const contactForm = document.querySelector('#auditForm'); 94 const btnSubmit = contactForm.querySelector('#btnSubmit'); 95 const btnOffer = contactForm.querySelector('#btnOffer'); 96 const locationsValue = e.target.value; 97 98 if(locationsValue && Number(locationsValue) < 20) { 99 btnSubmit.style.display = 'none'; 100 btnOffer.style.display = 'flex'; 101 } else { 102 btnSubmit.style.display = 'flex'; 103 btnOffer.style.display = 'none'; 104 } 105 } 106 107 ['change', 'input'].forEach(event => locations.addEventListener(event, checkNumberLocations)); 108 } 109});
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.