PageSourceSearch

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

js somoscooperativismo-ba.coop.br collected 2026-10-08 11:00:45 UTC 12,871 bytes, 356 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-agropecuario.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).find('.sppb-article-introtext');
55
56            // Remover a imagem dentro do link
57            texto.find('a img').remove();
58
59            // Substituir o conteúdo do link pelo texto do parágrafo
60            texto.find('a').contents().unwrap();
61
62            // Remover a imagem dentro de .image-artigo
63            $(this).find('.col-left .image-artigo').remove();
64
65            // Se necessário, reorganizar ou reordenar os elementos
66            $(this).append(itensMeta, titulo, texto, dataEHora);
67        });
68    }
69
70
71    function montarDataHoraArtigos() {
72        $('.artigo-item')
73            .children('.sppb-addon-content')
74            .children('.sppb-row')
75            .children('.sppb-col-sm-12')
76            .children('.sppb-addon-article').each(function () {
77                let textoCompleto = $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text();
78                let arrText = textoCompleto.split('$');
79
80                if (arrText.length == 2) {
81                    let dataEvento = arrText[0];
82                    $(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>');
83                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text(arrText[1]);
84
85                }
86
87                if (arrText.length == 3 && arrText[1].length <= 6) {
88                    let dataEvento = arrText[0];
89                    let horarioEvento = arrText[1];
90                    $(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>');
91                    $(this).children('.sppb-article-info-wrap').children('.data-e-hora-evento').append('<div class="hora-evento"><i class="far fa-clock"></i> ' + horarioEvento + '</div>');
92                    $(this).children('.sppb-article-info-wrap').children('.sppb-article-introtext').text(arrText[2]);
93
94                }
95            });
96    }
97
98    function removerDataCadastroArtigoEventos() {
99        $('.artigo-item')
100            .children('.sppb-addon-content')
101            .children('.sppb-row')
102            .children('.sppb-col-sm-12')
103            .children('.sppb-addon-article')
104            .children('.sppb-article-info-wrap').each(function () {
105
106                var categoryArr = $(this).children('.sppb-article-meta')
107                    .children('.sppb-meta-category')
108                    .children('a').attr('href').split('/').reverse();
109                var category = categoryArr[0];
110
111                if (category == 'eventos' || category == 'evento') {
112                    $(this).find('.sppb-meta-date').remove();
113                }
114            });
115    }
116
117    function montarBotaoSaibaMaisEventos() {
118        $('.artigo-item')
119            .children('.sppb-addon-content')
120            .children('.sppb-row')
121            .children('.sppb-col-sm-12')
122            .children('.sppb-addon-article')
123            .children('.sppb-article-info-wrap').each(function () {
124
125                var categoryArr = $(this).children('.sppb-article-meta')
126                    .children('.sppb-meta-category')
127                    .children('a').attr('href').split('/').reverse();
128                var category = categoryArr[0];
129
130                var linkEvento = $(this).children('h3').children('a').attr('href');
131
132
133                if (category == 'eventos' || category == 'evento') {
134                    $(this).append('<div class="saiba-mais"><a href="' + linkEvento + '" class="botao-saiba-mais botao-borda-azul-petroleo-3">Saiba mais</a></div>');
135                }
136            });
137    }
138
139    function incluirLinhaSeparadoraNoticiaSimplies() {
140        $('.noticia-simples')
141            .find('.sppb-col-sm-12')
142            .each(function (key) {
143
144                if (key == 0) {
145                    $(this).append('<hr />')
146                }
147            })
148    }
149
150    function alterarItensArtigosListadosCasesEEventos() {
151        $('.itens-artigos-cases-e-eventos').find('.sppb-article-info-wrap').each(function () {
152            var itensMeta = $(this).children('.sppb-article-img-wrap');
153            var titulo = $(this).children('h3');
154            var dataEHora = $(this).children('.data-e-hora-evento')
155            var texto = $(this).children('.sppb-article-introtext');
156
157
158            var areaBotaoSaibaMais = '<div class="area-botao-saiba-mais"></div>';
159
160            $(this).append(itensMeta, titulo, texto, dataEHora, areaBotaoSaibaMais);
161
162        })
163    }
164
165    function reposicionarBotaoSaibaMaisCasesEEventos() {
166        $('.itens-artigos-cases-e-eventos')
167            .find('.sppb-article-info-wrap')
168            .each(function () {
169                var saibaMais = $(this).children('.sppb-readmore');
170                $(this).find('.area-botao-saiba-mais').append(saibaMais)
171            })
172    }
173
174    function incluirClasseBotaoSaibaMaisCasesEEventos() {
175        $('.box-itens-artigos-cases-e-eventos')
176            .find('.sppb-readmore').each(function () {
177                $(this).addClass('botao-borda-azul-petroleo-3')
178            })
179    }
180
181    /** */
182    function alterarItensArtigosListadosPublicacoesParaVoce() {
183        $('.itens-artigos-publicacoes-para-voce').find('.sppb-article-info-wrap').each(function () {
184            var itensMeta = $(this).children('.sppb-article-img-wrap');
185            var titulo = $(this).children('h3');
186            var dataEHora = $(this).children('.data-e-hora-evento')
187            var texto = $(this).children('.sppb-article-introtext');
188
189
190            var areaBotaoSaibaMais = '<div class="area-botao-ver-mais"></div>';
191
192            $(this).append(itensMeta, titulo, texto, dataEHora, areaBotaoSaibaMais);
193
194        })
195    }
196
197    function reposicionarBotaoSaibaMaisPublicacoesParaVoce() {
198        $('.itens-artigos-publicacoes-para-voce')
199            .find('.sppb-article-info-wrap')
200            .each(function () {
201                var verMais = $(this).children('.sppb-readmore');
202                $(this).find('.area-botao-ver-mais').append(verMais)
203            })
204    }
205
206    function incluirClasseBotaoSaibaMaisPublicacoesParaVoce() {
207        $('.itens-artigos-publicacoes-para-voce')
208            .find('.sppb-readmore').each(function () {
209                $(this).addClass('botao-borda-azul-petroleo-3')
210            })
211    }
212
213    function delimitarTextoIntrodutorioNoticias() {
214        $('.itens-artigos-publicacoes-para-voce')
215        .find('.sppb-article-info-wrap')
216        .each(function () {
217            let titulo = $(this)
218                .children('h3')
219                .children('a')
220                .text();
221
222            let texto = $(this)
223                .children('.sppb-article-introtext')
224                .text();
225
226            var ultimaPalavra = titulo.split(' ').reverse();
227
228            if (titulo.length <= 25) {
229
230                $(this)
231                    .children('.sppb-article-introtext')
232                    .text(limitarTextoNoticia(texto, 150));
233
234                $(this)
235                    .children('h3')
236                    .css('height', '2.5rem');
237
238                $(this)
239                    .children('.sppb-article-introtext')
240                    .css('height', '7rem');
241
242                if (titulo.length >= 20 && ultimaPalavra[0].length >= 7) {
243
244                    $(this)
245                        .children('.sppb-article-introtext')
246                        .text(limitarTextoNoticia(texto, 110));
247
248                    $(this)
249                        .children('h3')
250                        .css('height', '3rem');
251
252                    $(this)
253                        .children('.sppb-article-introtext')
254                        .css('height', '5.5rem');
255                }
256            }
257
258            if (titulo.length > 20 && titulo.length <= 45) {
259                $(this)
260                    .children('.sppb-article-introtext')
261                    .text(limitarTextoNoticia(texto, 110));
262
263                $(this)
264                    .children('h3')
265                    .css('height', '3rem');
266
267                $(this)
268                    .children('.sppb-article-introtext')
269                    .css('height', '5.5rem');
270
271                if (titulo.length > 30 && ultimaPalavra[0].length >= 7) {
272
273                    $(this)
274                        .children('.sppb-article-introtext')
275                        .text(limitarTextoNoticia(texto, 85));
276
277                    $(this)
278                        .children('h3')
279                        .css('height', '3rem');
280
281                    $(this)
282                        .children('.sppb-article-introtext')
283                        .css('height', '5.5rem');
284                }
285            }
286
287            if (titulo.length > 45 && titulo.length <= 60) {
288                $(this)
289                    .children('.sppb-article-introtext')
290                    .text(limitarTextoNoticia(texto, 95));
291
292                $(this)
293                    .children('h3')
294                    .css('height', '4rem');
295
296                $(this)
297                    .children('.sppb-article-introtext')
298                    .css('height', '5.5rem');
299
300                if (titulo.length >= 48 && ultimaPalavra[0].length >= 7) {
301
302                    $(this)
303                        .children('.sppb-article-introtext')
304                        .text(limitarTextoNoticia(texto, 80));
305
306                    $(this)
307                        .children('h3')
308                        .css('height', '4rem');
309
310                    $(this)
311                        .children('.sppb-article-introtext')
312                        .css('height', '5.5rem');
313                }
314            }
315
316            if (titulo.length > 60 && titulo.length < 75) {
317                $(this)
318                    .children('.sppb-article-introtext')
319                    .text(limitarTextoNoticia(texto, 60));
320
321                $(this)
322                    .children('h3')
323                    .css('height', '5rem');
324
325                $(this)
326                    .children('.sppb-article-introtext')
327                    .css('height', '4.5rem');
328            }
329
330            if (titulo.length > 75) {
331                $(this)
332                    .children('.sppb-article-introtext')
333                    .text(limitarTextoNoticia(texto, 0));
334                $(this)
335                    .children('h3')
336                    .css('height', '5.5rem');
337            }
338
339        });
340    
341    }
342
343    function limitarTextoNoticia(texto, tamanhoTexto) {
344
345        var continuacaoTexto = '...';
346      
347        var textoReduzido = texto.slice(0, tamanhoTexto);
348      
349      	if(textoReduzido == 0 || texto.length <= 5){
350           continuacaoTexto = '';
351        }
352      
353        return textoReduzido + continuacaoTexto;
354    }
355
356});

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.