These instructions will get you a copy of the project compiled and running on your local machine for development and testing purposes.
Before starting the build of the tools, you need to install some prerequisites:
curl -sL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt install -y nodejs
VLibras Player WebJS is required at project installation, you just need to clone it in the same path as the root of this project.
git clone https://gitlab.lavid.ufpb.br/vlibras2019/vlibras-web-extensions/vlibras-player-webjs.git
Note: It is necessary to have access to the VLibras Player WebJS repository to be able to clone it.
Before running the application, make sure to create a .env
file in the project root and set the following environment variable:
# Content of .env (set to "production", "homolog" or "development")
MODE=development
After installing all the prerequisites, install the project by running the command:
cd vlibras-web-browsers/
npm install
When the installation is complete, you can now build the Plugins and Widget.
npm run gulp build:widget
The compiled file can be found in the widget/app/
folder. Go to the Widget installation section for installation instructions.
Before building, you must set $is-widget
to 0
in plugin/scss/_variables.scss
:
$is-widget: 0;
To build the plugin you have two different options of building, according to the target browser you wish to build to:
webextensions
folder.npm run gulp build:webextensions
safari.safariextension
folder.npm run gulp build:safari
Note: You can also generate all the builds to all targets at once by running the command:
npm run gulp build
The Widget can be installed on your website by inserting a few snippets of code before closing the <body>
tag of a HTML page:
<body> <!-- Begin of the page body -->
... <!-- Content of the page -->
<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 src="https://github.com/spbgovbr-vlibras/vlibras-web-browsers/raw/dev/<your-directory-path>/app/vlibras-plugin.js"></script>
<script>
new window.VLibras.Widget();
</script>
</body> <!-- End of the page body -->
Note: The app folder can be copied to any directory, remember to enter the correct path for it.
When using the Widget, you can customize various aspects such as personalization, opacity, position, and avatar. Below are the available parameters:
Parameter | Default Value | Description |
---|---|---|
rootPath |
"https://vlibras.gov.br/app/" |
The base path for resources used by the Widget. Can be configured to point to a specific directory. In development, use your local path. |
personalization |
null |
Specifies a valid JSON URL for custom avatar configurations. |
opacity |
1 |
Controls the background opacity of the Widget. A value between 0 (completely transparent) and 1 (completely opaque). |
position |
"R" |
Sets the initial position of the Widget on the page. The valid values are: "TL" (top-left), "T" (top), "TR" (top-right), "R" (right), "BR" (bottom-right), "B" (bottom), "BL" (bottom-left), and "L" (left). |
avatar |
"icaro" |
Define the initial VLibras avatar. The available avatars are: "icaro", "hosana" and "guga". You can also use "random". |
Usage example:
new window.VLibras.Widget({
rootPath: "/app",
personalization: 'https://vlibras.gov.br/config/configs.json',
opacity: 0.75,
position: 'L',
avatar: 'random'
});
VLibras already has official versions of the plugins in the Chrome and Firefox extensions store. To use the version of the plugins built in your machine, see the extensions installation instructions on your browser's official page.
This project is licensed under the LGPLv3 License - see the LICENSE file for details.