PageSourceSearch

https://somoscooperativismo-ba.coop.br/assets/js/ramo-consumo.js

js somoscooperativismo-ba.coop.br collected 2026-10-08 11:00:40 UTC 12,466 bytes, 345 lines download raw bytes

1$ = jQuery.noConflict();
2
3$(document).ready(function () {
4
5    chamarCSS();
6    alterarItemBreadcrumb();
7    gerarTagDestaque();
8    reposicionarItensMeta();
9    montarDataHoraArtigos();
10    alterarItensArtigosListados();
11    removerDataCadastroArtigoEventos();
12    montarBotaoSaibaMaisEventos();
13    incluirLinhaSeparadoraNoticiaSimplies();
14    alterarItensArtigosListadosCasesEEventos();
15    incluirClasseBotaoSaibaMaisCasesEEventos();
16    reposicionarBotaoSaibaMaisCasesEEventos();
17    alterarItensArtigosListadosPublicacoesParaVoce();
18    reposicionarBotaoSaibaMaisPublicacoesParaVoce();
19    incluirClasseBotaoSaibaMaisPublicacoesParaVoce();
20    delimitarTextoIntrodutorioNoticias();
21    
22    function chamarCSS() {
23        var protocolo = window.location.protocol;
24        var host = window.location.host;
25
26        var linkCss = protocolo + '//' + host + '/assets/css/ramo-consumo.css';
27
28        $('head').append('<link rel="stylesheet" type="text/css" href="' + linkCss + '">');
29
30    }
31
32    function alterarItemBreadcrumb(){
33        $('.breadcrumb').children('li').eq(2).children('a').text('Cooperativismo');
34        $('.breadcrumb').children('li').eq(2).children('a').attr('href','/cooperativismo')
35    }
36
37    function gerarTagDestaque() {
38        $('.destaque').before('<div class="tag-destaque">Destaque</div>');
39    }
40
41    function reposicionarItensMeta() {
42        $('.sppb-article-meta').each(function () {
43            var dataPublicacao = $(this).children('.sppb-meta-date');
44            var categoriaArtigo = $(this).children('.sppb-meta-category');
45            $(this).prepend(categoriaArtigo, dataPublicacao);
46        })
47    }
48
49    function alterarItensArtigosListados() {
50        $('.sppb-article-info-wrap').each(function () {
51            var itensMeta = $(this).children('.sppb-article-img-wrap');
52            var titulo = $(this).children('h3');
53            var dataEHora = $(this).children('.data-e-hora-evento')
54            var texto = $(this).children('.sppb-article-introtext');
55            $(this).append(itensMeta, titulo, texto, dataEHora)
56
57        })
58    }
59
60    function montarDataHoraArtigos() {
61        $('.artigo-item')
62            .children('.sppb-addon-content')
63            .children('.sppb-row')
64            .children('.sppb-col-sm-12')
65            .children('.sppb-addon-article').each(function () {
66                let textoCompleto = $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text();
67                let arrText = textoCompleto.split('$');
68
69                if (arrText.length == 2) {
70                    let dataEvento = arrText[0];
71                    $(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>');
72                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text(arrText[1]);
73
74                }
75
76                if (arrText.length == 3 && arrText[1].length <= 6) {
77                    let dataEvento = arrText[0];
78                    let horarioEvento = arrText[1];
79                    $(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>');
80                    $(this).children('.sppb-article-info-wrap').children('.data-e-hora-evento').append('<div class="hora-evento"><i class="far fa-clock"></i> ' + horarioEvento + '</div>');
81                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text(arrText[2]);
82
83                }
84            });
85    }
86
87    function removerDataCadastroArtigoEventos() {
88        $('.artigo-item')
89            .children('.sppb-addon-content')
90            .children('.sppb-row')
91            .children('.sppb-col-sm-12')
92            .children('.sppb-addon-article')
93            .children('.sppb-article-info-wrap').each(function () {
94
95                var categoryArr = $(this).children('.sppb-article-meta')
96                    .children('.sppb-meta-category')
97                    .children('a').attr('href').split('/').reverse();
98                var category = categoryArr[0];
99
100                if (category == 'eventos' || category == 'evento') {
101                    $(this).find('.sppb-meta-date').remove();
102                }
103            });
104    }
105
106    function montarBotaoSaibaMaisEventos() {
107        $('.artigo-item')
108            .children('.sppb-addon-content')
109            .children('.sppb-row')
110            .children('.sppb-col-sm-12')
111            .children('.sppb-addon-article')
112            .children('.sppb-article-info-wrap').each(function () {
113
114                var categoryArr = $(this).children('.sppb-article-meta')
115                    .children('.sppb-meta-category')
116                    .children('a').attr('href').split('/').reverse();
117                var category = categoryArr[0];
118
119                var linkEvento = $(this).children('h3').children('a').attr('href');
120
121
122                if (category == 'eventos' || category == 'evento') {
123                    $(this).append('<div class="saiba-mais"><a href="' + linkEvento + '" class="botao-saiba-mais botao-borda-azul-petroleo-3">Saiba mais</a></div>');
124                }
125            });
126    }
127
128    function incluirLinhaSeparadoraNoticiaSimplies() {
129        $('.noticia-simples')
130            .find('.sppb-col-sm-12')
131            .each(function (key) {
132
133                if (key == 0) {
134                    $(this).append('<hr />')
135                }
136            })
137    }
138
139    function alterarItensArtigosListadosCasesEEventos() {
140        $('.itens-artigos-cases-e-eventos').find('.sppb-article-info-wrap').each(function () {
141            var itensMeta = $(this).children('.sppb-article-img-wrap');
142            var titulo = $(this).children('h3');
143            var dataEHora = $(this).children('.data-e-hora-evento')
144            var texto = $(this).children('.sppb-article-introtext');
145
146
147            var areaBotaoSaibaMais = '<div class="area-botao-saiba-mais"></div>';
148
149            $(this).append(itensMeta, titulo, texto, dataEHora, areaBotaoSaibaMais);
150
151        })
152    }
153
154    function reposicionarBotaoSaibaMaisCasesEEventos() {
155        $('.itens-artigos-cases-e-eventos')
156            .find('.sppb-article-info-wrap')
157            .each(function () {
158                var saibaMais = $(this).children('.sppb-readmore');
159                $(this).find('.area-botao-saiba-mais').append(saibaMais)
160            })
161    }
162
163    function incluirClasseBotaoSaibaMaisCasesEEventos() {
164        $('.box-itens-artigos-cases-e-eventos')
165            .find('.sppb-readmore').each(function () {
166                $(this).addClass('botao-borda-azul-petroleo-3')
167            })
168    }
169
170    /** */
171    function alterarItensArtigosListadosPublicacoesParaVoce() {
172        $('.itens-artigos-publicacoes-para-voce').find('.sppb-article-info-wrap').each(function () {
173            var itensMeta = $(this).children('.sppb-article-img-wrap');
174            var titulo = $(this).children('h3');
175            var dataEHora = $(this).children('.data-e-hora-evento')
176            var texto = $(this).children('.sppb-article-introtext');
177
178
179            var areaBotaoSaibaMais = '<div class="area-botao-ver-mais"></div>';
180
181            $(this).append(itensMeta, titulo, texto, dataEHora, areaBotaoSaibaMais);
182
183        })
184    }
185
186    function reposicionarBotaoSaibaMaisPublicacoesParaVoce() {
187        $('.itens-artigos-publicacoes-para-voce')
188            .find('.sppb-article-info-wrap')
189            .each(function () {
190                var verMais = $(this).children('.sppb-readmore');
191                $(this).find('.area-botao-ver-mais').append(verMais)
192            })
193    }
194
195    function incluirClasseBotaoSaibaMaisPublicacoesParaVoce() {
196        $('.itens-artigos-publicacoes-para-voce')
197            .find('.sppb-readmore').each(function () {
198                $(this).addClass('botao-borda-azul-petroleo-3')
199            })
200    }
201
202    function delimitarTextoIntrodutorioNoticias() {
203        $('.itens-artigos-publicacoes-para-voce')
204        .find('.sppb-article-info-wrap')
205        .each(function () {
206            let titulo = $(this)
207                .children('h3')
208                .children('a')
209                .text();
210
211            let texto = $(this)
212                .children('.sppb-article-introtext')
213                .text();
214
215            var ultimaPalavra = titulo.split(' ').reverse();
216
217            if (titulo.length <= 25) {
218
219                $(this)
220                    .children('.sppb-article-introtext')
221                    .text(limitarTextoNoticia(texto, 150));
222
223                $(this)
224                    .children('h3')
225                    .css('height', '2.5rem');
226
227                $(this)
228                    .children('.sppb-article-introtext')
229                    .css('height', '7rem');
230
231                if (titulo.length >= 20 && ultimaPalavra[0].length >= 7) {
232
233                    $(this)
234                        .children('.sppb-article-introtext')
235                        .text(limitarTextoNoticia(texto, 110));
236
237                    $(this)
238                        .children('h3')
239                        .css('height', '3rem');
240
241                    $(this)
242                        .children('.sppb-article-introtext')
243                        .css('height', '5.5rem');
244                }
245            }
246
247            if (titulo.length > 20 && titulo.length <= 45) {
248                $(this)
249                    .children('.sppb-article-introtext')
250                    .text(limitarTextoNoticia(texto, 110));
251
252                $(this)
253                    .children('h3')
254                    .css('height', '3rem');
255
256                $(this)
257                    .children('.sppb-article-introtext')
258                    .css('height', '5.5rem');
259
260                if (titulo.length > 30 && ultimaPalavra[0].length >= 7) {
261
262                    $(this)
263                        .children('.sppb-article-introtext')
264                        .text(limitarTextoNoticia(texto, 85));
265
266                    $(this)
267                        .children('h3')
268                        .css('height', '3rem');
269
270                    $(this)
271                        .children('.sppb-article-introtext')
272                        .css('height', '5.5rem');
273                }
274            }
275
276            if (titulo.length > 45 && titulo.length <= 60) {
277                $(this)
278                    .children('.sppb-article-introtext')
279                    .text(limitarTextoNoticia(texto, 95));
280
281                $(this)
282                    .children('h3')
283                    .css('height', '4rem');
284
285                $(this)
286                    .children('.sppb-article-introtext')
287                    .css('height', '5.5rem');
288
289                if (titulo.length >= 48 && ultimaPalavra[0].length >= 7) {
290
291                    $(this)
292                        .children('.sppb-article-introtext')
293                        .text(limitarTextoNoticia(texto, 80));
294
295                    $(this)
296                        .children('h3')
297                        .css('height', '4rem');
298
299                    $(this)
300                        .children('.sppb-article-introtext')
301                        .css('height', '5.5rem');
302                }
303            }
304
305            if (titulo.length > 60 && titulo.length < 75) {
306                $(this)
307                    .children('.sppb-article-introtext')
308                    .text(limitarTextoNoticia(texto, 60));
309
310                $(this)
311                    .children('h3')
312                    .css('height', '5rem');
313
314                $(this)
315                    .children('.sppb-article-introtext')
316                    .css('height', '4.5rem');
317            }
318
319            if (titulo.length > 75) {
320                $(this)
321                    .children('.sppb-article-introtext')
322                    .text(limitarTextoNoticia(texto, 0));
323                $(this)
324                    .children('h3')
325                    .css('height', '5.5rem');
326            }
327
328        });
329    
330    }
331
332    function limitarTextoNoticia(texto, tamanhoTexto) {
333
334        var continuacaoTexto = '...';
335      
336        var textoReduzido = texto.slice(0, tamanhoTexto);
337      
338      	if(textoReduzido == 0 || texto.length <= 5){
339           continuacaoTexto = '';
340        }
341      
342        return textoReduzido + continuacaoTexto;
343    }
344
345});

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.