VLibras Dspace 7.6

134 views
Skip to first unread message

adrianoca...@gmail.com

unread,
Aug 11, 2023, 12:41:46 PM8/11/23
to DSpace Brasil
Boa tarde, pessoal.
Alguém já add plugin do VLibras na versão 7.6 do Dspace.

Tentei add na pág: src/index.html

Arquivo original
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <base href="/">
  <title>DSpace</title>
  <meta name="viewport" content="width=device-width,minimum-scale=1">
  <meta http-equiv="cache-control" content="no-store">
</head>

<body>
  <ds-app></ds-app>
</body>
<!-- do not include client bundle, it is injected with Zone already loaded -->
</html>

Arquivo alterado:
<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <base href="/">
  <title>DSpace</title>
  <meta name="viewport" content="width=device-width,minimum-scale=1">
  <meta http-equiv="cache-control" content="no-store">
</head>

<body>
  <ds-app></ds-app>

  <div vw class="enabled">
    <div vw-access-button class="active"></div>
    <div vw-plugin-wrapper>
      <div class="vw-plugin-top-wrapper"></div>
    </div>
  </div>
  <script>
    new window.VLibras.Widget('https://vlibras.gov.br/app');
  </script>
 
</body>

<!-- do not include client bundle, it is injected with Zone already loaded -->

</html>

desta forma aparece a aplicação, mas ao abrir não aparecem os controles do vlibras e recebo o seguinte erro:
b959a899-2945-4e40-a980-a01df0fbdf1e:2 TypeError: onLoadPlayer is not a function
    at eval (eval at _JS_Eval_EvalJS (b959a899-2945-4e40-a980-a01df0fbdf1e:2:41324), <anonymous>:1:1)
    at _JS_Eval_EvalJS (b959a899-2945-4e40-a980-a01df0fbdf1e:2:41324)

Também já add no footer e na app.component.html, mas sem sucesso, nestas o vlibras nem aparece na tela.

adrianoca...@gmail.com

unread,
Oct 5, 2023, 11:29:00 AM10/5/23
to DSpace Brasil
Resolveu com o carregamento dinâmico do javascript:

<div vw class="enabled">
  <div vw-access-button class="active"></div>
  <div vw-plugin-wrapper>
    <div class="vw-plugin-top-wrapper"></div>
  </div>
</div>
<script>
  function loadVLibrasScript() {
    var script = document.createElement('script');
    script.onload = function () {
      new window.VLibras.Widget('https://vlibras.gov.br/app');
    };
    document.head.appendChild(script);
  }
  document.addEventListener('DOMContentLoaded', loadVLibrasScript);
</script>

Essa abordagem cria um elemento script dinamicamente e o adiciona ao cabeçalho da página. O código dentro da função onload garante que o widget seja inicializado somente após o carregamento bem-sucedido do script
Reply all
Reply to author
Forward
0 new messages