PageSourceSearch

https://somoscooperativismo-ba.coop.br/assets/js/somoscoop/videos-interna.js

js somoscooperativismo-ba.coop.br collected 2026-10-08 11:01:08 UTC 10,807 bytes, 275 lines download raw bytes

1$ = jQuery.noConflict();
2
3$(document).ready(function () {
4    chamarCSS();
5    incluirTopoPaginaInterna();
6    removerItensNaoUtilizados();
7    alterarTamanhoVideoIframe();
8    // reposicionarTituloPagina();
9    //IncluirAreaVideosRelacionados não estava sendo usada e também não foi implementada corretamente
10    // incluirAreaVideosRelacionados();
11    // removerLinhaVazia();
12    // alterarPosicaoItensModuloVideosRelacionados();
13    // reduzirTextoModuloVideosRelacionados();
14    //Não estava sendo usado
15    vejaTodosVideosRelacionados();
16    // adicionarBoatoPlay();
17    // adicionarLinkImagem();
18    videoMobile();
19
20    $("li.field-entry.posicao-destaque-home").remove();
21    // Extrai os vídeos do HTML existente
22    var videosExtraidos = extrairInformacoesDeVideos();
23    // Chama a função para incluir os vídeos relacionados
24    incluirAreaVideosRelacionados(videosExtraidos);
25    // Seleciona o bloco que deseja remover
26    var blocoParaRemover = document.querySelector(".related-article-list-container");
27
28    // Verifica se o bloco existe e o remove
29    if (blocoParaRemover) {
30        console.log("Bloco removido");
31        blocoParaRemover.remove();
32    }
33
34    function chamarCSS() {
35        var protocolo = window.location.protocol;
36        var host = window.location.host;
37
38        var linkCss = protocolo + '//' + host + '/assets/css/somoscoop/videos-interna.css';
39
40        $('head').append('<link rel="stylesheet" type="text/css" href="' + linkCss + '">');
41    }
42
43    function incluirTopoPaginaInterna() {
44        $('#sp-conteudo-do-site')
45            .children('.container')
46            .children('.container-inner')
47            .prepend('<div class="topo-pagina-interna"></div>');
48        $('.topo-pagina-interna').append('<div class="image-banner"></div>')
49        $('.topo-pagina-interna').append(montarBreadCrumb());
50    }
51
52
53    function montarBreadCrumb() {
54        var tituloPagina = $('.article-header').children('h1').text()
55
56        var htmlBreadCrumb = '<ol itemscope="" itemtype="https://schema.org/BreadcrumbList" class="breadcrumb">' +
57            '    <li class="">' +
58            '        <span class="" aria-hidden="true"></span>' +
59            '    </li>' +
60            '    <li itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem" class="breadcrumb-item"><a itemprop="item" href="/" class="pathway"><span itemprop="name">Home</span></a>' +
61            '        <meta itemprop="position" content="1">' +
62            '    </li>' +
63            '    <li itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem" class="breadcrumb-item"><a itemprop="item" href="/conteudos-coop/videos" class="pathway"><span itemprop="name">Vídeos</span></a>' +
64            '        <meta itemprop="position" content="2">' +
65            '    </li>' +
66            '    <li itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem" class="breadcrumb-item active">' +
67            '        <span itemprop="name">' + tituloPagina + '</span>' +
68            '        <meta itemprop="position" content="3">' +
69            '    </li>' +
70            '</ol>';
71
72        return htmlBreadCrumb;
73    }
74
75    function removerItensNaoUtilizados() {
76        $('.modified').remove();
77
78        $('.article-info').children('.category-name').remove();
79        $('.article-info').children('.hits').remove();
80        $('.article-info').children('.published').remove();
81        // $('.article-info').children('.article-ratings-social-share').remove();
82        // $('.article-details ').children('.article-ratings-social-share').remove();
83        $('.article-info').remove();
84        $('.pagenavigation').remove()
85    }
86
87    function alterarTamanhoVideoIframe() {
88        $('.container-fluid').find('iframe').attr({ 'width': 1202, 'height': 677 });
89    }
90
91    // function reposicionarTituloPagina() {
92    //     // Seleciona o h1 do vídeo pelo itemprop "headline"
93    //     var videoTitle = document.querySelector('h1[itemprop="headline"]');
94    //
95    //     // Seleciona o elemento da div "article-header" onde o título será movido
96    //     var articleHeader = document.querySelector('.article-header');
97    //
98    //     // Move o h1 para dentro da div "article-header" (caso ambos existam)
99    //     if (videoTitle && articleHeader) {
100    //         articleHeader.appendChild(videoTitle);
101    //     }
102    // }
103
104    reposicionarSocialShare();
105    function reposicionarSocialShare() {
106        let titulo = $(".article-details .article-header").children('h1');
107        let socialShare = $(".article-ratings-social-share");
108        $(".article-details .article-header").append('<div class="head-title"></div>');
109        $(".head-title").append(titulo, socialShare);
110    }
111
112    function incluirAreaVideosRelacionados(videos) {
113        // Início do HTML da área de vídeos relacionados
114        var videosRelacionados = `
115        <div class="row alinhar-videos-relacionados" id="sp-component">
116            <div class="col-lg-12">
117                <div class="titulo-linha-videos">
118                    <div class="titulo">Vídeos Relacionados</div>
119                    <div class="linha"><hr /></div>
120                </div>
121                <div class="videos-relacionados">
122                    <div class="row">`;
123
124        // Para cada vídeo, adiciona um bloco de vídeo dinâmico
125        videos.forEach(function(video) {
126            videosRelacionados += `
127            <div class="col-lg-3">
128                <div class="article">
129                    <div class="article-featured-video">
130                        <div class="ratio ratio-16x9">
131                            <iframe src="${video.url}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="" title="${video.title}"></iframe>
132                        </div>
133                    </div>
134                    <div class="article-header">
135                        <h2>
136                            <a href="${video.link}">${video.title}</a>
137                        </h2>
138                        <p>${video.description}</p>
139                    </div>
140                </div>
141            </div>`;
142        });
143
144        // Fechamento das divs
145        videosRelacionados += `
146                    </div> <!-- Fecha a row -->
147                </div> <!-- Fecha videos-relacionados -->
148            </div> <!-- Fecha col-lg-12 -->
149        </div> <!-- Fecha sp-component -->
150    `;
151
152        // Adiciona a área de vídeos relacionados ao conteúdo
153        $('#sp-conteudo-do-site').children('.container').children('.container-inner').append(videosRelacionados);
154    }
155
156
157    function removerLinhaVazia() {
158        $('.modulo-videos-relacionados')
159            .find('.mod-articlesnews.newsflash')
160            .find('.mod-articlesnews__item')
161            .each(function () {
162                $(this).children('.container-fluid')
163                        .find('h1')
164                        .parent('.col-12')
165                        .parent('.row')
166                        .parent('.container')
167                        .parent('.container-fluid')
168                        .remove();
169            })
170    }
171
172    function reduzirTextoModuloVideosRelacionados(){
173        $('.modulo-videos-relacionados')
174        .find('.mod-articlesnews.newsflash')
175        .find('.mod-articlesnews__item')
176        .each(function () {
177        
178        var innerCol12 = $(this).find('.container-fluid').find('.col-12').eq(0).html();
179        var texto = innerCol12.slice(0, 150);
180        
181        $(this).find('.container-fluid').find('.col-12').eq(0).html(texto);
182      
183      });
184    }
185
186    function vejaTodosVideosRelacionados() {
187        $('.videos-relacionados')
188            .append('<div class="area-botao-veja-todos-videos-relacionados">' +
189                '<a href="/conteudos-coop/videos" class="botao-borda-azul-petroleo">Veja todos</a></div>')
190    }
191
192    function adicionarBoatoPlay() {
193        $('.newsflash-image').append('<div class="botao-play"><i class="fa fa-play-circle" aria-hidden="true"></i></div>')
194    }
195
196    function adicionarLinkImagem(){
197        $('.modulo-videos-relacionados')
198        .find('.mod-articlesnews.newsflash')
199        .find('.mod-articlesnews__item')
200        .each(function () {
201        
202        var link = $(this).find('.newsflash-title').children('a').attr('href');
203        var imagem = $(this).children('.newsflash-image');
204        
205        $(this).children('h4').before('<a href="'+link+'" class="link-imagem"></a>');
206        $(this).find('.link-imagem').append(imagem)
207        
208      })
209    }
210
211    function videoMobile() {
212        var screenWidht = $(window).width();
213        var videoWidht = screenWidht - 30;
214        var height = screenWidht / 2;
215
216        if (screenWidht < 800) {
217            $('.container-fluid').find('iframe').attr({ 'width': videoWidht, 'height': height });
218        }
219    }
220
221    function extrairInformacoesDeVideos() {
222        var videos = [];
223        var limite = 3; // Limite de 3 vídeos
224
225        // Percorre cada bloco de vídeo no HTML
226        $('.related-article-list .col-lg-3').each(function(index) {
227            if (index >= limite) {
228                return false; // Para o loop se atingir o limite de 3 vídeos
229            }
230
231            var video = {};
232
233            // Pega a URL do iframe
234            var iframe = $(this).find('iframe').attr('src');
235            if (iframe && iframe !== "" && iframe !== undefined && iframe !== null) {
236                video.url = iframe;
237            } else {
238                return true; // Pula para o próximo se estiver em branco ou nulo
239            }
240
241            // Pega o título do vídeo
242            var titulo = $(this).find('.article-header h2 a');
243            var tituloTexto = titulo.text();
244            if (tituloTexto && tituloTexto !== "" && tituloTexto !== undefined && tituloTexto !== null) {
245                video.title = tituloTexto;
246            } else {
247                return true; // Pula para o próximo se estiver em branco ou nulo
248            }
249
250            // Pega o link do vídeo
251            var link = titulo.attr('href');
252            if (link && link !== "" && link !== undefined && link !== null) {
253                video.link = link;
254            } else {
255                return true; // Pula para o próximo se estiver em branco ou nulo
256            }
257
258            // Pega a descrição do vídeo (se houver)
259            var descricao = $(this).find('.article-header p').text();
260            if (descricao && descricao !== "" && descricao !== undefined && descricao !== null) {
261                video.description = descricao;
262            } else {
263                video.description = ""; // Valor padrão se não houver descrição
264            }
265
266            // Adiciona o vídeo ao array
267            videos.push(video);
268        });
269
270        return videos;
271    }
272
273
274
275});

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.