https://atcaviacao.com.br/wp-content/plugins/vverner-atc/assets/js/kommo-public.js?ver=6ac9751719256
1jQuery(function ($) { 2 const $form = $(".kommo-form"); 3 4 if (!$form.length) { 5 return; 6 } 7 8 const cleanDDI = function (val) { 9 if (!val) return ""; 10 let digits = val.replace(/\D/g, ""); 11 if (digits.length > 11 && digits.startsWith("55")) { 12 digits = digits.substring(2); 13 } else if (digits.length > 11 && digits.startsWith("0")) { 14 digits = digits.substring(1); 15 } 16 return digits; 17 }; 18 19 const phoneMaskBehavior = function (val) { 20 const digits = cleanDDI(val); 21 return digits.length === 11 ? "(00) 00000-0000" : "(00) 0000-00009"; 22 }; 23 24 const $phoneInput = $form.find("#customer_phone"); 25 26 $phoneInput.on("input paste change blur", function () { 27 const rawVal = $(this).val(); 28 if (!rawVal) return; 29 const digits = rawVal.replace(/\D/g, ""); 30 if (digits.length > 11 && (digits.startsWith("55") || digits.startsWith("0"))) { 31 const cleaned = cleanDDI(rawVal); 32 $(this).val(cleaned).trigger("input.mask"); 33 } 34 }); 35 36 $phoneInput.mask(phoneMaskBehavior, { 37 clearIfNotMatch: true, 38 onKeyPress: function (val, e, field, options) { 39 const cleaned = cleanDDI(val); 40 if (cleaned !== val.replace(/\D/g, "")) { 41 field.val(cleaned); 42 } 43 field.mask(phoneMaskBehavior(cleaned), options); 44 }, 45 }); 46 47 $form.on("submit", function (e) { 48 e.preventDefault(); 49 50 const $currentForm = $(this); 51 const $btn = $currentForm.find('button[type="submit"]'); 52 const $alert = $currentForm.find(".kommo-form__alert"); 53 const originalBtnText = $btn.text(); 54 const redirectUrl = $currentForm.data("redirect"); 55 56 $alert.removeClass("kommo-form__alert--success kommo-form__alert--error").hide().text(""); 57 $btn.attr("disabled", "disabled").text("Enviando..."); 58 59 $.post(ATC_KOMMO.ajaxUrl, $currentForm.serialize(), function (response) { 60 $btn.removeAttr("disabled").text(originalBtnText); 61 62 if (response && response.success) { 63 $alert 64 .addClass("kommo-form__alert--success") 65 .text(response.data || "Cadastro realizado com sucesso!") 66 .show(); 67 $currentForm[0].reset(); 68 69 if (redirectUrl) { 70 window.location.href = redirectUrl; 71 } 72 } else { 73 $alert 74 .addClass("kommo-form__alert--error") 75 .text((response && response.data) ? response.data : "Ocorreu um erro ao enviar. Tente novamente.") 76 .show(); 77 } 78 }).fail(function () { 79 $btn.removeAttr("disabled").text(originalBtnText); 80 $alert 81 .addClass("kommo-form__alert--error") 82 .text("Erro de conexão com o servidor. Tente novamente.") 83 .show(); 84 }); 85 }); 86});
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.