```
diff --git a/VLibrasWeb/vlibras-web.css b/VLibrasWeb/vlibras-web.css
index 53f28dc..9787d70 100644
--- a/VLibrasWeb/vlibras-web.css
+++ b/VLibrasWeb/vlibras-web.css
@@ -2,7 +2,7 @@
position: fixed;
right: 0;
top: 50%;
- margin-top: -225px;
+ margin-top: -285px;
z-index: 999999999999;
display: none;
font-family: Arial;
@@ -168,6 +168,26 @@
content: ">";
}
+.vlibras-widget .vw-links {
+ background-color: #fff;
+ width: 100%;
+ max-height: 120px;
+ overflow: auto;
+ display: none;
+}
+
+.vw-links.active {
+ display: block;
+}
+
+.vw-links ul {
+ list-style: none;
+}
+
+.vw-links li {
+ padding: .5em 0;
+}
+
.vlibras-widget .vw-controls {
width: 100%;
padding: 8.5px 10px;
diff --git a/VLibrasWeb/vlibras-web.js b/VLibrasWeb/vlibras-web.js
index 9fb3ebf..7268297 100644
--- a/VLibrasWeb/vlibras-web.js
+++ b/VLibrasWeb/vlibras-web.js
@@ -30,6 +30,7 @@
var vwClose = vwPlayer.querySelector('.vw-btn-close');
var vwSide = vwPlayer.querySelector('.vw-btn-side');
var vwControls = vwPlayer.querySelector('.vw-controls');
+ var vwLinks = vwPlayer.querySelector('.vw-links');
var vwCanvas = vwPlayer.querySelector('.vw-canvas-wrapper');
var vwSubtitle = vwPlayer.querySelector('.vw-subtitle');
var vwLoading = vwPlayer.querySelector('.vw-loading');
@@ -148,6 +149,40 @@
minimize();
});
+
+ function hasParent(el, fn) {
+ var node = el.parentNode;
+ while ( node != null ) {
+ if (fn(node)) return node;
+ node = node.parentNode;
+ }
+
+ return false;
+ }
+
+ function showLinks(content) {
+ var links = Array.prototype.slice.call(content.querySelectorAll('a'));
+ var linksList = vwLinks.querySelector('ul');
+
+ var link = hasParent(content, function (parent) { return parent.tagName == 'A'; });
+ if (link) {
+ links.push(link);
+ }
+
+ linksList.innerHTML = '';
+ for(var i = 0; i < links.length; i++) {
+ var link = links[i];
+ var li = document.createElement('li');
+ li.innerHTML = '' + link.textContent + '';
+ linksList.appendChild(li);
+ }
+
+ if (links.length > 0) {
+ vwLinks.classList.add('active');
+ } else {
+ vwLinks.classList.remove('active');
+ }
+ }
function addTagsTexts() {
getAllNodeTexts(document.body, function (node) {
@@ -164,6 +199,8 @@
vwProgress.style.width = 0;
VLibrasWeb.lastTextElement = this.parentNode;
+ showLinks(this);
+
window.VLibrasPlayer.stop();
window.VLibrasPlayer.translate(this.textContent);
diff --git a/sample.html b/sample.html
index be0af17..e5c700b 100644
--- a/sample.html
+++ b/sample.html
@@ -3,9 +3,15 @@
+ ola!
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo odio ratione, numquam. Quisquam ex, nemo ea necessitatibus laudantium, rem natus officiis dignissimos a repudiandae, quam doloribus voluptatibus commodi sed aperiam.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo odio ratione, numquam. Quisquam ex, nemo ea necessitatibus laudantium, rem natus officiis dignissimos a repudiandae, quam doloribus voluptatibus commodi sed aperiam.
-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum tempore error molestiae totam provident incidunt voluptates iste corrupti sed rerum alias id commodi, suscipit nobis eveniet, possimus consectetur a sapiente?
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum tempore error molestiae totam provident incidunt voluptates iste corrupti sed rerum alias id commodi, suscipit nobis eveniet, possimus consectetur a sapiente?