PageSourceSearch

https://desouzaleiloes.com.br/v3/js/vlance/firebase/container-perfilleiloeiro.js

js desouzaleiloes.com.br collected 2026-09-27 02:25:48 UTC 7,896 bytes, 174 lines download raw bytes

1document.addEventListener('DOMContentLoaded', async function () {
2    if (window.location.href.includes('index/quem-somos')) {
3        try {
4            const container = document.getElementById('leiloeiro-info');
5            if (!container) {
6                throw new Error('Elemento com id "leiloeiro-info" não encontrado.');
7            }
8
9            const response = await fetch('/usuario/listar-perfil-leiloeiro');
10
11            if (!response.ok) {
12                throw new Error('Erro ao buscar os dados da API');
13            }
14
15            const data = await response.json();
16
17            let leiloeiro;
18
19            if (Array.isArray(data) && data.length > 0) {
20                leiloeiro = data[0];
21            } else if (data && !Array.isArray(data) && data.nm) {
22                leiloeiro = data;
23            }
24
25            if (!leiloeiro) {
26                console.log('Nenhum leiloeiro encontrado ou formato de dados inesperado:', data);
27                return;
28            }
29
30            let leiloeiroUrl = leiloeiro.nm_url;
31
32            if (leiloeiroUrl && !leiloeiroUrl.startsWith('http://') && !leiloeiroUrl.startsWith('https://')) {
33                const protocol = window.location.protocol;
34                leiloeiroUrl = `${protocol}//${leiloeiroUrl}`;
35            }
36
37            function getYouTubeId(url) {
38                if (!url) return null;
39
40                if (url.includes('youtube.com/embed/')) {
41                    return url.split('/embed/')[1].split(/[?&]/)[0];
42                }
43
44                const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=|shorts\/)([^#&?]*).*/;
45                const match = url.match(regExp);
46                return (match && match[2].length === 11) ? match[2] : null;
47            }
48
49            function extrairUFDaJunta(juntaStr) {
50                if (!juntaStr) return 'ZZ';
51                const str = juntaStr.toUpperCase();
52
53                if (str.includes('JUCEAC')) return 'AC';
54                if (str.includes('JUCEAL')) return 'AL';
55                if (str.includes('JUCEAP')) return 'AP';
56                if (str.includes('JUCEA')) return 'AM';
57                if (str.includes('JUCEB')) return 'BA';
58                if (str.includes('JUCEC')) return 'CE';
59                if (str.includes('JUCIS-DF') || str.includes('JUCIS DF') || str.includes('JUCISDF')) return 'DF';
60                if (str.includes('JUCEES')) return 'ES';
61                if (str.includes('JUCEG')) return 'GO';
62                if (str.includes('JUCEMA')) return 'MA';
63                if (str.includes('JUCEMG')) return 'MG';
64                if (str.includes('JUCEMS')) return 'MS';
65                if (str.includes('JUCEMAT')) return 'MT';
66                if (str.includes('JUCEPAR')) return 'PR';
67                if (str.includes('JUCEPA')) return 'PA';
68                if (str.includes('JUCEP')) return 'PB';
69                if (str.includes('JUPEB')) return 'PE';
70                if (str.includes('JUCEPI')) return 'PI';
71                if (str.includes('JUCERJA')) return 'RJ';
72                if (str.includes('JUCERN')) return 'RN';
73                if (str.includes('JUCERR')) return 'RR';
74                if (str.includes('JUCER')) return 'RO';
75                if (str.includes('JUCISRS') || str.includes('JUCIS-RS') || str.includes('JUCIS RS')) return 'RS';
76                if (str.includes('JUCESC')) return 'SC';
77                if (str.includes('JUCESE')) return 'SE';
78                if (str.includes('JUCESP')) return 'SP';
79                if (str.includes('JUCETINS')) return 'TO';
80
81                const match = str.match(/\b(AC|AL|AP|AM|BA|CE|DF|ES|GO|MA|MG|MS|MT|PA|PB|PE|PI|PR|RJ|RN|RO|RR|RS|SC|SE|SP|TO)\b/);
82                if (match) return match[1];
83
84                return 'ZZ';
85            }
86
87            let estadosAtuacaoText = '';
88            if (leiloeiro.matriculas && Array.isArray(leiloeiro.matriculas)) {
89                leiloeiro.matriculas.sort((a, b) => {
90                    let ufA = extrairUFDaJunta(a.nu_matricula);
91                    let ufB = extrairUFDaJunta(b.nu_matricula);
92
93                    if (ufA === 'ZZ' && a.estado_uf) ufA = a.estado_uf.toUpperCase();
94                    if (ufB === 'ZZ' && b.estado_uf) ufB = b.estado_uf.toUpperCase();
95
96                    return ufA.localeCompare(ufB);
97                });
98
99                const ufs = leiloeiro.matriculas.map(m => {
100                    return m.estado_uf ? m.estado_uf.toUpperCase() : null;
101                }
101).filter(Boolean);
102
103                estadosAtuacaoText = [...new Set(ufs)].sort().join(', ');
104            }
105
106            let videoHtml = '';
107            const youtubeId = getYouTubeId(leiloeiro.nm_urlyoutube);
108            if (youtubeId) {
109                videoHtml = `
110                    <div class="leiloeiro-video-wrapper">
111                        <iframe 
112                            src="https://www.youtube.com/embed/${youtubeId}" 
113                            title="Vídeo de Apresentação do Leiloeiro" 
114                            frameborder="0" 
115                            allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" 
116                            allowfullscreen>
117                        </iframe>
118                    </div>
119                `;
120            }
121
122            container.innerHTML = `
123                <div id="leiloeiro-profile-info">
124                    <div id="leiloeiro-container-imagem">
125                        <img
126                            src="${leiloeiro.img_path}"
127                            id="leiloeiro-about-image"
128                            class="img-fluid avatar"
129                            alt="${leiloeiro.nm_tituloparadocumentos}"
130                        >
131                    </div>
132                    <div id="leiloeiro-content-profile">
133                        <h1 id="leiloeiro-profile-name">${leiloeiro.nm}</h1>
134                        <p id="leiloeiro-profile-text">${leiloeiro.nm_descricao || ''}</p>
135                       
136                        <ul id="leiloeiro-profile-list">
137                            ${leiloeiroUrl ? `<li><strong>Site:</strong><a id="leiloeiro-profile-url" target="_blank" href="${leiloeiroUrl}">${leiloeiro.nm_url}</a></li>` : ''}
138                            <li><strong>Estados de atuação:</strong><span id="span-leiloeiro-perfil">${estadosAtuacaoText}</span></li>
139                        </ul>
140                    </div>
141                </div>
142            `;
143
144            if (leiloeiro.matriculas && leiloeiro.matriculas.length > 0) {
145                let tituloMatriculas = 'Confira as Matrículas do(a) Leiloeiro(a):';
146                if (leiloeiro.nm_sexo === 'M') {
147                    tituloMatriculas = 'Confira as Matrículas do Leiloeiro:';
148                } else if (leiloeiro.nm_sexo === 'F') {
149                    tituloMatriculas = 'Confira as Matrículas da Leiloeira:';
150                }
151
152                const matriculasHTML = `
153                    <div id="leiloeiro-titulo-matriculas">
154                        <h2 id="h2-matriculas">${tituloMatriculas}</h2>
155                    </div>
156                    <div id="matriculas">
157                        ${leiloeiro.matriculas.map(matricula => `
158                            <a id="url-matricula" target="_blank" href="${matricula.url_matricula}">
159                                <span>${matricula.nu_matricula}</span>
160                            </a>
161                        `).join('')}
162                    </div>
163                `;
164                container.innerHTML += matriculasHTML;
165                container.innerHTML += videoHtml;
166            } else {
167                container.innerHTML += '<p id="no-matriculas">Nenhuma matrícula encontrada.</p>';
168                container.innerHTML += videoHtml;
169            }
170        } catch (error) {
171            console.error('Erro:', error);
172        }
173    }
174});

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.