1document.addEventListener('DOMContentLoaded', function () { 2 3 4 // Function to get query parameters 5 function getQueryParam(name) { 6 const urlParams = new URLSearchParams(window.location.search); 7 return urlParams.get(name); 8 } 9 10 function UpdateEmailPhone(){ 11 const inputField = document.querySelector('#input_5_5'); 12 13 14 if (inputField) { 15 inputField.addEventListener('input', function () { 16 const inputValue = inputField.value; 17 18 const baseUrl = `${window.location.origin}${window.location.pathname}`; 19 20 21 const newUrl = `${baseUrl}?EmailPhone=${encodeURIComponent(inputValue)}`; 22 23 24 window.history.pushState(null, '', newUrl); 25 26 27 }); 28 } 29 } 30 31 function ShowAddress(){ 32 const add1 = document.getElementById("input_5_42_2_container"); 33 const add2 = document.getElementById("input_5_42_3_container"); 34 document.getElementById('input_5_42_1').addEventListener('blur', function () { 35 36 37 add1.classList.add('show'); 38 add2.classList.add('show'); 39 40 }); 41 } 42 43 document.addEventListener('DOMContentLoaded', passEmail); 44 45 46// Helper function to retrieve query parameter 47function getQueryParam(param) { 48 const urlParams = new URLSearchParams(window.location.search); 49 return urlParams.get(param); 50} 51 52// Helper function to remove query parameter 53function removeQueryParam(param) { 54 const url = new URL(window.location.href); 55 url.searchParams.delete(param); 56 window.history.replaceState(null, '', url.toString()); 57} 58 59function isValidEmail(value) { 60 return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value); 61} 62 63function passEmail() { 64 const emailField = document.getElementById('input_5_74'); 65 66 const params = new URLSearchParams(window.location.search); 67 const emailParam = params.get('EmailPhone'); 68 69 if (emailField && emailParam && isValidEmail(emailParam)) { 70 emailField.value = decodeURIComponent(emailParam); 71 72 emailField.dispatchEvent(new Event('input', { bubbles: true })); 73 emailField.dispatchEvent(new Event('change', { bubbles: true })); 74 } 75 76 if (emailField && !emailField.dataset.listenerAdded) { 77 emailField.addEventListener('input', function () { 78 const inputValue = emailField.value; 79 80 const urlParams = new URLSearchParams(window.location.search); 81 urlParams.set('EmailPhone', inputValue); 82 83 const newUrl = `${window.location.origin}${window.location.pathname}?${urlParams.toString()}`; 84 85 window.history.replaceState(null, '', newUrl); 86 }); 87 88 emailField.dataset.listenerAdded = "true"; 89 } 90} 91 92 93function passNumberNew() { 94 95 96 97 function updateQueryParam(param, value) { 98 const urlParams = new URLSearchParams(window.location.search); 99 urlParams.set(param, value); 100 const newUrl = `${window.location.origin}${window.location.pathname}?${urlParams.toString()}`; 101 window.history.pushState(null, '', newUrl); 102 } 103 104 105 function handlePhoneField(inputField) { 106 const emailPhoneParam = getQueryParam('EmailPhone'); 107 const phoneParam = getQueryParam('Phone'); 108 109 if (inputField) { 110 111 if (phoneParam) { 112 inputField.value = phoneParam; 113 } 114 115 else if (emailPhoneParam && /^\d+$/.test(emailPhoneParam)) { 116 inputField.value = emailPhoneParam; 117 118 119 const isValidPhone = /^\d{10}$/.test(emailPhoneParam); 120 if (isValidPhone) { 121 updateQueryParam('Phone', emailPhoneParam); 122 } 123 } 124 125 126 inputField.addEventListener('input', function () { 127 const inputValue = inputField.value; 128 129 130 const isNumeric = /^\d+$/.test(inputValue); 131 if (isNumeric) { 132 updateQueryParam('Phone', inputValue); 133 } 134 }); 135 } 136 } 137 138 // Handle both phone fields 139 const phoneField1 = document.getElementById('input_5_50'); 140 const phoneField2 = document.getElementById('input_5_47'); 141 142 handlePhoneField(phoneField1); 143 handlePhoneField(phoneField2); 144} 145 146 147 148 function passTextNumberlast() { 149 const emailPhone = getQueryParam('EmailPhone'); 150 const phoneField = document.getElementById('input_5_56'); 151 152 153 154 155 const validPhone = /^\d{10}$/.test(emailPhone); 156 const num = /^\d+$/.test(emailPhone); 157 158 if (phoneField && validPhone) { 159 phoneField.value = emailPhone; 160 161 162 163 164 } else if (num) { 165 phoneField.value = emailPhone; 166 } 167 168 169 if (phoneField) { 170 phoneField.addEventListener('input', function () { 171 const inputValue = phoneField.value; 172 173 174 const baseUrl = `${window.location.origin}${window.location.pathname}`; 175 const newUrl = `${baseUrl}?EmailPhone=${encodeURIComponent(inputValue)}`; 176 177 178 window.history.pushState(null, '', newUrl); 179 }); 180 } 181 } 182 183 184 185 // Listen for Gravity Forms AJAX page load events 186 jQuery(document).on('gform_page_loaded', function (event, formId, currentPage) { 187 if (parseInt(formId, 10) === 5) { 188 ShowAddress(); 189 UpdateEmailPhone(); 190 passEmail(); 191 passTextNumberlast(); 192 passNumberNew(); 193 } 194 195 196 197 }); 198 199}); 200 201// Target the email input field 202jQuery(document).on('input', 'input[type="email"]', function() { 203 var emailField = jQuery(this); 204 var emailValue = emailField.val(); 205 var wrapper = emailField.closest('.tf-form'); 206 207 // Check if the email contains "@" 208 if (emailValue.includes("@")) { 209 emailField.addClass("has-at-symbol"); 210 wrapper.addClass("wrapper-has-at"); 211 } else { 212 emailField.removeClass("has-at-symbol"); 213 wrapper.removeClass("wrapper-has-at"); 214 } 215}); 216 217jQuery(document).ready(function($) { 218 $('.bt-tab-item:first-child a').addClass('active'); 219 $('.bt-content-tab-item').hide(); 220 $('.bt-content-tab-item:first-child').show(); 221 222 223 $('.bt-tab-item a').click(function(e) { 224 e.preventDefault(); 225 226 var tabId = $(this).data('id'); 227 228 229 $('.bt-tab-item a').removeClass('active'); 230 $(this).addClass('active'); 231 232 $('.bt-content-tab-item').hide(); 233 $('.bt-content-tab-item#' + tabId).show(); 234 }); 235});
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.