PageSourceSearch

https://speedio.com.br/assets/js/verifica_telefone.js

js speedio.com.br collected 2026-09-24 12:07:09 UTC 2,286 bytes, 75 lines download raw bytes

1
2        
3function handleBlur(event) {
4
5    const inputElement = event.target;
6    const valorTelefone = event.target.value;
7    const telefoneSoNumero = removeNonNumeric(valorTelefone);
8    const qtdDigitos = telefoneSoNumero.length;
9
10    // var msgSpan = document.getElementById('span-msg-numero');
11    // console.log('---------------');
12    // console.log('Valor do telefone:', valorTelefone);
13    // console.log('---------------');
14
15    // Encontrar o <span> correspondente ao <input> atual
16    const msgSpan = Array.from(inputElement.parentNode.querySelectorAll('.msg-valida-numero'))
17                            .find(span => span.previousElementSibling === inputElement);
18
19    if (!msgSpan) {
20            console.error('<span> não encotrado.');
21        return;
22    }
23
24    if (qtdDigitos === 10 || qtdDigitos === 11) {
25        // console.log('Nacional');
26
27        const ddd = telefoneSoNumero.substring(0, 2);
28        const numeroTel = telefoneSoNumero.substring(2);
29        const urlValidaTel = "https://new-integracoes.speedio.com.br/webhook/6be3c19e-ef16-4d81-8c9c-fd8b3f3b5ab1";
30
31        const data = {
32            ddd: ddd,
33            telefone: numeroTel
34        };
35
36        // console.log(data);
37
38        // Fazendo a requisição POST
39        fetch(urlValidaTel, {
40            method: 'POST',
41            headers: {
42                'Content-Type': 'application/json'
43            },
44            body: JSON.stringify(data)
45        })
46        .then(response => response.json())
47        .then(data => {
48            // console.log('Resposta do servidor:', data);
49            console.log(data.phoneExists);
50
51            if (data.phoneExists === false) {
52                // Numero NÃO existe na base
53                msgSpan.textContent = 'Verifique seu número antes de enviar.';
54            } else {
55                // Numero EXISTE na base
56                msgSpan.textContent = '';
57            }
58        })
59        .catch((error) => {
60            console.error('Erro:', error);
61        });
62
63    } else {
64        // console.log('Internacional');
65        msgSpan.textContent = '';
66    }
67}
68
69function removeNonNumeric(str) {
70    return str.replace(/\D/g, '');
71}
72
73document.querySelectorAll('.validaTelefone').forEach(input => {
74    input.addEventListener('blur', handleBlur);
75});

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.