1 2(function ($, Drupal) { 3 var fl = true; 4 function validateEmailInput(input) { 5 var emailPattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; 6 var email = input.value.trim(); 7 if (email == '') { 8 input.classList.add('error'); 9 input.classList.add('empty'); 10 return false; 11 } 12 if (emailPattern.test(email)) { 13 input.classList.remove('error'); 14 input.classList.remove('empty'); 15 return true; 16 } else { 17 input.classList.add('error'); 18 input.classList.remove('empty'); 19 return false; 20 } 21 } 22 //Function to animate a number with slowdown (ease-out) 23 function animateValue(el, start, end, duration) { 24 let startTimestamp = null; 25 const step = (timestamp) => { 26 if (!startTimestamp) startTimestamp = timestamp; 27 const progress = Math.min((timestamp - startTimestamp) / duration, 1); 28 const easedProgress = 1 - Math.pow(1 - progress, 3); 29 const value = Math.floor(easedProgress * (end - start) + start); 30 31 if (el.dataset.prefix === "$") { 32 el.textContent = "$" + value.toLocaleString("en-US"); 33 } else { 34 el.textContent = value.toLocaleString("en-US"); 35 } 36 37 if (progress < 1) { 38 window.requestAnimationFrame(step); 39 } 40 }; 41 window.requestAnimationFrame(step); 42 } 43// Card appearance observer 44 const observer = new IntersectionObserver((entries, obs) => { 45 entries.forEach(entry => { 46 if (entry.isIntersecting) { 47 const el = entry.target; 48 let text = el.textContent.trim(); 49 50 if (text.startsWith("$")) { 51 el.dataset.prefix = "$"; 52 text = text.replace(/\$|,/g, ""); 53 } else { 54 text = text.replace(/,/g, ""); 55 } 56 57 const endValue = parseInt(text, 10); 58 59 // ÐбнÑлÑем ÑекÑÑ Ð¸ показÑваем ÑÐ»ÐµÐ¼ÐµÐ½Ñ 60 el.textContent = el.dataset.prefix === "$" ? "$0" : "0"; 61 el.style.visibility = "visible"; 62 63 animateValue(el, 0, endValue, 2000); 64 obs.unobserve(el); 65 } 66 }); 67 }, { threshold: 0.5 }); 68 69 const observer2 = new MutationObserver(() => { 70 document.querySelectorAll('input[type="checkbox"][name="subscribe"]').forEach(cb => { 71 if (cb.hasAttribute('checked') && !cb.checked) { 72 cb.checked = true; 73 cb.defaultChecked = true; 74 } 75 }); 76 }); 77 78 $(document).ready(function() { 79 var inp = document.getElementById("edit-email"); 80 $(window).itis({is:['load']}); 81 $('.ng-header').sticky(); 82 let sel1 = once('select','.webform-submission-form select'); 83 $(sel1).select({ 84 allLabel: true, 85 classCopy: 'required error', 86 search: 'filter', 87 onSelectChanged: function() { 88 var $cl = $(this).closest('.wrap-sb').find('label'), ind = $(this).index(); 89 if ( ind === 0 ) { $cl.removeClass('has-value'); 90 } else { 91 $cl.addClass('has-value'); 92 } 93 }, 94 }); 95 const sel2 = once('select','#edit-field-interested'); 96 // $(sel2).select({ 97 // allLabel: true, 98 // classCopy: 'required error', 99 // multiple: true, 100 // hideselect: 'all', 101 // }); 102 // $('.accordion').each(function() { 103 // $(this).find('.tab').toggler({}); 104 // }); 105 $('.accordion .tab').toggler({ 106 type: 'accordion', 107 toggleSelf: true, 108 onClickBefore: function() { 109 if (!$(this).parent().hasClass('open')) { 110 $(this).closest('.accordion').find('.open').removeClass('open'); 111 } 112 }, 113 }); 114 if (inp !== null) inp.addEventListener('input', function() { validateEmailInput(this);}); 115 $(".navbar-toggle").click(function() { 116 if ($(this).hasClass('collapsed')) { 117 $('body').addClass('overlay'); 118 } else { 119 $('body').removeClass('overlay'); 120 } 121 }) 122 const cards = document.querySelectorAll(".card-1 p"); 123 cards.forEach(p => observer.observe(p)); 124 let sel = once('select','.ng-footer select, .b-subscribe select, .b-lp-ue select,.panel-filters select, .description-panel select'); 125 $(sel).select({ 126 classCopy: 'required error', 127 }); 128 // check dark-theme 129 const mq = window.matchMedia('(prefers-color-scheme: dark)'); 130 function apply(e) { 131 let el = document.querySelector('gmp-place-autocomplete'); 132 if (el) { 133 el.Dg.style.fontSize = '16px'; 134 //el.Dg.style.color = '#000'; 135 } 136 137 if (e.matches && el) { 138 //document.body.classList.add('dark-mode'); 139 el.style.colorScheme = 'light'; 140 el.setAttribute('data-theme', 'light'); 141 el.setAttribute('data-color-scheme', 'light'); 142 el.style.setProperty('background-color', '#fff', 'important'); 143 el.style.setProperty('color', '#000', 'important'); 144 }; 145 } 146 apply(mq); 147 if (typeof mq.addEventListener === 'function') { 148 mq.addEventListener('change', apply); 149 } else if (typeof mq.addListener === 'function') { 150 mq.addListener(apply); 151 } 152 153 observer2.observe(document.body, { childList: true, subtree: true }); 154 const mapsElements = ['gmp-map', 'gmp-place-autocomplete'];
155 mapsElements.forEach(tag => { 156 document.querySelectorAll(tag).forEach(el => { 157 console.log(el); 158 }); 159 }); 160 const $mh = $(once('mh', '.match-height')); 161 if ( $mh.length > 0 ) { $mh.matchHeight({ byRow: true,})}; 162 }); 163 $(document).ajaxComplete(function (){ 164 let sel1 = once('select','.webform-submission-form select'); 165 $(sel1).select({ 166 allLabel: true, 167 classCopy: 'required error', 168 search: 'filter', 169 onSelectChanged: function() { 170 var $cl = $(this).closest('.wrap-sb').find('label'), ind = $(this).index(); 171 if ( ind === 0 ) { $cl.removeClass('has-value'); 172 } else { 173 $cl.addClass('has-value'); 174 } 175 }, 176 }); 177 var inp = document.getElementById("edit-email"); 178 if ( inp !== null) inp.addEventListener('input', function() { validateEmailInput(this);}); 179 let sel = once('select','.ng-footer select, .b-subscribe select, .b-lp-ue select,.panel-filters select'); 180 $(sel).select({ 181 classCopy: 'required error', 182 }); 183 }); 184 185})(jQuery, Drupal); 186
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.