diff --git a/.gitignore b/.gitignore index 7db56de..0d5d028 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ node_modules **/Thumbs.db **/*.crx -**/*.xpi \ No newline at end of file +**/*.xpi +**/*.safariextz diff --git a/Gulpfile.js b/Gulpfile.js index d8223d1..f63c198 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -10,6 +10,7 @@ var webglFiles = [ 'connect.js', 'load.js', 'verify-compatibility.js', + 'error.js', 'window.html', 'TemplateData/*', 'Release/*' @@ -17,15 +18,17 @@ var webglFiles = [ var webplayerFiles = [ 'window.html', - 'player.js', - 'WEBPLAYER.unity3d' + 'verify-compatibility.js', + 'webplayer.js', + 'webplayer.unity3d', + 'UnityObject2.js', + '../vendors/jquery.js' ]; var playerFiles = [ 'TemplateData/*', 'js/*', - 'vendors/qdclient/qdclient.js', - 'vendors/offline/offline.js' + 'vendors/qdclient/qdclient.js' ]; var webglTask = function(dest) { @@ -40,6 +43,10 @@ var webplayerTask = function(dest) { .pipe(gulp.dest(dest)); playerTask(dest); + + // Additional dependencies + gulp.src(['vendors/jquery/dist/jquery.min.js'], {base: 'player', cwd: 'player'}) + .pipe(gulp.dest(dest)); }; var playerTask = function(dest) { diff --git a/chrome/background.js b/chrome/background.js index 58a7fde..0f20230 100644 --- a/chrome/background.js +++ b/chrome/background.js @@ -20,7 +20,7 @@ chrome.contextMenus.onClicked.addListener( function (info) { url: "app/player/window.html", top: 10, left: 10, - width: 535, + width: 400, height: 500, type: "popup" }, function (w) { diff --git a/chrome/manifest.json b/chrome/manifest.json index 4f55e77..9c101ac 100644 --- a/chrome/manifest.json +++ b/chrome/manifest.json @@ -3,7 +3,7 @@ "name": "VLibras", "description": "Um tradutor de Português para LIBRAS.", - "version": "0.1.2", + "version": "0.2.0", "background": { "scripts": ["background.js"], diff --git a/firefox/index.js b/firefox/index.js index 93b1e0d..fe46808 100644 --- a/firefox/index.js +++ b/firefox/index.js @@ -36,7 +36,7 @@ cm.Item({ app.window = browser.open( self.data.url('player/window.html'), 'VLibras Plugin', - 'width=560,height=560,menubar=no' + 'width=400,height=500,menubar=no,resizable=yes' ); } else { app.worker.port.emit('selectedText', app.selectedText); diff --git a/firefox/package.json b/firefox/package.json index 1870f12..6eb4dbe 100644 --- a/firefox/package.json +++ b/firefox/package.json @@ -1,7 +1,7 @@ { "title": "VLibras Plugin", "name": "vlibras-plugin", - "version": "0.1.2", + "version": "0.2.0", "description": "Um tradutor de Português para LIBRAS", "main": "index.js", "author": "LAViD", diff --git a/player/TemplateData/About.png b/player/TemplateData/About.png new file mode 100644 index 0000000..42a02c2 Binary files /dev/null and b/player/TemplateData/About.png differ diff --git a/player/TemplateData/Close.png b/player/TemplateData/Close.png new file mode 100644 index 0000000..d349896 Binary files /dev/null and b/player/TemplateData/Close.png differ diff --git a/player/TemplateData/CounterOff.png b/player/TemplateData/CounterOff.png new file mode 100644 index 0000000..4610392 Binary files /dev/null and b/player/TemplateData/CounterOff.png differ diff --git a/player/TemplateData/CounterOn.png b/player/TemplateData/CounterOn.png new file mode 100644 index 0000000..fcb3701 Binary files /dev/null and b/player/TemplateData/CounterOn.png differ diff --git a/player/TemplateData/Gov.png b/player/TemplateData/Gov.png new file mode 100644 index 0000000..90f49a1 Binary files /dev/null and b/player/TemplateData/Gov.png differ diff --git a/player/TemplateData/LSD.png b/player/TemplateData/LSD.png new file mode 100644 index 0000000..2efd1b1 Binary files /dev/null and b/player/TemplateData/LSD.png differ diff --git a/player/TemplateData/Lavid.png b/player/TemplateData/Lavid.png new file mode 100644 index 0000000..ca2673b Binary files /dev/null and b/player/TemplateData/Lavid.png differ diff --git a/player/TemplateData/RNP.png b/player/TemplateData/RNP.png new file mode 100644 index 0000000..6afef55 Binary files /dev/null and b/player/TemplateData/RNP.png differ diff --git a/player/TemplateData/ToLeft.png b/player/TemplateData/ToLeft.png new file mode 100644 index 0000000..42c7284 Binary files /dev/null and b/player/TemplateData/ToLeft.png differ diff --git a/player/TemplateData/ToRight.png b/player/TemplateData/ToRight.png new file mode 100644 index 0000000..1326465 Binary files /dev/null and b/player/TemplateData/ToRight.png differ diff --git a/player/TemplateData/UF.png b/player/TemplateData/UF.png new file mode 100644 index 0000000..52875e3 Binary files /dev/null and b/player/TemplateData/UF.png differ diff --git a/player/TemplateData/UFCG.png b/player/TemplateData/UFCG.png new file mode 100644 index 0000000..29ca9a6 Binary files /dev/null and b/player/TemplateData/UFCG.png differ diff --git a/player/TemplateData/logo.png b/player/TemplateData/logo.png new file mode 100644 index 0000000..6d46d07 Binary files /dev/null and b/player/TemplateData/logo.png differ diff --git a/player/TemplateData/style.css b/player/TemplateData/style.css index 01513e4..e7574fc 100644 --- a/player/TemplateData/style.css +++ b/player/TemplateData/style.css @@ -9,7 +9,7 @@ html, body, #canvas { margin: 0; overflow: hidden; font-size: 70%; - line-height: 110%; + font-family: Arial, sans-serif; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; } @@ -43,6 +43,10 @@ html, body, #canvas { z-index: 9998; } +.message-box a { + color: inherit; +} + .message-box.info { background-color: #3b8bba; color: #ffffff; @@ -63,6 +67,136 @@ html, body, #canvas { color: #8c8c8c; } +#info-screen { + position: absolute; + left: 0; + top: 0; + + padding: 1em; + + width: 100%; + height: 100%; + + background-color: white; + color: black; + font-family: Arial, sans-serif; + text-align: center; + + align-items: center; + -webkit-align-items: center; + font-size: 2em; + + display: none; + + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +#info-screen.active { + display: -webkit-flex; +} + +#info-screen .arrow { + flex-grow: 1; + -webkit-flex-grow: 1; + visibility: hidden; +} + +#info-screen .arrow.active { + visibility: visible; +} + +#info-tabset { + flex-grow: 4; + display: -webkit-flex; + flex-direction: column; + -webkit-flex-direction: column; + padding: 0 1em; +} + +#info-main { + flex-direction: column; + -webkit-flex-direction: column; +} + +#info-realizadores { + flex-direction: row; + -webkit-flex-direction: row; + flex-wrap: wrap; + -webkit-flex-wrap: wrap; + justify-content: center; + -webkit-justify-content: center; +} + +#info-realizadores .logo { + margin-left: 2em; + width: 20%; + min-width: 60px; + max-width: 80px; +} + +#gov-logo.logo { + width: 100%; + margin-left: 0; + min-width: 200px; + max-width: 500px; +} + +#ufpb-logo { + width: 10%; +} + +.info-tab { + flex-grow: 3; + -webkit-flex-grow: 3; + display: none; +} + +.info-tab.active { + display: block; +} + +#info-meta p { + margin: .5em 0 0; +} + +#info-meta a { + text-decoration: none; +} + +.info-bullet:before { + content: url(CounterOff.png); +} + +.info-bullet.active:before { + content: url(CounterOn.png); +} + +#info-tab-bullets { + width: 100%; + height: 16px; + text-align: center; + flex-grow: 1; + -webkit-flex-grow: 1; + margin-top: 10%; +} + +#info-button { + position: fixed; + top: 7px; + right: 5px; + z-index: 8888; +} + +#info-button:before { + content: url(About.png); +} + +#info-button.active:before { + content: url(Close.png); +} + .message-box.active { top: 0; opacity: 1; diff --git a/player/bower.json b/player/bower.json index 1bfaeed..c088249 100644 --- a/player/bower.json +++ b/player/bower.json @@ -11,5 +11,7 @@ "devDependencies": { "qdclient": "git@git.lavid.ufpb.br:qdclient.git" }, - "dependencies": {} + "dependencies": { + "jquery": "~2.1.4" + } } diff --git a/player/js/loading.js b/player/js/loading.js index 0272c09..8ebf4be 100644 --- a/player/js/loading.js +++ b/player/js/loading.js @@ -1,19 +1,21 @@ -(function (window, document, Message) { +(function (window, document, MessageBox) { function Loading(selector, messageSelector) { this.element = document.querySelector(selector); - this.message = new Message(messageSelector); + this.box = new MessageBox(messageSelector); + + this.message = null; } Loading.prototype.show = function(message) { this.element.style.display = 'block'; - this.message.show('info', message); + this.message = this.box.show('info', message); }; Loading.prototype.hide = function() { this.element.style.display = 'none'; - this.message.hide(); + this.box.hide(this.message); }; window.Loading = Loading; -})(window, document, window.Message); \ No newline at end of file +})(window, document, window.MessageBox); \ No newline at end of file diff --git a/player/js/message-box.js b/player/js/message-box.js new file mode 100644 index 0000000..da84a48 --- /dev/null +++ b/player/js/message-box.js @@ -0,0 +1,61 @@ +(function(window, document) { + + function MessageBox(selectors) { + this.element = document.querySelector(selectors); + this.message = null; + + this.element.classList.add('message-box'); + + var self = this; + var closeElement = this.element.querySelector('.close'); + + if (closeElement) { + closeElement.addEventListener('click', function (e) { + self.hide(); + }); + } + + this.hide(); + } + + MessageBox.LEVELS = ['info', 'warning', 'success', 'default']; + + MessageBox.prototype.hide = function(message) { + if (message !== this.message) return; + + this.message = null; + this.element.classList.remove('active'); + + MessageBox.LEVELS.forEach(function(level) { + this.element.classList.remove(level); + }, this); + }; + + MessageBox.prototype.show = function(level, message, time) { + var self = this; + + level = MessageBox.LEVELS.indexOf(level) == -1 ? 'info' : level; + + this.hide(); + + self.element.classList.add('active'); + self.element.classList.add(level); + self.element.querySelector('.message').innerHTML = message; + + self.message = { + text: message + }; + + var ref = self.message; + if (time) { + setTimeout(function () { + self.hide(ref); + }, time + 1); + } + + return this.message; + }; + + // Expose + window.MessageBox = MessageBox; +})(window, document); \ No newline at end of file diff --git a/player/js/message.js b/player/js/message.js deleted file mode 100644 index 8b2c12e..0000000 --- a/player/js/message.js +++ /dev/null @@ -1,50 +0,0 @@ -(function(window, document) { - - function Message(selectors) { - this.element = document.querySelector(selectors); - - this.element.classList.add('message-box'); - - var self = this; - var closeElement = this.element.querySelector('.close'); - - if (closeElement) { - closeElement.addEventListener('click', function (e) { - self.hide(); - }); - } - - this.hide(); - } - - Message.LEVELS = ['info', 'warning', 'success', 'default']; - - Message.prototype.hide = function() { - this.element.classList.remove('active'); - - Message.LEVELS.forEach(function(level) { - this.element.classList.remove(level); - }, this); - }; - - Message.prototype.show = function(level, message, time) { - var self = this; - - level = Message.LEVELS.indexOf(level) == -1 ? 'info' : level; - - this.hide(); - - self.element.classList.add('active'); - self.element.classList.add(level); - self.element.querySelector('.message').innerHTML = message; - - if (time) { - setTimeout(function () { - self.hide(); - }, time + 1); - } - }; - - // Expose - window.Message = Message; -})(window, document); \ No newline at end of file diff --git a/player/js/scripts.js b/player/js/scripts.js new file mode 100644 index 0000000..7ee0088 --- /dev/null +++ b/player/js/scripts.js @@ -0,0 +1,36 @@ +(function() { + var info = document.getElementById('info-screen'); + var main = document.getElementById('info-main'); + var realizadores = document.getElementById('info-realizadores'); + var left = document.querySelector('.arrow-left'); + var right = document.querySelector('.arrow-right'); + var bullets = document.querySelectorAll('.info-bullet'); + var info_button = document.getElementById('info-button'); + + info_button.addEventListener('click', function() { + info.classList.toggle('active'); + this.classList.toggle('active'); + }); + + left.addEventListener('click', function() { + realizadores.classList.remove('active'); + main.classList.add('active'); + + this.classList.remove('active'); + right.classList.add('active'); + + bullets[1].classList.remove('active'); + bullets[0].classList.add('active'); + }); + + right.addEventListener('click', function() { + main.classList.remove('active'); + realizadores.classList.add('active'); + + this.classList.remove('active'); + left.classList.add('active'); + + bullets[0].classList.remove('active'); + bullets[1].classList.add('active'); + }); +})(); \ No newline at end of file diff --git a/player/js/vlibras-plugin.js b/player/js/vlibras-plugin.js index 80ba6d9..e46367c 100644 --- a/player/js/vlibras-plugin.js +++ b/player/js/vlibras-plugin.js @@ -1,10 +1,10 @@ -(function(window, document, Loading, Message) { +(function(window, document, Loading, MessageBox) { function VLibrasPlugin() { this.loaded = false; this.chooser = new qdClient.Chooser(); this.glosa = undefined; this.loading = new Loading('#loading-screen', '#message-box'); - this.message = new Message('#message-box'); + this.message = new MessageBox('#message-box'); this.lastReq = { url: null, millis: null, @@ -65,9 +65,18 @@ this.sendGlosa(); }; + VLibrasPlugin.prototype.errorHandler = function() { + console.log('ErrorHandler!'); + this.message.show('warning', 'Ops! Ocorreu um problema, por favor entre em contato com a gente.'); + }; + // Expose window.VLibrasPlugin = new VLibrasPlugin(); + window.onerror = function() { + this.VLibrasPlugin.errorHandler(); + }; + window.onLoadPlayer = function() { this.VLibrasPlugin.load(); }; -})(window, document, Loading, Message); +})(window, document, Loading, MessageBox); diff --git a/player/webgl/connect.js b/player/webgl/connect.js index e332844..46b748b 100644 --- a/player/webgl/connect.js +++ b/player/webgl/connect.js @@ -1,6 +1,6 @@ // connect to canvas var Module = { - TOTAL_MEMORY: 268435456, + TOTAL_MEMORY: 314572800, filePackagePrefixURL: "Release/", memoryInitializerPrefixURL: "Release/", preRun: [], @@ -16,7 +16,7 @@ canvas: document.getElementById('canvas'), progress: null, setStatus: function(text) { - if (this.progress == null) + if (this.progress == null) { if (typeof UnityProgress != 'function') return; @@ -28,7 +28,7 @@ var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/); if (m) this.progress.SetProgress (parseInt(m[2])/parseInt(m[4])); - if (text === "") + if (text === "") this.progress.Clear() }, totalDependencies: 0, diff --git a/player/webgl/load.js b/player/webgl/load.js index 53ce991..4242251 100644 --- a/player/webgl/load.js +++ b/player/webgl/load.js @@ -7,7 +7,7 @@ if (!(!Math.fround)) { codeXHR.open('GET', 'Release/WEBGL.js', true); codeXHR.onload = function() { var code = codeXHR.responseText; - if (!Math.fround) { + if (!Math.fround) { try { console.log('optimizing out Math.fround calls'); var m = /var ([^=]+)=global\.Math\.fround;/.exec(code); diff --git a/player/webgl/verify-compatibility.js b/player/webgl/verify-compatibility.js index 52e4d93..bd8c509 100644 --- a/player/webgl/verify-compatibility.js +++ b/player/webgl/verify-compatibility.js @@ -11,7 +11,7 @@ }; if (!checkWebGLCompability()) { - VLibrasPlugin.showMessage('warning', 'O seu computador não suporta o WebGL. Porfavor atualizar os drivers de vídeo.'); + VLibrasPlugin.showMessage('warning', 'O seu computador não suporta o WebGL. Por favor, atualize os drivers de vídeo.'); window.stop(); }; })(); \ No newline at end of file diff --git a/player/webgl/window.html b/player/webgl/window.html index 0bd6e68..5570056 100644 --- a/player/webgl/window.html +++ b/player/webgl/window.html @@ -2,7 +2,6 @@
-Versão 2.0.0
+ http://vlibrasplayer.lavid.ufpb.br +O VLibras é uma ferramenta aberta de distribuição livre, desenvolvida para melhorar o acesso à informação das pessoas surdas brasileiras.
+Qualquer dúvida ou questionamento, envie uma mensagem para o Núcleo de Pesquisa e Extensão LAViD - Centro de Informática - UFPB através do e-mail. contato@lavid.ufpb.br
+Versão 2.0.0
+ http://vlibrasplayer.lavid.ufpb.br +O VLibras é uma ferramenta aberta de distribuição livre, desenvolvida para melhorar o acesso à informação das pessoas surdas brasileiras.
+Qualquer dúvida ou questionamento, envie uma mensagem para o Núcleo de Pesquisa e Extensão LAViD - Centro de Informática - UFPB através do e-mail. contato@lavid.ufpb.br
+