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