1function setupIntlPhoneInput(fieldId, prefill,unavailable) { 2 const input = $("#" + fieldId); 3 const inputEl = document.getElementById(fieldId); 4 const inputcountry = $("#" + fieldId + "_country"); 5 6 let countryCode = 'us'; 7 let fullNumber = ''; 8 9 if (prefill && typeof prefill === 'string') { 10 const match = prefill.match(/^([A-Z]{2})\+(\d+)$/); 11 if (match) { 12 countryCode = match[1].toLowerCase(); 13 fullNumber = "+" + match[2]; 14 } 15 } 16 17 // Unavailable countries from Blade (e.g., ["IN", "PK"]) 18 const excludeCountries = unavailable; 19 20 // Initialize intl-tel-input and keep the instance 21 const iti = window.intlTelInput(inputEl, { 22 initialCountry: countryCode, 23 separateDialCode: true, 24 excludeCountries: excludeCountries 25 }); 26 27 // const iti = window.intlTelInputGlobals.getInstance(inputEl); 28 if (fullNumber) { 29// iti.setNumber(fullNumber); 30 const data = iti.getSelectedCountryData(); 31 inputcountry.val(data.iso2.toUpperCase() + "+" + data.dialCode); 32 } else { 33 const data = iti.getSelectedCountryData(); 34 inputcountry.val(data.iso2.toUpperCase() + "+" + data.dialCode); 35 } 36 37 input.on("countrychange", function () { 38 // const iti = window.intlTelInputGlobals.getInstance(inputEl); 39 if (iti && typeof iti.getSelectedCountryData === "function") { 40 const data = iti.getSelectedCountryData(); 41 inputcountry.val(data.iso2.toUpperCase() + "+" + data.dialCode); 42 } 43 }); 44}
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.