From b55d05ce6ca718889601fd9e49ce9adfbb5402c9 Mon Sep 17 00:00:00 2001 From: Venilton FalvoJr Date: Fri, 12 Jul 2024 10:52:28 -0300 Subject: [PATCH 1/2] Update index.html --- docs/player/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/player/index.html b/docs/player/index.html index e902af7..f2ea7aa 100644 --- a/docs/player/index.html +++ b/docs/player/index.html @@ -28,11 +28,9 @@
-

-
From 19f88eff03c7ddcd584ce28de26493b2e3888ab0 Mon Sep 17 00:00:00 2001 From: Venilton FalvoJr Date: Fri, 12 Jul 2024 10:58:07 -0300 Subject: [PATCH 2/2] Update lib.js --- docs/player/js/lib.js | 37 ++++++++----------------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/docs/player/js/lib.js b/docs/player/js/lib.js index bc802dd..e2b0184 100644 --- a/docs/player/js/lib.js +++ b/docs/player/js/lib.js @@ -20,26 +20,9 @@ const elements = { resumoButtons: {}, // será preenchido dinamicamente resumoText: getById('resume-text'), titleText: getById('title-text'), - descriptionText: getById('description-text'), - btnShowResume: getById('btn-show-resume'), + descriptionText: getById('description-text') }; -// Função para exibir ou ocultar o botão 'btn-show-resume' com base na transcrição selecionada -function toggleBtnShowResumeVisibility() { - // Verificar se há texto na transcrição - const hasTranscription = elements.resumoText.textContent.trim().length > 0; - - // Exibir ou ocultar o botão com base na presença de transcrição - elements.btnShowResume.style.display = hasTranscription ? 'block' : 'none'; -} - -// Função para ocultar a transcrição e o botão 'btn-show-resume' -function hideTranscription() { - elements.resumoText.innerHTML = ''; // Limpar o conteúdo da transcrição - - elements.btnShowResume.style.display = 'none'; // Ocultar o botão 'btn-show-resume' -} - // Carregar video a partir do retorno da api async function loadVideo(videoElement) { const sourceElement = document.createElement('source'); @@ -102,8 +85,6 @@ function carregarResumo(idioma) { pElement.textContent = paragrafo; elements.resumoText.appendChild(pElement); }); - - toggleBtnShowResumeVisibility(); }) .catch((error) => { console.error(`Erro ao carregar resumo em ${idioma}:`, error); @@ -132,20 +113,16 @@ document.addEventListener('DOMContentLoaded', async () => { // Criar dinamicamente os controles de idioma for (const langCode in apiModel.metadata.localizations) { - addLanguageButton(langCode); + const buttonTranscript = addLanguageButton(langCode); + if (langCode == 'pt-BR') { + buttonTranscript.click(); + } } - - // Ocultar botão transcrição - elements.btnShowResume.style.display = 'none'; - } catch (error) { console.error('There has been a problem with your fetch operation:', error); } }); -// Eventos para carregar o resumo quando o botão "Ver Resumo" for clicado. -elements.btnShowResume.addEventListener('click', () => {hideTranscription(); toggleBtnShowResumeVisibility();}); - // Função para criar e adicionar elementos de botão de idioma function addLanguageButton(langCode) { const carouselControllers = getFirstByClass('carousel-controllers'); @@ -176,6 +153,8 @@ function addLanguageButton(langCode) { resetControllers(); this.parentElement.classList.add('active'); }); + + return button; } // Função para resetar todas as classes para a cor padrão @@ -185,4 +164,4 @@ function resetControllers() { controller.classList.remove('active'); }); } - \ No newline at end of file +