PageSourceSearch

https://somoscooperativismo-ba.coop.br/assets/js/conteudos.js

js somoscooperativismo-ba.coop.br collected 2026-10-08 10:59:58 UTC 22,217 bytes, 549 lines download raw bytes

1$ = jQuery.noConflict();
2
3$(document).ready(function () {
4
5    chamarCSS();
6    gerarTagDestaque();
7    reposicionarItensMeta();
8    alterarItensArtigoListado();
9    alterarItensArtigosListados();
10    delimitarEspacoSubtitulosCarouselNoticias();
11    alterarIconeBotaoPrev();
12    alterarIconeBotaoNext();
13    incluirIconesDataHora();
14
15    incluirLinkSaibaMaisCarousel();
16    incluirBotaoSaibaMaisBoxEventoSeparado();
17    incluirBotaoSaibaMaisBoxEventos();
18    removerItensFieldsContainerBoxPublicacoes();
19    incluirBotaoFacaDownloadArtigoDestaque();
20    incluirBotaoFacaDownloadPublicacoes();
21    removerCamposFiltroConteudos()
22
23    montarDataHoraEventos();
24    montarDataHoraArtigos();
25
26    removerDataCadastroArtigoEventos();
27    montarBotaoSaibaMaisEventos();
28
29    montarDataHoraEventoSeparadoDestaque();
30
31    imagemPadraoArtigosCarouselSemImagem('.carousel-noticias');
32
33    imagemPadraoArtigosBoxesSemImagem('.box-publicacoes');
34    imagemPadraoArtigosBoxesSemImagem('.box-eventos');
35
36    alteraNumeroDeLinhaSeDataEHora();
37
38    function alteraNumeroDeLinhaSeDataEHora() {
39        $('.ramo-destaques .sppb-row-column:nth-child(2) .sppb-article-info-wrap').
40        find('.data-e-hora-evento').
41        next('.sppb-article-introtext').css({
42            "display": "-webkit-box",
43            "-webkit-line-clamp": "2",
44            "overflow": "hidden",
45            "text-overflow": "ellipsis"
46        });
47        $('.ramo-destaques .sppb-row-column:nth-child(3) .sppb-article-info-wrap').
48        find('.data-e-hora-evento').
49        next('.sppb-article-introtext').css({
50            "display": "-webkit-box",
51            "-webkit-line-clamp": "2",
52            "overflow": "hidden",
53            "text-overflow": "ellipsis"
54        });
55    }
56    function chamarCSS() {
57        var protocolo = window.location.protocol;
58        var host = window.location.host;
59
60        var linkCss = protocolo + '//' + host + '/assets/css/conteudos.css';
61
62        $('head').append('<link rel="stylesheet" type="text/css" href="' + linkCss + '">');
63    }
64
65    function gerarTagDestaque() {
66        $('.destaque').before('<div class="tag-destaque">Destaque</div>');
67    }
68
69    function reposicionarItensMeta() {
70        $('.sppb-article-meta').each(function () {
71            var dataPublicacao = $(this).children('.sppb-meta-date');
72            var categoriaArtigo = $(this).children('.sppb-meta-category');
73            $(this).append(categoriaArtigo, dataPublicacao);
74        });
75    }
76
77    function alterarItensArtigoListado() {
78        $('.sppb-article-info-wrap').each(function () {
79            var itensMeta = $(this).children('.sppb-article-img-wrap');
80            var titulo = $(this).children('h3');
81            var texto = $(this).children('.sppb-article-introtext');
82            var campos = $(this).children('.fields-container') !== '' ? $(this).children('.fields-container') : '';
83            $(this).append(itensMeta, titulo, texto, campos)
84
85
86        });
87    }
88
89    function alterarIconeBotaoPrev() {
90        var prevSvg = '<svg id="Grupo_2994" data-name="Grupo 2994" xmlns="http://www.w3.org/2000/svg" width="35.789" height="35.789" viewBox="0 0 35.789 35.789"> < path id = "Caminho_26899" data-name="Caminho 26899" d = "M17.9.4A17.495,17.495,0,1,0,35.39,17.894,17.5,17.5,0,0,0,17.9.4" fill = "none" /> <circle id="Elipse_215" data-name="Elipse 215" cx="17.495" cy="17.495" r="17.495" transform="translate(0.4 0.399)" fill="none" stroke="#5080b9" stroke-linecap="round" stroke-miterlimit="10" stroke-width="0.799"/> <path id="Caminho_26900" data-name="Caminho 26900" d="M21.937,8.343l-9.551,9.551,9.551,9.551" fill="none" stroke="#5080b9" stroke-linecap="round" stroke-miterlimit="10" stroke-width="0.799"/> </svg > ';
91
92        $('.bx-controls-direction').children('.bx-prev').children('i').remove();
93        $('.bx-controls-direction').children('.bx-prev').append('<div class="prev-svg">' + prevSvg + '</div>');
94    }
95
96    function alterarIconeBotaoNext() {
97        var nextSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="35.789" height="35.789" viewBox="0 0 35.789 35.789"><g id="Grupo_2995" data-name="Grupo 2995" transform="translate(-1151.063 -2928.999)">
97 <path id="Caminho_26901" data-name="Caminho 26901" d="M70.927.4a17.495,17.495,0,1,1-17.5,17.495A17.5,17.5,0,0,1,70.927.4" transform="translate(1098.029 2929)" fill="none"/> <circle id="Elipse_216" data-name="Elipse 216" cx="17.495" cy="17.495" r="17.495" transform="translate(1151.462 2929.398)" fill="none" stroke="#5080b9" stroke-linecap="round" stroke-miterlimit="10" stroke-width="0.799"/> <path id="Caminho_26902" data-name="Caminho 26902" d="M66.886,8.343l9.551,9.551-9.551,9.551" transform="translate(1098.029 2929)" fill="none" stroke="#5080b9" stroke-linecap="round" stroke-miterlimit="10" stroke-width="0.799"/></g></svg>';
98
99        $('.bx-controls-direction').children('.bx-next').children('i').remove();
100        $('.bx-controls-direction').children('.bx-next').append('<div class="next-svg">' + nextSvg + '</div>');
101
102    }
103
104    function delimitarEspacoSubtitulosCarouselNoticias() {
105        $('.sppb-articles-carousel-column')
106            .children('.sppb-articles-carousel-content.sppb-text-left')
107            .each(function () {
108
109                var titulo = $(this)
110                    .children('.sppb-articles-carousel-link')
111                    .text();
112
113                var texto = $(this)
114                    .children('.sppb-articles-carousel-introtext')
115                    .text();
116
117                if (titulo.length <= 25) {
118
119                    $(this)
120                        .children('.sppb-articles-carousel-introtext')
121                        .text(limitarTextoArtigo(texto, 150));
122
123                    $(this)
124                        .children('.sppb-articles-carousel-link')
125                        .css('height', '1rem');
126
127                    $(this)
128                        .children('.sppb-articles-carousel-introtext')
129                        .css('height', '8.2rem');
130
131                }
132
133                if (titulo.length > 20 && titulo.length <= 30) {
134                    $(this)
135                        .children('.sppb-articles-carousel-introtext')
136                        .text(limitarTextoArtigo(texto, 110));
137
138                    $(this)
139                        .children('.sppb-articles-carousel-link')
140                        .css('height', '3rem');
141
142                    $(this)
143                        .children('.sppb-articles-carousel-introtext')
144                        .css('height', '4.2rem');
145
146
147                }
148
149                /* if (titulo.length > 45 && titulo.length <= 60) {
150                     $(this)
151                         .children('.sppb-articles-carousel-introtext')
152                         .text(limitarTextoArtigo(texto, 85));
153
154                     $(this)
155                         .children('.sppb-articles-carousel-link')
156                         .css('height', '3.5rem');
157
158                     $(this)
159                         .children('.sppb-articles-carousel-introtext')
160                         .css('height', '3.7rem');
161
162                 }*/
163
164                //if (titulo.length > 60 && titulo.length < 75) {
165
166                if (titulo.length > 30 && titulo.length < 75) {
167                    $(this)
168                        .children('.sppb-articles-carousel-introtext')
169                        .text(limitarTextoArtigo(texto, 60));
170
171                    $(this)
172                        .children('.sppb-articles-carousel-link')
173                        .css('height', '6rem');
174
175                    $(this)
176                        .children('.sppb-articles-carousel-introtext')
177                        .css('height', '3.2rem');
178
179                }
180
181                if (titulo.length >= 75) {
182                    $(this)
183                        .children('.sppb-articles-carousel-introtext')
184                        .text(limitarTextoArtigo(texto, 0));
185                    $(this)
186                        .children('.sppb-articles-carousel-link')
187                        .css('height', '10rem');
188                }
189
190            });
191
192    }
193
194    function limitarTextoArtigo(texto, tamanhoTexto, comContinuacao) {
195
196        var continuacaoTexto = '...';
197
198        var textoReduzido = texto.slice(0, tamanhoTexto);
199
200        if (textoReduzido == 0 || texto.length <= 5) {
201            continuacaoTexto = '';
202        }
203
204        if (comContinuacao) {
205            textoReduzido = textoReduzido + continuacaoTexto;
206        }
207
208        return textoReduzido;
209    }
210
211    function incluirIconesDataHora() {
212        $('.fields-container').each(function () {
213
214            $('.categorias-de-eventos').remove();
215            $('.realizacao-do-evento').remove();
216            $('.ramos-do-evento').remove();
217            $('.link-da-materia').remove();
218            $('.link-do-video').remove();
219            $('.empresa-do-evento').remove();
220            $('.estado-do-evento').remove();
221            $('.palavra-chave-do-evento').remove();
222            $('.eventos-anteriores').remove();
223
224            $('.periodo-do-evento').children('.field-label').html('<i class="far fa-calendar-alt"></i>');
225            $('.horario').children('.field-label').html('<i class="far fa-clock"></i>');
226
227        });
228    }
229
230    function incluirLinkSaibaMaisCarousel() {
231        $('.sppb-articles-carousel-meta-category').addClass('saiba-mais botao-borda-azul-petroleo-3');
232        $('.sppb-articles-carousel-content').each(function (key, data) {
233            data.children[3].children[0].text = 'Saiba Mais';
234            data.children[3].children[0].href = data.children[1].href;
235
236        });
237    }
238
239
240    function incluirBotaoSaibaMaisBoxEventoSeparado() {
241        $('.box-evento-separado')
242            .children('.sppb-addon-content')
243            .children('.sppb-row')
244            .children('.sppb-col-sm-12')
245            .children('.sppb-addon-article')
246            .append('<div class="saiba-mais botao-borda-azul-petroleo-3"><a href="#" itemprop="genre">Saiba Mais</a></div>');
247    }
248
249    function incluirBotaoSaibaMaisBoxEventos() {
250        $('.box-eventos')
251            .children('.sppb-addon-content')
252            .children('.sppb-row')
253            .children('.sppb-col-sm-3')
254            .children('.sppb-addon-article')
255            .append('<div class="saiba-mais botao-borda-azul-petroleo-3"><a href="#" itemprop="genre">Saiba Mais</a></div>');
256    }
257
258    function removerItensFieldsContainerBoxPublicacoes() {
259        $('.box-publicacoes')
260            .children('.sppb-column-addons')
261            .children('.sppb-addon-wrapper ')
262            .children('.clearfix')
263            .children('.sppb-addon-articles')
264            .children('.sppb-addon-content')
265            .children('.sppb-row')
266            .children('.sppb-col-sm-3')
267            .children('.sppb-addon-article')
268            .children('.sppb-article-info-wrap')
269            .children('.fields-container').each(function () {
270                $('.mes-e-ano-da-edicao').remove();
271                $('.titulo-destaque-1').remove();
272                $('.titulo-destaque-2').remove();
273                $('.titulo-destaque-3').remove();
274                $('.descricao-destaque-1').remove();
275                $('.descricao-destaque-2').remove();
276                $('.descricao-destaque-3').remove();
277            });
278    }
279
280    function incluirBotaoFacaDownloadArtigoDestaque() {
281        $('.artigo-item.destaque.download')
282            .children('.sppb-addon-content')
283            .children('.sppb-row')
284            .children('.sppb-col-sm-12')
285            .children('.sppb-addon-article')
286            .children('.sppb-article-info-wrap')
287            .children('.fields-container')
288            .children('.field-entry.arquivo')
289            .children('.field-value ')
290            .children('.container-fluid')
291            .children('.container')
292            .children('.row')
293            .children('.col-12')
294            .children('p')
295            .addClass('botao-borda-azul-petroleo-3 botao-download');
296        $('.botao-download').children('a').html('Faça o download');
297    }
298
299    function incluirBotaoFacaDownloadPublicacoes() {
300        $('.box-publicacoes')
301            .find('.arquivo')
302            .find('p')
303            .addClass('botao-borda-azul-petroleo-3 botao-download');
304
305        $('.botao-download').children('a').html('Faça o download');
306    }
307
308    function removerCamposFiltroConteudos() {
309        $('.fields-container').children('.ramos-da-publicacao').remove();
310        $('.fields-container').children('.tipo-de-publicacoes').remove();
311        $('.fields-container').children('.localidade-publicacao').remove();
312
313        $('.fields-container').children('.sessao-evento').remove();
314        $('.fields-container').children('.localidade-evento').remove();
315        $('.fields-container').children('.categorias-do-eventos').remove();
316    }
317
318    function montarDataHoraEventoSeparadoDestaque() {
319
320        var padraoData = /\d{1,2}\s+a\s+\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}\/\d{2,4}\s+a\s+\d{1,2}\/\d{1,2}\/\d{4}|\d{2}\/\d{2}\/\d{4}/
321        $('.artigo-item')
322            .find('.sppb-addon-article')
323            .find('.sppb-article-info-wrap')
324            .find('.sppb-article-introtext')
325            .each(function () {
326                var textoComData = $(this).text();
327                var dataStringValida = textoComData.match(padraoData);
328
329                if (dataStringValida) {
330                    dataStringValida
331                    var texto = textoComData.split(textoComData.match(padraoData));
332                    //var textoLimpo = texto[1].trim()
333
334                    if (dataStringValida !== null && dataStringValida.length > 0) {
335                        var dataStringValida = dataStringValida[0];
336
337                        $(this).before('<div class="data-e-hora-evento"><div class="data-evento"><i class="far fa-calendar-alt"></i> ' + dataStringValida + '</div></div>');
338                    }
339
340                    if (texto !== null && texto.length > 1) {
341                        var textoLimpo = texto[1].trim()
342                    }
343
344                    if (texto !== null && texto.length == 1) {
345                        var textoLimpo = texto[0]
346                    }
347
348                    var textoSliced = textoLimpo.slice(0, 100)
349                    $(this).text(textoSliced)
350                }
351
352
353            })
354    }
355
356    function montarDataHoraEventos() {
357
358        var padraoData = /\d{1,2}\s+a\s+\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}\/\d{2,4}\s+a\s+\d{1,2}\/\d{1,2}\/\d{4}|\d{2}\/\d{2}\/\d{4}/
359
360        $('.box-eventos')
361            .find('.sppb-addon-content')
362            .find('.sppb-row')
363            .find('.sppb-addon-article')
364            .find('.sppb-article-introtext')
365            .each(function () {
366
367                var textoComData = $(this).text();
368                var dataStringValida = textoComData.match(padraoData);
369                var texto = textoComData.split(textoComData.match(padraoData));
370
371                if (texto.length > 1) {
372                    var textoLimpo = texto[1].trim()
373
374                    if (dataStringValida !== null && dataStringValida.length > 0) {
375                        var dataStringValida = dataStringValida[0];
376
377                        $(this).before('<div class="data-e-hora-evento"><div class="data-evento"><i class="far fa-calendar-alt"></i> ' + dataStringValida + '</div></div>');
378                    }
379
380                    if (texto !== null && texto.length > 1) {
381                        var textoLimpo = texto[1]
382                    }
383
384                    if (texto !== null && texto.length == 1) {
385                        var textoLimpo = texto[0]
386                    }
387
388
389                    $(this).text(textoLimpo.trim())
390                }
391
392            })
393    }
394
395    function reposicionarItensMeta() {
396        $('.ramo-destaques .sppb-article-meta').each(function () {
397            var dataPublicacao = $(this).children('.sppb-meta-date');
398            var categoriaArtigo = $(this).children('.sppb-meta-category');
399            $(this).prepend(categoriaArtigo, dataPublicacao);
400        })
401    }
402
403    function alterarItensArtigosListados() {
404        $('.ramo-destaques .sppb-article-info-wrap').each(function () {
405            var itensMeta = $(this).children('.sppb-article-img-wrap');
406            var titulo = $(this).children('h3');
407            var dataEHora = $(this).children('.data-e-hora-evento')
408            var texto = $(this).children('.sppb-article-introtext');
409            $(this).append(itensMeta, titulo, texto, dataEHora)
410
411        })
412    }
413
414    function montarDataHoraArtigos() {
415        $('.ramo-destaques .artigo-item')
416            .children('.sppb-addon-content')
417            .children('.sppb-row')
418            .children('.sppb-col-sm-12')
419            .children('.sppb-addon-article').each(function () {
420                let textoCompleto = $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text();
421                let arrText = textoCompleto.split('$');
422
423                if (arrText.length == 2) {
424                    let dataEvento = arrText[0];
425                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').before('<div class="data-e-hora-evento"><div class="data-evento"><i class="far fa-calendar-alt"></i> ' + dataEvento + '</div></div>');
426                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text(arrText[1]);
427
428                }
429
430                if (arrText.length == 3 && arrText[1].length <= 6) {
431                    let dataEvento = arrText[0];
432                    let horarioEvento = arrText[1];
433                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').before('<div class="data-e-hora-evento"><div class="data-evento"><i class="far fa-calendar-alt"></i> ' + dataEvento + '</div></div>');
434                    $(this).children('.sppb-article-info-wrap').children('.data-e-hora-evento').append('<div class="hora-evento"><i class="far fa-clock"></i> ' + horarioEvento + '</div>');
435                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text(arrText[2]);
436
437                }
438            });
439    }
440
441    function removerDataCadastroArtigoEventos() {
442        $('.ramo-destaques .artigo-item')
443            .children('.sppb-addon-content')
444            .children('.sppb-row')
445            .children('.sppb-col-sm-12')
446            .children('.sppb-addon-article')
447            .children('.sppb-article-info-wrap').each(function () {
448
449                var categoryArr = $(this).children('.sppb-article-meta')
450                    .children('.sppb-meta-category')
451                    .children('a').attr('href').split('/').reverse();
452                var category = categoryArr[0];
453
454                if (category == 'eventos' || category == 'evento') {
455                    $(this).find('.sppb-meta-date').remove();
456                }
457            });
458    }
459
460    function montarBotaoSaibaMaisEventos() {
461        $('.ramo-destaques .artigo-item')
462            .children('.sppb-addon-content')
463            .children('.sppb-row')
464            .children('.sppb-col-sm-12')
465            .children('.sppb-addon-article')
466            .children('.sppb-article-info-wrap').each(function () {
467
468                var categoryArr = $(this).children('.sppb-article-meta')
469                    .children('.sppb-meta-category')
470                    .children('a').attr('href').split('/').reverse();
471                var category = categoryArr[0];
472
473                var linkEvento = $(this).children('h3').children('a').attr('href');
474
475
476                if (category == 'eventos' || category == 'evento') {
477                    $(this).append('<div class="saiba-mais"><a href="' + linkEvento + '" class="botao-saiba-mais botao-borda-azul-petroleo-3">Saiba mais</a></div>');
478                }
479            });
480    }
481
482
483    function imagemPadraoArtigosCarouselSemImagem($carrouselClass) {
484        $($carrouselClass)
485            .find('.bx-viewport')
486            .find('.sppb-articles-carousel-wrap')
487            .find('.sppb-articles-carousel-column')
488            .find('.sppb-articles-carousel-img')
489            .find('a')
490            .find('img').each(function () {
491                var srcImage = $(this).attr('src');
492
493                if (srcImage.length <= 1) {
494                    $(this).attr('src', 'https://conteudo.somos.coop.br/images/Imagens/imagem-padrao-coop.webp')
495                }
496
497            })
498    }
499
500    function imagemPadraoArtigosBoxesSemImagem($boxClass) {
501        $($boxClass)
502            .find('.sppb-addon-content')
503            .find('.sppb-row')
504            .find('.sppb-col-xs-4.sppb-col-sm-4.sppb-col-md-4.sppb-col-lg-3.sppb-col-4')
505            .find('.sppb-addon-article')
506            .find('a')
507            .find('img')
508            .each(function () {
509                var srcImage = $(this).attr('src');
510
511                if (srcImage.length <= 1) {
512                    $(this).attr('src', 'https://conteudo.somos.coop.br/images/Imagens/imagem-padrao-coop.webp')
513                }
514
515            })
516    }
517
518});
519
520function imagemPadraoArtigosBoxesSemImagemCadastrada($boxClass) {
521    $($boxClass)
522        .find('.sppb-addon-content')
523        .find('.sppb-row')
524        .find('.sppb-col-xs-4.sppb-col-sm-4.sppb-col-md-4.sppb-col-lg-3.sppb-col-4')
525        .find('.sppb-addon-article')
526        .each(function () {
527
528            var url = $(this).find('.sppb-article-info-wrap')
529                .find('h3')
530                .find('a')
531                .attr('href');
532
533            var titulo = $(this).find('.sppb-article-info-wrap')
534                .find('h3')
535                .find('a').text();
536
537            if (!$(this).children('a').length) {
538                console.log('existe');
539                $(this).find('.sppb-article-info-wrap').before('<a class="sppb-article-img-wrap" href="' + url + '" itemprop="url"><img class="sppb-img-responsive" src="https://conteudo.somos.coop.br/images/Imagens/imagem-padrao-coop.webp" alt="' + titulo + '" itemprop="thumbnailUrl" loading="lazy"></a>');
540
541            }
542
543        });
544}
545
546setInterval(function () {
547    imagemPadraoArtigosBoxesSemImagemCadastrada('.box-publicacoes');
548    imagemPadraoArtigosBoxesSemImagemCadastrada('.box-eventos');
549}, 2000);

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.