1const refreshCaptcha =() => { 2 if (typeof window.captcha_image_audioObj !== 'undefined') captcha_image_audioObj.refresh(); 3 const captcha_image = document.getElementById('captcha_image'); 4 const captcha = document.getElementById('captcha'); 5 captcha.value=''; 6 captcha_image.src = '../../core/securimage/securimage_show.php?' + Math.random(); 7 captcha_image.blur(); 8 return false; 9} 10 11var conteudocapt = 0; 12 13document.getElementById('captcha_refresh_btn').addEventListener('click', ()=>{refreshCaptcha()},false); 14 15 16/* Funções script */ 17function pesquisar(refazer, inicio, final) 18{ 19 let tab = document.getElementById('formulario'); 20 let campos; 21 22 if(refazer) 23 { 24 campos = tab.dataset.strpesquisa; 25 campos += "&inicio="+inicio+"&final="+final; 26 campos += "&capt="+conteudocapt; 27 } 28 else 29 { 30 campos = document.querySelector('#formulario'); 31 inicio = 1; 32 final = 50; 33 capt = conteudocapt; 34 } 35 36 37 let xhr = ajax('POST', 'carrega-cep-endereco.php', campos, function(json) 38 { 39 try 40 { 41 let r = JSON.parse(json); 42 if(!r.erro) 43 { 44 conteudocapt = 1; 45 tab.parentNode.classList.add("esconde"); 46 let t = document.getElementById('resultado-DNEC'); 47 let mensagem_resultado = "<h5>" + 'Resultado da Busca por Endereço ou CEP' + "\</h5>"; 48 titulo_tela.classList.add("esconde"); 49 50 //ATENÃÃO! O CEP 12345-678 FOI ALTERADO CONFORME ABAIXO. 51 let mensagem_resultado_alerta = ''; 52 if(r.mensagem && r.mensagem != 'DADOS ENCONTRADOS COM SUCESSO.') 53 { 54 mensagem_resultado_alerta = "<h6>" + r.mensagem + "\</h6>"; 55 } 56 57 /* 58 if(r.mensagem && r.mensagem != 'DADOS ENCONTRADOS COM SUCESSO.') 59 { 60 mensagem_resultado += "<h6>" + r.mensagem + "</h6>"; 61 } 62 */ 63 64 if(r.total < 1) 65 { 66 mensagem_resultado = 'Não há dados a serem exibidos'; 67 } 68 botaovolta.classList.remove("esconde"); 69 70 if(r.total >= 1000) 71 { 72 //RESULTADO SUPERIOR A 1000 REGISTROS. INFORME A UF/CIDADE/BAIRRO/ENDEREÃO PARA REFINAR SUA CONSULTA. 73 mensagem_resultado = "<h5>" + 'Resultado da Busca por Endereço ou CEP superior a 1000 registros.' + "\<br>" + 'Informe a UF/Cidade/Bairro/Endereço para refinar sua consulta' + "\</h5>"; 74 } 75 76 document.getElementById('mensagem-resultado').innerHTML = mensagem_resultado; 77 document.getElementById('mensagem-resultado').hidden = false; 78 79 if(mensagem_resultado_alerta != '' && r.total < 1000) 80 { 81 document.getElementById('mensagem-resultado-alerta').hidden = false; 82 document.getElementById('mensagem-resultado-alerta').innerHTML = mensagem_resultado_alerta; 83 } 84 85 let botaoAnterior = document.querySelector(".botao.anterior");
86 let botaoProximo = document.querySelector(".botao.proximo"); 87 botaoAnterior.classList.remove("esconde"); 88 botaoProximo.classList.remove("esconde"); 89 90 if(final>=r.total) 91 { 92 final = r.total; 93 botaoProximo.classList.add("esconde"); 94 } 95 if(inicio <= 1) 96 { 97 inicio = 1; 98 botaoAnterior.classList.add("esconde"); 99 } 100 let total = r.total; 101 if (final != null && total >= 1) 102 { 103 document.getElementById('navegacao-total').hidden = false; 104 document.getElementById('navegacao-total').innerHTML=inicio + " a "+ final + " de " + r.total; 105 popular_grid_endereco_cep(t, r.dados); 106 t.dataset.inicio = inicio; 107 t.dataset.final = final; 108 } 109 //Botão Nova Busca 110 botaovolta.classList.remove("esconde"); 111 } 112 else 113 { 114 document.getElementById('mensagem_alerta').value = r.mensagem; 115 document.getElementById('mensagem_alerta').click(); 116 document.getElementById("captcha").focus(); 117 118 } 119 } 120 catch (e) 121 { 122 document.getElementById('mensagem_alerta').value = e; 123 document.getElementById('mensagem_alerta').click(); 124 } 125 }); 126 127 128 129 if(!refazer) 130 { 131 tab.dataset.strpesquisa = xhr.qrystring; 132 } 133} 134 135function pesquisarAnterior() 136{ 137 let tab = document.getElementById('resultado-DNEC'); 138 pesquisar(true, tab.dataset.inicio*1-50, tab.dataset.inicio*1-1); 139} 140 141function pesquisarProximo() 142{ 143 let tab = document.getElementById('resultado-DNEC'); 144 pesquisar(true, tab.dataset.final*1+1, tab.dataset.final*1+50); 145} 146 147 148function pesquisarVoltar() 149{ 150 let tab = document.getElementById('formulario'); 151 tab.parentNode.classList.remove("esconde"); 152 tab = document.getElementById('resultado-DNEC'); 153 tab.parentNode.classList.add("esconde"); 154 tab = document.getElementById('mensagem-resultado'); 155 tab.parentNode.classList.add("esconde"); 156} 157 158function remove_linhas(t) 159{ 160 while(t.rows.length > 1) 161 { 162 t.deleteRow(1); 163 } 164} 165 166function popular_grid_endereco_cep(tabela, dados) 167{ 168 remove_linhas(tabela); 169 tabela.parentNode.classList.remove("esconde"); 170 171 let headerRow = tabela.rows[0]; 172 let tbody = tabela.tBodies[0]; 173 for (let chave in dados) 174 { 175 let row = tbody.insertRow(tbody.rows.length); 176 177 let cell0 = row.insertCell(0); 178 let cell1 = row.insertCell(1); 179 let cell2 = row.insertCell(2); 180 let cell3 = row.insertCell(3); 181 182 if(headerRow) 183 { 184 cell0.dataset.th = headerRow.cells[0].dataset.th; 185 cell1.dataset.th = headerRow.cells[1].dataset.th; 186 cell2.dataset.th = headerRow.cells[2].dataset.th; 187 cell3.dataset.th = headerRow.cells[3].dataset.th; 188 } 189 let logradouroNome = dados[chave].logradouroDNEC; 190 if(dados[chave].tipoCep > 2) 191 { 192 logradouroNome = "<a onclick=\"selecionarCep('"+dados[chave].cep+"')\">"; 193 194 if(dados[chave].tipoCep == 3) 195 { 196 logradouroNome = logradouroNome + dados[chave].nomeUnidade; 197 } 198 else if(dados[chave].tipoCep == 4) 199 { 200 logradouroNome = logradouroNome + dados[chave].logradouroDNEC + "<br/>CPC " + dados[chave].nomeUnidade; 201 } 202 else 203 { 204 logradouroNome = logradouroNome + dados[chave].logradouroDNEC + "<br/>" + dados[chave].nomeUnidade; 205 } 206 logradouroNome = logradouroNome + "</a>" 207 } 208 cell0.innerHTML = logradouroNome; 209 let bairro = dados[chave].bairro;
210 let localidade = dados[chave].localidade + "/" + dados[chave].uf; 211 212 if (dados[chave].tipoCep == 1 && dados[chave].localidadeSubordinada.length > 0){ 213 bairro = dados[chave].localidade; 214 localidade = dados[chave].localidadeSubordinada + "/" + dados[chave].uf; 215 } else if ((dados[chave].tipoCep == 5 || dados[chave].tipoCep == 6) && dados[chave].localidadeSubordinada.length > 0){ 216 bairro = dados[chave].bairro + "/" + dados[chave].localidade; 217 localidade = dados[chave].localidadeSubordinada + "/" + dados[chave].uf; 218 } 219 cell1.innerHTML = bairro; 220 cell2.innerHTML = localidade; 221 cell3.innerHTML = dados[chave].cep.substring(0, 5) + "-" + dados[chave].cep.substring(5, 8); 222 } 223} 224 225function selecionarCep(cep) 226{ 227 document.getElementById('cepaux').value = cep; 228 document.getElementById('btn_abre_modal').click(); 229} 230 231function voltar() 232{ 233 document.location = 'index.php'; 234} 235 236function pesquisa_url() 237{ 238 pesquisar(); 239} 240 241window.onload = function() { 242 document.getElementById("endereco").focus(); 243};
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.