1(function () { 2 function processNumberInput(input) { 3 if (!input || input.dataset.numberValidation === "true") { 4 return; 5 } 6 7 input.dataset.numberValidation = "true"; 8 9 const form = input.closest("form"); 10 11 const countrySelect = form 12 ? form.querySelector('select[name="countryCode"]') 13 : null; 14 15 function getCountryCode() { 16 return countrySelect 17 ? countrySelect.value.trim() 18 : null; 19 } 20 21 function isIndia() { 22 if (countrySelect) { 23 const code = getCountryCode(); 24 25 return code === "+91" || code === "91"; 26 } 27 28 return input.value 29 .replace(/\D/g, "") 30 .startsWith("91"); 31 } 32 33 function removeMaxLength() { 34 if (input.hasAttribute("maxlength")) { 35 input.removeAttribute("maxlength"); 36 } 37 38 try { 39 input.maxLength = -1; 40 } catch (e) {} 41 } 42 43 function processValue(value) { 44 value = value.replace(/\D/g, ""); 45 46 if (countrySelect && !isIndia()) { 47 return value; 48 } 49 50 if (value.startsWith("91")) { 51 return value.substring(0, 12); 52 } 53 54 return value.substring(0, 10); 55 } 56 57 function updateInput() { 58 removeMaxLength(); 59 60 const value = input.value.replace(/\D/g, ""); 61 62 if (countrySelect && !isIndia()) { 63 input.removeAttribute("pattern"); 64 return; 65 } 66 67 if (value.startsWith("91")) { 68 input.removeAttribute("pattern"); 69 } else { 70 input.setAttribute( 71 "pattern", 72 "[6-9][0-9]{9}" 73 ); 74 } 75 } 76 77 function handleValue() { 78 removeMaxLength(); 79 80 const currentValue = input.value; 81 82 const processedValue = processValue(currentValue); 83 84 if (currentValue !== processedValue) { 85 input.value = processedValue; 86 } 87 88 updateInput(); 89 } 90 91 input.addEventListener("input", handleValue); 92 input.addEventListener("change", handleValue); 93 input.addEventListener("blur", handleValue); 94 input.addEventListener("focus", handleValue); 95 96 input.addEventListener("paste", function (event) { 97 event.preventDefault(); 98 99 let value = ""; 100 101 if (event.clipboardData) { 102 value = event.clipboardData.getData("text"); 103 } 104 105 value = processValue(value); 106 107 input.value = value; 108 109 updateInput(); 110 111 input.dispatchEvent( 112 new Event("input", { 113 bubbles: true 114 }) 115 ); 116 }); 117 118 if (countrySelect) { 119 countrySelect.addEventListener( 120 "change", 121 function () { 122 handleValue(); 123 } 124 ); 125 } 126 127 handleValue(); 128 129 let checks = 0; 130 131 const autofillChecker = setInterval(function () { 132 checks++; 133 134 if ( 135 !document.body.contains(input) || 136 checks > 30 137 ) { 138 clearInterval(autofillChecker); 139 return; 140 } 141 142 if (input.value) { 143 handleValue(); 144 clearInterval(autofillChecker); 145 } 146 }, 250); 147 148 const attributeObserver = new MutationObserver( 149 function () { 150 if (input.hasAttribute("maxlength")) { 151 input.removeAttribute("maxlength"); 152 } 153 154 const value = input.value 155 .replace(/\D/g, ""); 156 157 if (value.startsWith("91")) { 158 if (input.hasAttribute("pattern")) { 159 input.removeAttribute("pattern"); 160 } 161 } 162 } 163 ); 164 165 attributeObserver.observe(input, { 166 attributes: true, 167 attributeFilter: [ 168 "maxlength", 169 "pattern" 170 ] 171 }); 172 } 173 174 function initNumberInputs() { 175 const inputs = document.querySelectorAll( 176 'input[name="number"]' 177 ); 178
179 inputs.forEach(function (input) { 180 processNumberInput(input); 181 }); 182 } 183 184 if (document.readyState === "loading") { 185 document.addEventListener( 186 "DOMContentLoaded", 187 initNumberInputs 188 ); 189 } else { 190 initNumberInputs(); 191 } 192 193 let observerTimer = null; 194 195 const bodyObserver = new MutationObserver( 196 function () { 197 clearTimeout(observerTimer); 198 199 observerTimer = setTimeout( 200 function () { 201 initNumberInputs(); 202 }, 203 200 204 ); 205 } 206 ); 207 208 function startObserver() { 209 if (!document.body) { 210 setTimeout(startObserver, 100); 211 return; 212 } 213 214 bodyObserver.observe(document.body, { 215 childList: true, 216 subtree: true 217 }); 218 } 219 220 startObserver(); 221})(); 222
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.