Commit 06dd693a3a158e0c2eb0132803501a33e7a2803b

Authored by David Guilherme
2 parents 00f61b5c a9d2d949
Exists in master

Merge branch 'master' of git.lavid.ufpb.br:vlibras-plugin2

Showing 53 changed files with 645 additions and 932 deletions   Show diff stats
1 chrome/app/player 1 chrome/app/player
2 firefox/data/player 2 firefox/data/player
  3 +safari.safariextension/app/player
3 4
4 -player/Release 5 +webgl/Release
  6 +webgl/vendors
  7 +webplayer/vendors
5 8
6 node_modules 9 node_modules
  10 +
  11 +**/.DS_Store
7 \ No newline at end of file 12 \ No newline at end of file
1 var gulp = require('gulp'); 1 var gulp = require('gulp');
2 2
3 -var playerFiles = [ 3 +var playersPath = {
  4 + chrome: 'chrome/app/player',
  5 + firefox: 'firefox/data/player',
  6 + safari: 'safari.safariextension/app/player'
  7 +};
  8 +
  9 +var webglOptions = {
  10 + base: 'webgl',
  11 + cwd: 'webgl'
  12 +};
  13 +
  14 +var webglFiles = [
4 'connect.js', 15 'connect.js',
5 'load.js', 16 'load.js',
6 'window.html', 17 'window.html',
@@ -10,12 +21,30 @@ var playerFiles = [ @@ -10,12 +21,30 @@ var playerFiles = [
10 'js/*' 21 'js/*'
11 ]; 22 ];
12 23
  24 +var webplayerOptions = {
  25 + base: 'webplayer',
  26 + cwd: 'webplayer'
  27 +};
  28 +
  29 +var webplayerFiles = [
  30 + 'window.html',
  31 + 'player.js',
  32 + 'WEBPLAYER.unity3d',
  33 + 'vendors/**/*',
  34 + 'TemplateData/*'
  35 +];
  36 +
13 gulp.task('chrome', function() { 37 gulp.task('chrome', function() {
14 - gulp.src(playerFiles, { base: '.', cwd: 'player/' })  
15 - .pipe(gulp.dest('chrome/app')); 38 + gulp.src(webglFiles, webglOptions)
  39 + .pipe(gulp.dest(playersPath.chrome));
16 }); 40 });
17 41
18 gulp.task('firefox', function() { 42 gulp.task('firefox', function() {
19 - gulp.src(playerFiles, { base: '.', cwd: 'player/' })  
20 - .pipe(gulp.dest('firefox/data')); 43 + gulp.src(webglFiles, webglOptions)
  44 + .pipe(gulp.dest(playersPath.firefox));
21 }); 45 });
  46 +
  47 +gulp.task('safari', function() {
  48 + gulp.src(webplayerFiles, webplayerOptions)
  49 + .pipe(gulp.dest(playersPath.safari));
  50 +});
22 \ No newline at end of file 51 \ No newline at end of file
README.md 0 → 100644
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
  1 +## VLibras Plugin
  2 +
  3 +VLibras Plugin é uma ferramenta de tradução de português para LIBRAS. Com suporte para os navegadores: Chrome, Firefox e Safari.
  4 +
  5 +Instalação
  6 +--------------
  7 +
  8 +1. Instale as dependências
  9 +
  10 +```bash
  11 +$ npm install -g gulp
  12 +$ npm install
  13 +$ cd webgl/ && bower install
  14 +$ cd ..
  15 +$ cd webplayer/ && bower install
  16 +```
  17 +
  18 +2. Copie o player adequado para a pasta do navegador especifico
  19 +
  20 +```bash
  21 +$ gulp [navegador]
  22 +```
  23 +
  24 +3. Importe o projeto de cada navegador em suas espicificas plataformas
  25 +
  26 +** Enjoy **
0 \ No newline at end of file 27 \ No newline at end of file
chrome/background.js
@@ -12,6 +12,8 @@ chrome.contextMenus.create({ @@ -12,6 +12,8 @@ chrome.contextMenus.create({
12 12
13 // Listening the event click 13 // Listening the event click
14 chrome.contextMenus.onClicked.addListener( function (info) { 14 chrome.contextMenus.onClicked.addListener( function (info) {
  15 + selectedText = info.selectionText;
  16 +
15 // Creates the window if it exists 17 // Creates the window if it exists
16 if ( popup === undefined ) { 18 if ( popup === undefined ) {
17 chrome.windows.create({ 19 chrome.windows.create({
@@ -23,12 +25,11 @@ chrome.contextMenus.onClicked.addListener( function (info) { @@ -23,12 +25,11 @@ chrome.contextMenus.onClicked.addListener( function (info) {
23 type: "popup" 25 type: "popup"
24 }, function (w) { 26 }, function (w) {
25 popup = w; 27 popup = w;
26 -  
27 - selectedText = info.selectionText;  
28 }); 28 });
29 } else { 29 } else {
30 chrome.windows.update(popup.id, {focused: true}, function () { 30 chrome.windows.update(popup.id, {focused: true}, function () {
31 - chrome.runtime.sendMessage({selectedText: info.selectionText}); 31 + chrome.runtime.sendMessage({selectedText: selectedText});
  32 + selectedText = undefined;
32 }); 33 });
33 } 34 }
34 }); 35 });
keys/vlibrasplugin-chrome.pem 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 +-----BEGIN PRIVATE KEY-----
  2 +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8UI+z9pRhF8Kv
  3 +WC3Y2eI41b4AJeROjrO3rVeBG+FYjMuOB0r1byFUlebGP/Nep7nZ9eEUZ4E71lkp
  4 +WDyYLfZTb+gum6MQAeh8Wd7aBh9qSa4ru08ieu/8HxmHdfUFpWph3yPMV0TdAXVh
  5 +sbMLWcvzu+AmEkPM09KtXENyAOkR63ncll7HtmGFdxicTzNWuIhrvrhsd1xtuS1c
  6 +g4vk1XEJ5mcSnVLVGojAI8uwY4QEAGC2bUMzmD6mtZxySHu5XxNnk1xFdTxebd1K
  7 +4u0HyDgpY7epRsnkYHQq9HZ7Smet2JW4tHmd/5nPMZXFztZ/bUSuOqAmXvmLXvmw
  8 +JSpVnEENAgMBAAECggEAVCmFMB8iDYq6/fbg9qvaSSBt/E7zDJEGjS6xjwhQ3GyA
  9 +hQeJXsu+D7m3HB90u3cmvtz/LUldHssbqji/TBwunPfEwx/X7s2LhBf+W16lJ7Gq
  10 +X+0k3vomy31ywXHcght9wiQiMa9HHacLORBcPtRxLItpEFrVZnO9ErHLiuYRRGo+
  11 +EKP79o1dVZ5kldJ7toB4ok+KIDu2PJJShj4nXj7mKNlGZPH2hYn+NG7ZLFOjUp09
  12 +AKjTIE5WADt5bOKN9Wo2HiCG63zLZsaJmeYh2v3TxnpAj+W/TMxV/y0kIe7gzqw1
  13 +2qxdBmLBILNM8AkwadpbJRuC6aynd41sqejix3uemQKBgQDzONGl0Yf8fg5EyX3r
  14 +w/OldzZv/Comy6Ka/aq8I88clFBlEoD2os+lF6IDAgMj102awjiI+fxOe81C7Pza
  15 +a5eGHeq3qaE0E7v7ggcW7YXlFs9YC6RikKEkGCFnnaxeBf+/iXICcf32GzZkSow2
  16 +JTedIJIbu/oca2UFpVsK4inkHwKBgQDGNUZMmJ1ca4WdpmP6mUCwqEgOZ+UcG/3K
  17 +4Sy0BtJOB1wVoQOzM1q2FUurCqps81cghUbtJyeRk4y4eI1rOEbz8m0UB0hWyEq1
  18 +pJJiz0nei7ficAIHO5e2elDV2lJ7KNxYeb3YN2NXbGmwmsI/IoudPp+wghnl4Xns
  19 +2JcBFZdVUwKBgQCBDcb/6xvyt5gum5M7BDBFvemepfhfuXFAOBTd20pL6c52ssjH
  20 +FUCEYvPOEMVFwTomQaPp2msr4bjaKBFKfAhcW4dtiI5Gqan3G9lTKxj+o4nFN/gz
  21 +bHZ0RnGDH0CUay52nSFndsDAU1QbBws6t6i4sM2V9boSVlG2GzUhozuDFQKBgG2P
  22 +kTZRvdoSTR9hlC43fDyqKHpeD5TEHDuC0HUKuEENbGdAQ41Qu7med98p3B6xO93s
  23 +DdKVLBgaGVT2viUgTIgX3xeNFv1xZWqWd5xKvKhZTuHJzDU3SZtCbWBod+NAKNx3
  24 +HutfYng2ow1N3kWL0OSwcxDcOXiKdBzpdD7TMn2lAoGAH3xcQ9pI1aCeNxrnyvsJ
  25 +1EFlSX+3HQvjd9JOVemiVd6jP5SbrM6DplzimYPVmJhlAcq+wi8/dHyOGMRCb7ZV
  26 +Yv44hSheny/RhfMcePwubLBhVULRrdg2LWOEnSgrLIWNe2CCJ+xzgr2mEM+vGazI
  27 +zVWbI5s+shUi96/ZSZMjxGo=
  28 +-----END PRIVATE KEY-----
player/.bowerrc
@@ -1,3 +0,0 @@ @@ -1,3 +0,0 @@
1 -{  
2 - "directory": "vendors"  
3 -}  
player/TemplateData/UnityProgress.js
@@ -1,97 +0,0 @@ @@ -1,97 +0,0 @@
1 -function UnityProgress (dom) {  
2 - this.progress = 0.0;  
3 - this.message = "";  
4 - this.dom = dom;  
5 -  
6 - var parent = dom.parentNode;  
7 -  
8 - var background = document.createElement("div");  
9 - background.style.background = "#FFFFFF";  
10 - background.style.position = "absolute";  
11 - parent.appendChild(background);  
12 - this.background = background;  
13 -  
14 - var logoImage = document.createElement("img");  
15 - logoImage.src = "TemplateData/progresslogo.png";  
16 - logoImage.style.position = "absolute";  
17 - parent.appendChild(logoImage);  
18 - this.logoImage = logoImage;  
19 -  
20 - var progressFrame = document.createElement("img");  
21 - progressFrame.src = "TemplateData/loadingbar.png";  
22 - progressFrame.style.position = "absolute";  
23 - parent.appendChild(progressFrame);  
24 - this.progressFrame = progressFrame;  
25 -  
26 - var progressBar = document.createElement("img");  
27 - progressBar.src = "TemplateData/fullbar.png";  
28 - progressBar.style.position = "absolute";  
29 - parent.appendChild(progressBar);  
30 - this.progressBar = progressBar;  
31 -  
32 - var messageArea = document.createElement("p");  
33 - messageArea.style.position = "absolute";  
34 - parent.appendChild(messageArea);  
35 - this.messageArea = messageArea;  
36 -  
37 -  
38 - this.SetProgress = function (progress) {  
39 - if (this.progress < progress)  
40 - this.progress = progress;  
41 - this.messageArea.style.display = "none";  
42 - this.progressFrame.style.display = "inline";  
43 - this.progressBar.style.display = "inline";  
44 - this.Update();  
45 - }  
46 -  
47 - this.SetMessage = function (message) {  
48 - this.message = message;  
49 - this.background.style.display = "inline";  
50 - this.logoImage.style.display = "inline";  
51 - this.progressFrame.style.display = "none";  
52 - this.progressBar.style.display = "none";  
53 - this.Update();  
54 - }  
55 -  
56 - this.Clear = function() {  
57 - this.background.style.display = "none";  
58 - this.logoImage.style.display = "none";  
59 - this.progressFrame.style.display = "none";  
60 - this.progressBar.style.display = "none";  
61 - }  
62 -  
63 - this.Update = function() {  
64 - this.background.style.top = this.dom.offsetTop + 'px';  
65 - this.background.style.left = this.dom.offsetLeft + 'px';  
66 - this.background.style.width = this.dom.offsetWidth + 'px';  
67 - this.background.style.height = this.dom.offsetHeight + 'px';  
68 -  
69 - var logoImg = new Image();  
70 - logoImg.src = this.logoImage.src;  
71 - var progressFrameImg = new Image();  
72 - progressFrameImg.src = this.progressFrame.src;  
73 -  
74 - this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';  
75 - this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';  
76 - this.logoImage.style.width = logoImg.width+'px';  
77 - this.logoImage.style.height = logoImg.height+'px';  
78 -  
79 - this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';  
80 - this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';  
81 - this.progressFrame.width = progressFrameImg.width;  
82 - this.progressFrame.height = progressFrameImg.height;  
83 -  
84 - this.progressBar.style.top = this.progressFrame.style.top;  
85 - this.progressBar.style.left = this.progressFrame.style.left;  
86 - this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);  
87 - this.progressBar.height = progressFrameImg.height;  
88 -  
89 - this.messageArea.style.top = this.progressFrame.style.top;  
90 - this.messageArea.style.left = 0;  
91 - this.messageArea.style.width = '100%';  
92 - this.messageArea.style.textAlign = 'center';  
93 - this.messageArea.innerHTML = this.message;  
94 - }  
95 -  
96 - this.Update ();  
97 -}  
98 \ No newline at end of file 0 \ No newline at end of file
player/TemplateData/default-cover.jpg

51.6 KB

player/TemplateData/favicon.png

18.4 KB

player/TemplateData/fullbar.png

2.71 KB

player/TemplateData/loadingbar.png

2.78 KB

player/TemplateData/progresslogo.png

20.7 KB

player/TemplateData/style.css
@@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
1 -  
2 -/****************************************  
3 - ==== Player Styling  
4 -****************************************/  
5 -  
6 -html,body,div,canvas { margin: 0; padding: 0; }  
7 -::-moz-selection { color: #333; text-shadow: none; }  
8 -::selection { color: #333; text-shadow: none; }  
9 -.clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }  
10 -.clear { display: inline-table; clear: both; }  
11 -/* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */  
12 -  
13 -html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }  
14 -body { }  
15 -p.header, p.footer { display: none; }  
16 -div.logo { width: 196px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }  
17 -div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }  
18 -.template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }  
19 -.template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }  
20 -.fullscreen { float: right; position: relative; z-index: 10; }  
21 -  
22 -body.template { }  
23 -.template .template-wrap { }  
24 -.template .template-wrap canvas { }  
25 -  
26 -/****************************************  
27 - ==== Overriding  
28 -****************************************/  
29 -html, #canvas, .template, .template-wrap {  
30 - width: 100%;  
31 - height: 100%;  
32 - margin: 0;  
33 - overflow: hidden;  
34 -}  
35 -  
36 -#loading-screen {  
37 - position: absolute;  
38 - top: 0;  
39 - left: 0;  
40 - display: none;  
41 - width: 100%;  
42 - height: 100%;  
43 - z-index: 9999;  
44 -}  
45 -  
46 -.message {  
47 - position: fixed;  
48 - top: 0;  
49 - left: 0;  
50 - width: 100%;  
51 - padding: 1em 0.5em;  
52 -}  
53 -  
54 -.message .info {  
55 - background-color: #3b8bba;  
56 -}  
57 -  
58 -.message .hidden {  
59 - display: none;  
60 -}  
61 -  
62 -.message .warning {  
63 - background-color: #f08a24;  
64 -}  
65 \ No newline at end of file 0 \ No newline at end of file
player/bower.json
@@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
1 -{  
2 - "name": "vlibras-player",  
3 - "version": "0.0.1",  
4 - "ignore": [  
5 - "**/.*",  
6 - "node_modules",  
7 - "bower_components",  
8 - "test",  
9 - "tests"  
10 - ],  
11 - "devDependencies": {  
12 - "qdclient": "git@git.lavid.ufpb.br:qdclient.git"  
13 - }  
14 -}  
player/connect.js
@@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
1 -// connect to canvas  
2 - var Module = {  
3 - TOTAL_MEMORY: 268435456,  
4 - filePackagePrefixURL: "Release/",  
5 - memoryInitializerPrefixURL: "Release/",  
6 - preRun: [],  
7 - postRun: [],  
8 - print: (function() {  
9 - return function(text) {  
10 - console.log (text);  
11 - };  
12 - })(),  
13 - printErr: function(text) {  
14 - console.error (text);  
15 - },  
16 - canvas: document.getElementById('canvas'),  
17 - progress: null,  
18 - setStatus: function(text) {  
19 - if (this.progress == null)  
20 - {  
21 - if (typeof UnityProgress != 'function')  
22 - return;  
23 - this.progress = new UnityProgress (canvas);  
24 - }  
25 - if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };  
26 - if (text === Module.setStatus.text) return;  
27 - this.progress.SetMessage (text);  
28 - var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);  
29 - if (m)  
30 - this.progress.SetProgress (parseInt(m[2])/parseInt(m[4]));  
31 - if (text === "")  
32 - this.progress.Clear()  
33 - },  
34 - totalDependencies: 0,  
35 - monitorRunDependencies: function(left) {  
36 - this.totalDependencies = Math.max(this.totalDependencies, left);  
37 - Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');  
38 - }  
39 - };  
40 - Module.setStatus('Downloading (0.0/1)');  
player/load.js
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -if (!(!Math.fround)) {  
2 - var script = document.createElement('script');  
3 - script.src = "Release/WEBGL.js";  
4 - document.body.appendChild(script);  
5 -} else {  
6 - var codeXHR = new XMLHttpRequest();  
7 - codeXHR.open('GET', 'Release/WEBGL.js', true);  
8 - codeXHR.onload = function() {  
9 - var code = codeXHR.responseText;  
10 - if (!Math.fround) {  
11 -try {  
12 - console.log('optimizing out Math.fround calls');  
13 - var m = /var ([^=]+)=global\.Math\.fround;/.exec(code);  
14 - var minified = m[1];  
15 - if (!minified) throw 'fail';  
16 - var startAsm = code.indexOf('// EMSCRIPTEN_START_FUNCS');  
17 - var endAsm = code.indexOf('// EMSCRIPTEN_END_FUNCS');  
18 - var asm = code.substring(startAsm, endAsm);  
19 - do {  
20 - var moar = false; // we need to re-do, as x(x( will not be fixed  
21 - asm = asm.replace(new RegExp('[^a-zA-Z0-9\\$\\_]' + minified + '\\(', 'g'), function(s) { moar = true; return s[0] + '(' });  
22 - } while (moar);  
23 - code = code.substring(0, startAsm) + asm + code.substring(endAsm);  
24 - code = code.replace("'use asm'", "'almost asm'");  
25 -} catch(e) { console.log('failed to optimize out Math.fround calls ' + e) }  
26 - }  
27 -  
28 - var blob = new Blob([code], { type: 'text/javascript' });  
29 - codeXHR = null;  
30 - var src = URL.createObjectURL(blob);  
31 - var script = document.createElement('script');  
32 - script.src = URL.createObjectURL(blob);  
33 - script.onload = function() {  
34 - URL.revokeObjectURL(script.src);  
35 - };  
36 - document.body.appendChild(script);  
37 - };  
38 - codeXHR.send(null);  
39 -}  
player/vendors/qdclient/.bower.json
@@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
1 -{  
2 - "name": "qdclient",  
3 - "main": [  
4 - "qdclient.js"  
5 - ],  
6 - "ignore": [  
7 - "**/.*",  
8 - "Gulpfile.js",  
9 - "demo",  
10 - "node_modules",  
11 - "vendor",  
12 - "tests"  
13 - ],  
14 - "devDependencies": {  
15 - "mocha": "~2.2.5",  
16 - "chai": "~3.0.0"  
17 - },  
18 - "_release": "2b32d629d0",  
19 - "_resolution": {  
20 - "type": "branch",  
21 - "branch": "master",  
22 - "commit": "2b32d629d0a6c4818ad5dd53c22bd000d37a7893"  
23 - },  
24 - "_source": "git@git.lavid.ufpb.br:qdclient.git",  
25 - "_target": "*",  
26 - "_originalSource": "git@git.lavid.ufpb.br:qdclient.git"  
27 -}  
28 \ No newline at end of file 0 \ No newline at end of file
player/vendors/qdclient/README
@@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
1 -qdClient  
2 -=========  
3 -  
4 -1. Tools  
5 -----------------  
6 -  
7 -1. NodeJS  
8 -2. NPM - Node Package Manager  
9 -3. Bower - Frontend dependencies  
10 -4. Gulp - Build tools  
11 -  
12 -2. Installing dependencies  
13 -----------------  
14 -  
15 -```bash  
16 -$ npm install  
17 -$ bower install  
18 -```  
19 -  
20 -3. Demo  
21 -----------------  
22 -```bash  
23 -$ gulp demo  
24 -```  
25 -  
26 -4. Building  
27 -----------------  
28 -```bash  
29 -$ gulp build  
30 -```  
31 -  
32 -**Enjoy**  
player/vendors/qdclient/bower.json
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -{  
2 - "name": "qdclient",  
3 - "version": "0.0.1",  
4 - "main": [  
5 - "qdclient.js"  
6 - ],  
7 - "ignore": [  
8 - "**/.*",  
9 - "Gulpfile.js",  
10 - "demo",  
11 - "node_modules",  
12 - "vendor",  
13 - "tests"  
14 - ],  
15 - "devDependencies": {  
16 - "mocha": "~2.2.5",  
17 - "chai": "~3.0.0"  
18 - }  
19 -}  
player/vendors/qdclient/lib/chooser.js
@@ -1,222 +0,0 @@ @@ -1,222 +0,0 @@
1 -(function(window, localStorage, undefined) {  
2 - 'use strict';  
3 -  
4 - function Chooser() {  
5 - this.server = 'http://150.165.204.39/vlibras-cloud/get_servers.php';  
6 -  
7 - this.options = {  
8 - THRESHOLDSLOW: 2000,  
9 - SLOWLIMITTRIES: 5,  
10 - NBESTHEURISTIC1: 2,  
11 - QUANTITYPREVIOUSTIMESSTORED: 10  
12 - };  
13 -  
14 - this.mirrors = [];  
15 -  
16 - this.heuristics = {  
17 - FIRSTHEURISTIC: {  
18 - FIRSTRANDOM : {value: 0, name: "Random"},  
19 - FIRSTRANDOMNBEST: {value: 1, name: "Random Among N Best"},  
20 - FIRSTBEST : {value: 2, name: "Best"}  
21 - },  
22 - SECONDHEURISTIC: {  
23 - SECONDRANDOM : {value: 0, name: "Random"},  
24 - SECONDCLOSEST: {value: 1, name: "Closest"}  
25 - },  
26 - THIRDHEURISTIC: {  
27 - THIRDSIMPLEAVERAGE : {value: 0, name: "Simple Average"},  
28 - THIRDWEIGHTEDAVERAGE: {value: 1, name: "Weighted Average"}  
29 - }  
30 - };  
31 - }  
32 -  
33 - // Exports  
34 - qdClient.Chooser = Chooser;  
35 -  
36 - Chooser.prototype.choose = function(urlLast, millisLast, response, callback) {  
37 - var $this = this;  
38 -  
39 - this.loadMirrors_(function() {  
40 - $this.chooseServer_(urlLast, millisLast, response, callback);  
41 - });  
42 - };  
43 -  
44 - Chooser.prototype.chooseServer_ = function(urlLast, millisLast, response, callback) {  
45 - var firstHeuristic = this.heuristics.FIRSTHEURISTIC.FIRSTBEST;  
46 - var secondHeuristic = this.heuristics.SECONDHEURISTIC.SECONDRANDOM;  
47 - var thirdHeuristic = this.heuristics.THIRDHEURISTIC.THIRDWEIGHTEDAVERAGE;  
48 -  
49 - var j = 0, i = 0; /* Fix JSHint */  
50 -  
51 - var sizeBest = this.options.NBESTHEURISTIC1;  
52 - if (firstHeuristic == this.heuristics.FIRSTHEURISTIC.FIRSTBEST) {  
53 - sizeBest = 1;  
54 - }  
55 -  
56 - if (urlLast && urlLast.length > 0) {  
57 - for (i = 0; i < this.mirrors.length; i++) {  
58 - if (this.mirrors[i].url.toLowerCase() == urlLast.toLowerCase()) {  
59 - if (this.mirrors[i].previousTimes.length < this.options.QUANTITYPREVIOUSTIMESSTORED) {  
60 - this.mirrors[i].previousTimes[this.mirrors[i].previousTimes.length] = millisLast;  
61 - } else {  
62 - for (j = this.options.QUANTITYPREVIOUSTIMESSTORED-1; j > 0; j--) {  
63 - this.mirrors[i].previousTimes[j-1] = this.mirrors[i].previousTimes[j];  
64 - }  
65 -  
66 - this.mirrors[i].previousTimes[this.options.QUANTITYPREVIOUSTIMESSTORED-1] = millisLast;  
67 - }  
68 -  
69 - if (thirdHeuristic == this.heuristics.THIRDHEURISTIC.THIRDSIMPLEAVERAGE) {  
70 - var totalMillis = 0;  
71 - for (j = 0; j < this.mirrors[i].previousTimes.length; j++) {  
72 - totalMillis += this.mirrors[i].previousTimes[j];  
73 - }  
74 -  
75 - this.mirrors[i].averageTime = totalMillis/this.mirrors[i].previousTimes.length;  
76 - } else if (thirdHeuristic == this.heuristics.THIRDHEURISTIC.THIRDWEIGHTEDAVERAGE) {  
77 - var totalMillisAndWeights = 0;  
78 - var totalWeights = 0;  
79 - for (j = 0; j < this.mirrors[i].previousTimes.length; j++) {  
80 - totalMillisAndWeights += this.mirrors[i].previousTimes[j]*(j+1);  
81 - totalWeights += (j+1);  
82 - }  
83 -  
84 - this.mirrors[i].averageTime = totalMillisAndWeights/totalWeights;  
85 - }  
86 -  
87 - if (millisLast > this.options.THRESHOLDSLOW || response == -1) {  
88 - this.mirrors[i].isSlow = true;  
89 - this.mirrors[i].remainingSlow = this.options.SLOWLIMITTRIES;  
90 - }  
91 -  
92 - localStorage.setItem("servers", JSON.stringify(this.mirrors));  
93 - break;  
94 - }  
95 -  
96 - }  
97 -  
98 - }  
99 -  
100 - var position = Math.floor((Math.random() * this.mirrors.length));  
101 - var closestPosition;  
102 -  
103 - if (firstHeuristic != this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM) {  
104 - position = -1;  
105 - closestPosition = -1;  
106 - }  
107 -  
108 - var vectorBest = [];  
109 - var k = 0, z = 0; /* JSHint Fix */  
110 -  
111 - for (j = 0; j < this.mirrors.length; j++) {  
112 - if (this.mirrors[j].remainingSlow > 0) {  
113 - this.mirrors[j].remainingSlow = this.mirrors[j].remainingSlow - 1;  
114 - }  
115 -  
116 - if (this.mirrors[j].remainingSlow === 0) {  
117 - this.mirrors[j].isSlow = false;  
118 - }  
119 -  
120 - if (firstHeuristic != this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM && this.mirrors[j].isSlow === false) {  
121 - if (closestPosition == -1) {  
122 - closestPosition = j;  
123 - }  
124 -  
125 - var added = false;  
126 -  
127 - for (k = 0; k < vectorBest.length; k++) {  
128 - if (this.mirrors[j].averageTime < vectorBest[k].averageTime || (this.mirrors[j].averageTime == vectorBest[k].averageTime && (Math.floor(Math.random()) < 0.5) )) {  
129 -  
130 - added = true;  
131 -  
132 - if (vectorBest.length < sizeBest) {  
133 - for (z = vectorBest.length-1; z >= k; z--) {  
134 - vectorBest[z+1] = vectorBest[z];  
135 - }  
136 - } else {  
137 - for (z = vectorBest.length-2; z >= k; z--) {  
138 - vectorBest[z+1] = vectorBest[z];  
139 - }  
140 - }  
141 -  
142 - vectorBest[k] = this.mirrors[j];  
143 -  
144 - break;  
145 - }  
146 - }  
147 -  
148 - if (added === false && vectorBest.length < sizeBest) {  
149 - vectorBest[vectorBest.length] = this.mirrors[j];  
150 - }  
151 -  
152 - }  
153 -  
154 - }  
155 -  
156 - // pega aleatorio entre as N posicoes dos melhores (se for guloso, tera apenas um elemento no vetor)  
157 - if (firstHeuristic != this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM && vectorBest.length > 0) {  
158 - position = Math.floor((Math.random() * vectorBest.length));  
159 - }  
160 -  
161 - if (position == -1) {  
162 - if (secondHeuristic == this.heuristics.SECONDHEURISTIC.SECONDCLOSEST) {  
163 - // escolhendo o mais proximo, no caso, o vetor já está ordenado  
164 - if (closestPosition != -1) {  
165 - position = closestPosition;  
166 - } else {  
167 - // se nao marcou nenhum como closest, todos devem estar como slow, nesse caso seleciona o primeiro que é o mais próximo  
168 - position = 0;  
169 - }  
170 -  
171 - } else {  
172 - position = Math.floor((Math.random() * this.mirrors.length));  
173 - }  
174 - }  
175 -  
176 - callback(this.mirrors[position].url);  
177 - };  
178 -  
179 - Chooser.prototype.loadMirrors_ = function(callback) {  
180 - if (this.mirrors.length > 0) {  
181 - if (callback instanceof Function) callback();  
182 -  
183 - return;  
184 - }  
185 -  
186 - var $this = this;  
187 -  
188 - var localServers = JSON.parse(localStorage.getItem("servers")) || [];  
189 -  
190 - qdClient.getJSON(this.server, function (status, response) {  
191 - var servers = status === 200 ? response : [];  
192 -  
193 - for (var i = 0; i < servers.length; i++){  
194 - var mirror = {  
195 - name: servers[i].nome,  
196 - url: servers[i].url,  
197 - averageTime: 99999999,  
198 - isSlow: false,  
199 - previousTimes: [],  
200 - remainingSlow: 0,  
201 - type: servers[i].type  
202 - };  
203 -  
204 - for (var localServer in localServers) {  
205 - if (mirror.url == localServer.url) {  
206 - mirror.averageTime = localServer.averageTime;  
207 - mirror.isSlow = localServer.isSlow;  
208 - mirror.previousTimes = localServer.previousTimes;  
209 - mirror.remainingSlow = localServer.remainingSlow;  
210 -  
211 - break;  
212 - }  
213 - }  
214 -  
215 - $this.mirrors.push(mirror);  
216 - }  
217 -  
218 - if (callback instanceof Function) callback();  
219 - });  
220 - };  
221 -  
222 -}(window, localStorage));  
player/vendors/qdclient/lib/qdclient.js
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -(function(window, undefined) {  
2 - 'use strict';  
3 -  
4 - window.qdClient = window.qdClient || {};  
5 -  
6 - qdClient.request = function request(url, method, params, callback) {  
7 - var xhr = new XMLHttpRequest();  
8 - var raw_params = "";  
9 -  
10 - xhr.open(method, url, true);  
11 -  
12 - xhr.onload = function() {  
13 - callback(xhr.status, xhr.responseText);  
14 - };  
15 -  
16 - if (method == "POST" && params instanceof Object) {  
17 -  
18 - for(var param in params) {  
19 - raw_params += param + '=' + params[param] + '&';  
20 - }  
21 -  
22 - if (params.length > 1) raw_params.slice(0, -1);  
23 - }  
24 -  
25 - xhr.send(raw_params);  
26 - };  
27 -  
28 - qdClient.getJSON = function getJSON(url, callback) {  
29 - qdClient.request(url, "GET", {}, function(status, response) {  
30 - callback(status, JSON.parse(response));  
31 - });  
32 - };  
33 -  
34 -}(window));  
player/vendors/qdclient/package.json
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -{  
2 - "name": "qdclient",  
3 - "version": "0.0.1",  
4 - "description": "",  
5 - "scripts": {  
6 - "test": "echo \"Error: no test specified\" && exit 1"  
7 - },  
8 - "devDependencies": {  
9 - "browser-sync": "^2.7.13",  
10 - "gulp": "^3.9.0",  
11 - "gulp-concat": "^2.6.0",  
12 - "gulp-jshint": "^1.11.2",  
13 - "gulp-rename": "^1.2.2",  
14 - "gulp-rimraf": "^0.1.1",  
15 - "gulp-uglify": "^1.2.0",  
16 - "run-sequence": "^1.1.1"  
17 - }  
18 -}  
player/vendors/qdclient/qdclient.js
@@ -1,257 +0,0 @@ @@ -1,257 +0,0 @@
1 -(function(window, undefined) {  
2 - 'use strict';  
3 -  
4 - window.qdClient = window.qdClient || {};  
5 -  
6 - qdClient.request = function request(url, method, params, callback) {  
7 - var xhr = new XMLHttpRequest();  
8 - var raw_params = "";  
9 -  
10 - xhr.open(method, url, true);  
11 -  
12 - xhr.onload = function() {  
13 - callback(xhr.status, xhr.responseText);  
14 - };  
15 -  
16 - if (method == "POST" && params instanceof Object) {  
17 -  
18 - for(var param in params) {  
19 - raw_params += param + '=' + params[param] + '&';  
20 - }  
21 -  
22 - if (params.length > 1) raw_params.slice(0, -1);  
23 - }  
24 -  
25 - xhr.send(raw_params);  
26 - };  
27 -  
28 - qdClient.getJSON = function getJSON(url, callback) {  
29 - qdClient.request(url, "GET", {}, function(status, response) {  
30 - callback(status, JSON.parse(response));  
31 - });  
32 - };  
33 -  
34 -}(window));  
35 -  
36 -(function(window, localStorage, undefined) {  
37 - 'use strict';  
38 -  
39 - function Chooser() {  
40 - this.server = 'http://150.165.204.39/vlibras-cloud/get_servers.php';  
41 -  
42 - this.options = {  
43 - THRESHOLDSLOW: 2000,  
44 - SLOWLIMITTRIES: 5,  
45 - NBESTHEURISTIC1: 2,  
46 - QUANTITYPREVIOUSTIMESSTORED: 10  
47 - };  
48 -  
49 - this.mirrors = [];  
50 -  
51 - this.heuristics = {  
52 - FIRSTHEURISTIC: {  
53 - FIRSTRANDOM : {value: 0, name: "Random"},  
54 - FIRSTRANDOMNBEST: {value: 1, name: "Random Among N Best"},  
55 - FIRSTBEST : {value: 2, name: "Best"}  
56 - },  
57 - SECONDHEURISTIC: {  
58 - SECONDRANDOM : {value: 0, name: "Random"},  
59 - SECONDCLOSEST: {value: 1, name: "Closest"}  
60 - },  
61 - THIRDHEURISTIC: {  
62 - THIRDSIMPLEAVERAGE : {value: 0, name: "Simple Average"},  
63 - THIRDWEIGHTEDAVERAGE: {value: 1, name: "Weighted Average"}  
64 - }  
65 - };  
66 - }  
67 -  
68 - // Exports  
69 - qdClient.Chooser = Chooser;  
70 -  
71 - Chooser.prototype.choose = function(urlLast, millisLast, response, callback) {  
72 - var $this = this;  
73 -  
74 - this.loadMirrors_(function() {  
75 - $this.chooseServer_(urlLast, millisLast, response, callback);  
76 - });  
77 - };  
78 -  
79 - Chooser.prototype.chooseServer_ = function(urlLast, millisLast, response, callback) {  
80 - var firstHeuristic = this.heuristics.FIRSTHEURISTIC.FIRSTBEST;  
81 - var secondHeuristic = this.heuristics.SECONDHEURISTIC.SECONDRANDOM;  
82 - var thirdHeuristic = this.heuristics.THIRDHEURISTIC.THIRDWEIGHTEDAVERAGE;  
83 -  
84 - var j = 0, i = 0; /* Fix JSHint */  
85 -  
86 - var sizeBest = this.options.NBESTHEURISTIC1;  
87 - if (firstHeuristic == this.heuristics.FIRSTHEURISTIC.FIRSTBEST) {  
88 - sizeBest = 1;  
89 - }  
90 -  
91 - if (urlLast && urlLast.length > 0) {  
92 - for (i = 0; i < this.mirrors.length; i++) {  
93 - if (this.mirrors[i].url.toLowerCase() == urlLast.toLowerCase()) {  
94 - if (this.mirrors[i].previousTimes.length < this.options.QUANTITYPREVIOUSTIMESSTORED) {  
95 - this.mirrors[i].previousTimes[this.mirrors[i].previousTimes.length] = millisLast;  
96 - } else {  
97 - for (j = this.options.QUANTITYPREVIOUSTIMESSTORED-1; j > 0; j--) {  
98 - this.mirrors[i].previousTimes[j-1] = this.mirrors[i].previousTimes[j];  
99 - }  
100 -  
101 - this.mirrors[i].previousTimes[this.options.QUANTITYPREVIOUSTIMESSTORED-1] = millisLast;  
102 - }  
103 -  
104 - if (thirdHeuristic == this.heuristics.THIRDHEURISTIC.THIRDSIMPLEAVERAGE) {  
105 - var totalMillis = 0;  
106 - for (j = 0; j < this.mirrors[i].previousTimes.length; j++) {  
107 - totalMillis += this.mirrors[i].previousTimes[j];  
108 - }  
109 -  
110 - this.mirrors[i].averageTime = totalMillis/this.mirrors[i].previousTimes.length;  
111 - } else if (thirdHeuristic == this.heuristics.THIRDHEURISTIC.THIRDWEIGHTEDAVERAGE) {  
112 - var totalMillisAndWeights = 0;  
113 - var totalWeights = 0;  
114 - for (j = 0; j < this.mirrors[i].previousTimes.length; j++) {  
115 - totalMillisAndWeights += this.mirrors[i].previousTimes[j]*(j+1);  
116 - totalWeights += (j+1);  
117 - }  
118 -  
119 - this.mirrors[i].averageTime = totalMillisAndWeights/totalWeights;  
120 - }  
121 -  
122 - if (millisLast > this.options.THRESHOLDSLOW || response == -1) {  
123 - this.mirrors[i].isSlow = true;  
124 - this.mirrors[i].remainingSlow = this.options.SLOWLIMITTRIES;  
125 - }  
126 -  
127 - localStorage.setItem("servers", JSON.stringify(this.mirrors));  
128 - break;  
129 - }  
130 -  
131 - }  
132 -  
133 - }  
134 -  
135 - var position = Math.floor((Math.random() * this.mirrors.length));  
136 - var closestPosition;  
137 -  
138 - if (firstHeuristic != this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM) {  
139 - position = -1;  
140 - closestPosition = -1;  
141 - }  
142 -  
143 - var vectorBest = [];  
144 - var k = 0, z = 0; /* JSHint Fix */  
145 -  
146 - for (j = 0; j < this.mirrors.length; j++) {  
147 - if (this.mirrors[j].remainingSlow > 0) {  
148 - this.mirrors[j].remainingSlow = this.mirrors[j].remainingSlow - 1;  
149 - }  
150 -  
151 - if (this.mirrors[j].remainingSlow === 0) {  
152 - this.mirrors[j].isSlow = false;  
153 - }  
154 -  
155 - if (firstHeuristic != this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM && this.mirrors[j].isSlow === false) {  
156 - if (closestPosition == -1) {  
157 - closestPosition = j;  
158 - }  
159 -  
160 - var added = false;  
161 -  
162 - for (k = 0; k < vectorBest.length; k++) {  
163 - if (this.mirrors[j].averageTime < vectorBest[k].averageTime || (this.mirrors[j].averageTime == vectorBest[k].averageTime && (Math.floor(Math.random()) < 0.5) )) {  
164 -  
165 - added = true;  
166 -  
167 - if (vectorBest.length < sizeBest) {  
168 - for (z = vectorBest.length-1; z >= k; z--) {  
169 - vectorBest[z+1] = vectorBest[z];  
170 - }  
171 - } else {  
172 - for (z = vectorBest.length-2; z >= k; z--) {  
173 - vectorBest[z+1] = vectorBest[z];  
174 - }  
175 - }  
176 -  
177 - vectorBest[k] = this.mirrors[j];  
178 -  
179 - break;  
180 - }  
181 - }  
182 -  
183 - if (added === false && vectorBest.length < sizeBest) {  
184 - vectorBest[vectorBest.length] = this.mirrors[j];  
185 - }  
186 -  
187 - }  
188 -  
189 - }  
190 -  
191 - // pega aleatorio entre as N posicoes dos melhores (se for guloso, tera apenas um elemento no vetor)  
192 - if (firstHeuristic != this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM && vectorBest.length > 0) {  
193 - position = Math.floor((Math.random() * vectorBest.length));  
194 - }  
195 -  
196 - if (position == -1) {  
197 - if (secondHeuristic == this.heuristics.SECONDHEURISTIC.SECONDCLOSEST) {  
198 - // escolhendo o mais proximo, no caso, o vetor já está ordenado  
199 - if (closestPosition != -1) {  
200 - position = closestPosition;  
201 - } else {  
202 - // se nao marcou nenhum como closest, todos devem estar como slow, nesse caso seleciona o primeiro que é o mais próximo  
203 - position = 0;  
204 - }  
205 -  
206 - } else {  
207 - position = Math.floor((Math.random() * this.mirrors.length));  
208 - }  
209 - }  
210 -  
211 - callback(this.mirrors[position].url);  
212 - };  
213 -  
214 - Chooser.prototype.loadMirrors_ = function(callback) {  
215 - if (this.mirrors.length > 0) {  
216 - if (callback instanceof Function) callback();  
217 -  
218 - return;  
219 - }  
220 -  
221 - var $this = this;  
222 -  
223 - var localServers = JSON.parse(localStorage.getItem("servers")) || [];  
224 -  
225 - qdClient.getJSON(this.server, function (status, response) {  
226 - var servers = status === 200 ? response : [];  
227 -  
228 - for (var i = 0; i < servers.length; i++){  
229 - var mirror = {  
230 - name: servers[i].nome,  
231 - url: servers[i].url,  
232 - averageTime: 99999999,  
233 - isSlow: false,  
234 - previousTimes: [],  
235 - remainingSlow: 0,  
236 - type: servers[i].type  
237 - };  
238 -  
239 - for (var localServer in localServers) {  
240 - if (mirror.url == localServer.url) {  
241 - mirror.averageTime = localServer.averageTime;  
242 - mirror.isSlow = localServer.isSlow;  
243 - mirror.previousTimes = localServer.previousTimes;  
244 - mirror.remainingSlow = localServer.remainingSlow;  
245 -  
246 - break;  
247 - }  
248 - }  
249 -  
250 - $this.mirrors.push(mirror);  
251 - }  
252 -  
253 - if (callback instanceof Function) callback();  
254 - });  
255 - };  
256 -  
257 -}(window, localStorage));  
player/vendors/qdclient/qdclient.min.js
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -!function(i,r){"use strict";i.qdClient=i.qdClient||{},qdClient.request=function(i,r,s,e){var t=new XMLHttpRequest,o="";if(t.open(r,i,!0),t.onload=function(){e(t.status,t.responseText)},"POST"==r&&s instanceof Object){for(var n in s)o+=n+"="+s[n]+"&";s.length>1&&o.slice(0,-1)}t.send(o)},qdClient.getJSON=function(i,r){qdClient.request(i,"GET",{},function(i,s){r(i,JSON.parse(s))})}}(window),function(i,r,s){"use strict";function e(){this.server="http://150.165.204.39/vlibras-cloud/get_servers.php",this.options={THRESHOLDSLOW:2e3,SLOWLIMITTRIES:5,NBESTHEURISTIC1:2,QUANTITYPREVIOUSTIMESSTORED:10},this.mirrors=[],this.heuristics={FIRSTHEURISTIC:{FIRSTRANDOM:{value:0,name:"Random"},FIRSTRANDOMNBEST:{value:1,name:"Random Among N Best"},FIRSTBEST:{value:2,name:"Best"}},SECONDHEURISTIC:{SECONDRANDOM:{value:0,name:"Random"},SECONDCLOSEST:{value:1,name:"Closest"}},THIRDHEURISTIC:{THIRDSIMPLEAVERAGE:{value:0,name:"Simple Average"},THIRDWEIGHTEDAVERAGE:{value:1,name:"Weighted Average"}}}}qdClient.Chooser=e,e.prototype.choose=function(i,r,s,e){var t=this;this.loadMirrors_(function(){t.chooseServer_(i,r,s,e)})},e.prototype.chooseServer_=function(i,s,e,t){var o=this.heuristics.FIRSTHEURISTIC.FIRSTBEST,n=this.heuristics.SECONDHEURISTIC.SECONDRANDOM,h=this.heuristics.THIRDHEURISTIC.THIRDWEIGHTEDAVERAGE,T=0,S=0,a=this.options.NBESTHEURISTIC1;if(o==this.heuristics.FIRSTHEURISTIC.FIRSTBEST&&(a=1),i&&i.length>0)for(S=0;S<this.mirrors.length;S++)if(this.mirrors[S].url.toLowerCase()==i.toLowerCase()){if(this.mirrors[S].previousTimes.length<this.options.QUANTITYPREVIOUSTIMESSTORED)this.mirrors[S].previousTimes[this.mirrors[S].previousTimes.length]=s;else{for(T=this.options.QUANTITYPREVIOUSTIMESSTORED-1;T>0;T--)this.mirrors[S].previousTimes[T-1]=this.mirrors[S].previousTimes[T];this.mirrors[S].previousTimes[this.options.QUANTITYPREVIOUSTIMESSTORED-1]=s}if(h==this.heuristics.THIRDHEURISTIC.THIRDSIMPLEAVERAGE){var m=0;for(T=0;T<this.mirrors[S].previousTimes.length;T++)m+=this.mirrors[S].previousTimes[T];this.mirrors[S].averageTime=m/this.mirrors[S].previousTimes.length}else if(h==this.heuristics.THIRDHEURISTIC.THIRDWEIGHTEDAVERAGE){var I=0,l=0;for(T=0;T<this.mirrors[S].previousTimes.length;T++)I+=this.mirrors[S].previousTimes[T]*(T+1),l+=T+1;this.mirrors[S].averageTime=I/l}(s>this.options.THRESHOLDSLOW||-1==e)&&(this.mirrors[S].isSlow=!0,this.mirrors[S].remainingSlow=this.options.SLOWLIMITTRIES),r.setItem("servers",JSON.stringify(this.mirrors));break}var R,E=Math.floor(Math.random()*this.mirrors.length);o!=this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM&&(E=-1,R=-1);var u=[],v=0,g=0;for(T=0;T<this.mirrors.length;T++)if(this.mirrors[T].remainingSlow>0&&(this.mirrors[T].remainingSlow=this.mirrors[T].remainingSlow-1),0===this.mirrors[T].remainingSlow&&(this.mirrors[T].isSlow=!1),o!=this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM&&this.mirrors[T].isSlow===!1){-1==R&&(R=T);var f=!1;for(v=0;v<u.length;v++)if(this.mirrors[T].averageTime<u[v].averageTime||this.mirrors[T].averageTime==u[v].averageTime&&Math.floor(Math.random())<.5){if(f=!0,u.length<a)for(g=u.length-1;g>=v;g--)u[g+1]=u[g];else for(g=u.length-2;g>=v;g--)u[g+1]=u[g];u[v]=this.mirrors[T];break}f===!1&&u.length<a&&(u[u.length]=this.mirrors[T])}o!=this.heuristics.FIRSTHEURISTIC.FIRSTRANDOM&&u.length>0&&(E=Math.floor(Math.random()*u.length)),-1==E&&(E=n==this.heuristics.SECONDHEURISTIC.SECONDCLOSEST?-1!=R?R:0:Math.floor(Math.random()*this.mirrors.length)),t(this.mirrors[E].url)},e.prototype.loadMirrors_=function(i){if(this.mirrors.length>0)return void(i instanceof Function&&i());var s=this,e=JSON.parse(r.getItem("servers"))||[];qdClient.getJSON(this.server,function(r,t){for(var o=200===r?t:[],n=0;n<o.length;n++){var h={name:o[n].nome,url:o[n].url,averageTime:99999999,isSlow:!1,previousTimes:[],remainingSlow:0,type:o[n].type};for(var T in e)if(h.url==T.url){h.averageTime=T.averageTime,h.isSlow=T.isSlow,h.previousTimes=T.previousTimes,h.remainingSlow=T.remainingSlow;break}s.mirrors.push(h)}i instanceof Function&&i()})}}(window,localStorage);  
2 \ No newline at end of file 0 \ No newline at end of file
player/window.html
@@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
1 -<!doctype html>  
2 -<html lang="en-us">  
3 - <head>  
4 - <meta charset="utf-8">  
5 - <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
6 - <title>VLibras Plugin</title>  
7 - <link rel="stylesheet" href="TemplateData/style.css">  
8 - <link rel="shortcut icon" href="TemplateData/favicon.ico?v=2" />  
9 - <script src="TemplateData/UnityProgress.js"></script>  
10 -  
11 - <script src="vendors/qdclient/qdclient.js"></script>  
12 - <script src="js/message.js"></script>  
13 - <script src="js/loading.js"></script>  
14 -  
15 - <script src="../main.js"></script>  
16 - </head>  
17 - <body class="template">  
18 - <div id="message"></div>  
19 - <div id="loading-screen"></div>  
20 - <div class="template-wrap clear">  
21 - <canvas class="emscripten" id="canvas"></canvas>  
22 - </div>  
23 - <script src="connect.js"></script>  
24 - <script src="Release/UnityConfig.js"></script>  
25 - <script src="Release/fileloader.js"></script>  
26 - <script src="load.js"></script>  
27 - </body>  
28 -</html>  
safari.safariextension/Info.plist 0 → 100644
@@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3 +<plist version="1.0">
  4 +<dict>
  5 + <key>Author</key>
  6 + <string>LAViD</string>
  7 + <key>Builder Version</key>
  8 + <string>10600.6.3</string>
  9 + <key>CFBundleDisplayName</key>
  10 + <string>VLibras Plugin</string>
  11 + <key>CFBundleIdentifier</key>
  12 + <string>br.ufpb.lavid.vlibras</string>
  13 + <key>CFBundleInfoDictionaryVersion</key>
  14 + <string>6.0</string>
  15 + <key>CFBundleShortVersionString</key>
  16 + <string>0.1</string>
  17 + <key>CFBundleVersion</key>
  18 + <string>1</string>
  19 + <key>Chrome</key>
  20 + <dict>
  21 + <key>Database Quota</key>
  22 + <real>52428800</real>
  23 + <key>Global Page</key>
  24 + <string>global.html</string>
  25 + </dict>
  26 + <key>Content</key>
  27 + <dict>
  28 + <key>Scripts</key>
  29 + <dict>
  30 + <key>Start</key>
  31 + <array>
  32 + <string>scripts/contextmenu.js</string>
  33 + </array>
  34 + </dict>
  35 + </dict>
  36 + <key>Description</key>
  37 + <string>Um tradutor de portugues para LIBRAS</string>
  38 + <key>DeveloperIdentifier</key>
  39 + <string>3PTX2S8KDQ</string>
  40 + <key>ExtensionInfoDictionaryVersion</key>
  41 + <string>1.0</string>
  42 + <key>Permissions</key>
  43 + <dict>
  44 + <key>Website Access</key>
  45 + <dict>
  46 + <key>Include Secure Pages</key>
  47 + <true/>
  48 + <key>Level</key>
  49 + <string>All</string>
  50 + </dict>
  51 + </dict>
  52 +</dict>
  53 +</plist>
safari.safariextension/app/main.js 0 → 100644
@@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
  1 +window.resizeTo(535, 500);
  2 +
  3 +var app = {
  4 + chooser: null,
  5 + glosa: undefined,
  6 + loaded: false,
  7 + lastReq: {
  8 + url: null,
  9 + millis: null,
  10 + response: null
  11 + }
  12 +};
  13 +
  14 +function onLoadPlayer() {
  15 + if ( app.glosa !== undefined )
  16 + SendMessage('PlayerManager', 'catchGlosa', app.glosa);
  17 +
  18 + app.loaded = true;
  19 +}
  20 +
  21 +safari.self.addEventListener('message', function (request) {
  22 + if (request.name !== 'plugin:selectedText' && request.message === undefined) return;
  23 + var selectedText = encodeURI(request.message);
  24 +
  25 + app.chooser = app.chooser || new qdClient.Chooser();
  26 +
  27 + document.getElementById('loading-screen').style.display = 'block';
  28 + app.chooser.choose(
  29 + app.lastReq.url,
  30 + app.lastReq.millis,
  31 + app.lastReq.response,
  32 + function (url) {
  33 + var start = new Date().getTime();
  34 +
  35 + if (!url) {
  36 + document.getElementById('loading-screen').style.display = 'none';
  37 + return;
  38 + }
  39 +
  40 + qdClient.request(url + '?texto=' + selectedText, "GET", {},
  41 + function(status, response) {
  42 + app.lastReq.response = status === 200 ? status : -1;
  43 + app.lastReq.millis = (new Date().getTime() - start);
  44 + app.lastReq.url = url;
  45 +
  46 + document.getElementById('loading-screen').style.display = 'none';
  47 + if (status !== 200) return;
  48 +
  49 + app.glosa = response;
  50 + if (app.loaded == true)
  51 + SendMessage('PlayerManager', 'catchGlosa', app.glosa);
  52 + });
  53 + });
  54 +});
  55 +
  56 +safari.self.tab.dispatchMessage('page:ready', true);
safari.safariextension/background.js 0 → 100644
@@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
  1 +var popup = null;
  2 +var selectedText = undefined;
  3 +var appURL = safari.extension.baseURI + 'app/player/window.html';
  4 +
  5 +safari.application.addEventListener('contextmenu', function (event){
  6 + var selectedText = event.userInfo;
  7 +
  8 + if (!selectedText) return;
  9 +
  10 + if (selectedText.length > 20) {
  11 + selectedText = selectedText.substr(0, 20) + '...';
  12 + }
  13 +
  14 + if (selectedText !== '') {
  15 + event.contextMenu.appendContextMenuItem('translateLibras', 'Traduzir ' + selectedText + ' para LIBRAS');
  16 + }
  17 +}, false);
  18 +
  19 +safari.application.addEventListener('command', function (event){
  20 + if (event.command === 'translateLibras') {
  21 + selectedText = event.userInfo;
  22 +
  23 + if (popup === null) {
  24 + popup = safari.application.openBrowserWindow().activeTab;
  25 + popup.url = appURL;
  26 +
  27 + popup.addEventListener('close', function () {
  28 + popup = null;
  29 + });
  30 +
  31 + popup.addEventListener('navigate', function (event) {
  32 + if (event.target.url !== appURL) {
  33 + popup = null;
  34 + }
  35 + });
  36 +
  37 + popup.addEventListener('message', function (request) {
  38 + if (selectedText !== undefined && request.name === 'page:ready' && request.message == true) {
  39 + popup.page.dispatchMessage('plugin:selectedText', selectedText);
  40 + selectedText = undefined;
  41 + };
  42 + });
  43 + } else {
  44 + popup.browserWindow.activate();
  45 + popup.page.dispatchMessage('plugin:selectedText', selectedText);
  46 + selectedText = undefined;
  47 + }
  48 + }
  49 +}, false);
safari.safariextension/global.html 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +<html>
  2 + <head>
  3 + <title>VLibras Plugin</title>
  4 + <script src="background.js"></script>
  5 + </head>
  6 + <body>
  7 + </body>
  8 +</html>
0 \ No newline at end of file 9 \ No newline at end of file
safari.safariextension/scripts/contextmenu.js 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +document.addEventListener('contextmenu', function (event){
  2 + safari.self.tab.setContextMenuEventUserInfo(event, window.getSelection().toString());
  3 +}, false);
0 \ No newline at end of file 4 \ No newline at end of file
safari.safariextension/vlibras48.png 0 → 100644

18.4 KB

vlibrasplugin-chrome.pem
@@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
1 ------BEGIN PRIVATE KEY-----  
2 -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8UI+z9pRhF8Kv  
3 -WC3Y2eI41b4AJeROjrO3rVeBG+FYjMuOB0r1byFUlebGP/Nep7nZ9eEUZ4E71lkp  
4 -WDyYLfZTb+gum6MQAeh8Wd7aBh9qSa4ru08ieu/8HxmHdfUFpWph3yPMV0TdAXVh  
5 -sbMLWcvzu+AmEkPM09KtXENyAOkR63ncll7HtmGFdxicTzNWuIhrvrhsd1xtuS1c  
6 -g4vk1XEJ5mcSnVLVGojAI8uwY4QEAGC2bUMzmD6mtZxySHu5XxNnk1xFdTxebd1K  
7 -4u0HyDgpY7epRsnkYHQq9HZ7Smet2JW4tHmd/5nPMZXFztZ/bUSuOqAmXvmLXvmw  
8 -JSpVnEENAgMBAAECggEAVCmFMB8iDYq6/fbg9qvaSSBt/E7zDJEGjS6xjwhQ3GyA  
9 -hQeJXsu+D7m3HB90u3cmvtz/LUldHssbqji/TBwunPfEwx/X7s2LhBf+W16lJ7Gq  
10 -X+0k3vomy31ywXHcght9wiQiMa9HHacLORBcPtRxLItpEFrVZnO9ErHLiuYRRGo+  
11 -EKP79o1dVZ5kldJ7toB4ok+KIDu2PJJShj4nXj7mKNlGZPH2hYn+NG7ZLFOjUp09  
12 -AKjTIE5WADt5bOKN9Wo2HiCG63zLZsaJmeYh2v3TxnpAj+W/TMxV/y0kIe7gzqw1  
13 -2qxdBmLBILNM8AkwadpbJRuC6aynd41sqejix3uemQKBgQDzONGl0Yf8fg5EyX3r  
14 -w/OldzZv/Comy6Ka/aq8I88clFBlEoD2os+lF6IDAgMj102awjiI+fxOe81C7Pza  
15 -a5eGHeq3qaE0E7v7ggcW7YXlFs9YC6RikKEkGCFnnaxeBf+/iXICcf32GzZkSow2  
16 -JTedIJIbu/oca2UFpVsK4inkHwKBgQDGNUZMmJ1ca4WdpmP6mUCwqEgOZ+UcG/3K  
17 -4Sy0BtJOB1wVoQOzM1q2FUurCqps81cghUbtJyeRk4y4eI1rOEbz8m0UB0hWyEq1  
18 -pJJiz0nei7ficAIHO5e2elDV2lJ7KNxYeb3YN2NXbGmwmsI/IoudPp+wghnl4Xns  
19 -2JcBFZdVUwKBgQCBDcb/6xvyt5gum5M7BDBFvemepfhfuXFAOBTd20pL6c52ssjH  
20 -FUCEYvPOEMVFwTomQaPp2msr4bjaKBFKfAhcW4dtiI5Gqan3G9lTKxj+o4nFN/gz  
21 -bHZ0RnGDH0CUay52nSFndsDAU1QbBws6t6i4sM2V9boSVlG2GzUhozuDFQKBgG2P  
22 -kTZRvdoSTR9hlC43fDyqKHpeD5TEHDuC0HUKuEENbGdAQ41Qu7med98p3B6xO93s  
23 -DdKVLBgaGVT2viUgTIgX3xeNFv1xZWqWd5xKvKhZTuHJzDU3SZtCbWBod+NAKNx3  
24 -HutfYng2ow1N3kWL0OSwcxDcOXiKdBzpdD7TMn2lAoGAH3xcQ9pI1aCeNxrnyvsJ  
25 -1EFlSX+3HQvjd9JOVemiVd6jP5SbrM6DplzimYPVmJhlAcq+wi8/dHyOGMRCb7ZV  
26 -Yv44hSheny/RhfMcePwubLBhVULRrdg2LWOEnSgrLIWNe2CCJ+xzgr2mEM+vGazI  
27 -zVWbI5s+shUi96/ZSZMjxGo=  
28 ------END PRIVATE KEY-----  
webgl/.bowerrc 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +{
  2 + "directory": "vendors"
  3 +}
webgl/TemplateData/UnityProgress.js 0 → 100644
@@ -0,0 +1,97 @@ @@ -0,0 +1,97 @@
  1 +function UnityProgress (dom) {
  2 + this.progress = 0.0;
  3 + this.message = "";
  4 + this.dom = dom;
  5 +
  6 + var parent = dom.parentNode;
  7 +
  8 + var background = document.createElement("div");
  9 + background.style.background = "#FFFFFF";
  10 + background.style.position = "absolute";
  11 + parent.appendChild(background);
  12 + this.background = background;
  13 +
  14 + var logoImage = document.createElement("img");
  15 + logoImage.src = "TemplateData/progresslogo.png";
  16 + logoImage.style.position = "absolute";
  17 + parent.appendChild(logoImage);
  18 + this.logoImage = logoImage;
  19 +
  20 + var progressFrame = document.createElement("img");
  21 + progressFrame.src = "TemplateData/loadingbar.png";
  22 + progressFrame.style.position = "absolute";
  23 + parent.appendChild(progressFrame);
  24 + this.progressFrame = progressFrame;
  25 +
  26 + var progressBar = document.createElement("img");
  27 + progressBar.src = "TemplateData/fullbar.png";
  28 + progressBar.style.position = "absolute";
  29 + parent.appendChild(progressBar);
  30 + this.progressBar = progressBar;
  31 +
  32 + var messageArea = document.createElement("p");
  33 + messageArea.style.position = "absolute";
  34 + parent.appendChild(messageArea);
  35 + this.messageArea = messageArea;
  36 +
  37 +
  38 + this.SetProgress = function (progress) {
  39 + if (this.progress < progress)
  40 + this.progress = progress;
  41 + this.messageArea.style.display = "none";
  42 + this.progressFrame.style.display = "inline";
  43 + this.progressBar.style.display = "inline";
  44 + this.Update();
  45 + }
  46 +
  47 + this.SetMessage = function (message) {
  48 + this.message = message;
  49 + this.background.style.display = "inline";
  50 + this.logoImage.style.display = "inline";
  51 + this.progressFrame.style.display = "none";
  52 + this.progressBar.style.display = "none";
  53 + this.Update();
  54 + }
  55 +
  56 + this.Clear = function() {
  57 + this.background.style.display = "none";
  58 + this.logoImage.style.display = "none";
  59 + this.progressFrame.style.display = "none";
  60 + this.progressBar.style.display = "none";
  61 + }
  62 +
  63 + this.Update = function() {
  64 + this.background.style.top = this.dom.offsetTop + 'px';
  65 + this.background.style.left = this.dom.offsetLeft + 'px';
  66 + this.background.style.width = this.dom.offsetWidth + 'px';
  67 + this.background.style.height = this.dom.offsetHeight + 'px';
  68 +
  69 + var logoImg = new Image();
  70 + logoImg.src = this.logoImage.src;
  71 + var progressFrameImg = new Image();
  72 + progressFrameImg.src = this.progressFrame.src;
  73 +
  74 + this.logoImage.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 - logoImg.height * 0.5) + 'px';
  75 + this.logoImage.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - logoImg.width * 0.5) + 'px';
  76 + this.logoImage.style.width = logoImg.width+'px';
  77 + this.logoImage.style.height = logoImg.height+'px';
  78 +
  79 + this.progressFrame.style.top = this.dom.offsetTop + (this.dom.offsetHeight * 0.5 + logoImg.height * 0.5 + 10) + 'px';
  80 + this.progressFrame.style.left = this.dom.offsetLeft + (this.dom.offsetWidth * 0.5 - progressFrameImg.width * 0.5) + 'px';
  81 + this.progressFrame.width = progressFrameImg.width;
  82 + this.progressFrame.height = progressFrameImg.height;
  83 +
  84 + this.progressBar.style.top = this.progressFrame.style.top;
  85 + this.progressBar.style.left = this.progressFrame.style.left;
  86 + this.progressBar.width = progressFrameImg.width * Math.min(this.progress, 1);
  87 + this.progressBar.height = progressFrameImg.height;
  88 +
  89 + this.messageArea.style.top = this.progressFrame.style.top;
  90 + this.messageArea.style.left = 0;
  91 + this.messageArea.style.width = '100%';
  92 + this.messageArea.style.textAlign = 'center';
  93 + this.messageArea.innerHTML = this.message;
  94 + }
  95 +
  96 + this.Update ();
  97 +}
0 \ No newline at end of file 98 \ No newline at end of file
webgl/TemplateData/default-cover.jpg 0 → 100644

51.6 KB

webgl/TemplateData/favicon.png 0 → 100644

18.4 KB

webgl/TemplateData/fullbar.png 0 → 100644

2.71 KB

webgl/TemplateData/loadingbar.png 0 → 100644

2.78 KB

webgl/TemplateData/progresslogo.png 0 → 100644

20.7 KB

webgl/TemplateData/style.css 0 → 100644
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
  1 +
  2 +/****************************************
  3 + ==== Player Styling
  4 +****************************************/
  5 +
  6 +html,body,div,canvas { margin: 0; padding: 0; }
  7 +::-moz-selection { color: #333; text-shadow: none; }
  8 +::selection { color: #333; text-shadow: none; }
  9 +.clear:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }
  10 +.clear { display: inline-table; clear: both; }
  11 +/* Hides from IE-mac \*/ * html .clear { height: 1%; } .clear { display: block; } /* End hide from IE-mac */
  12 +
  13 +html, body { width: 100%; height: 100%; font-family: Helvetica, Verdana, Arial, sans-serif; }
  14 +body { }
  15 +p.header, p.footer { display: none; }
  16 +div.logo { width: 196px; height: 38px; float: left; background: url(logo.png) 0 0 no-repeat; position: relative; z-index: 10; }
  17 +div.title { height: 38px; line-height: 38px; padding: 0 10px; margin: 0 1px 0 0; float: right; color: #333; text-align: right; font-size: 18px; position: relative; z-index: 10; }
  18 +.template-wrap { position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); }
  19 +.template-wrap canvas { margin: 0 0 10px 0; position: relative; z-index: 9; box-shadow: 0 10px 30px rgba(0,0,0,0.2); -moz-box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
  20 +.fullscreen { float: right; position: relative; z-index: 10; }
  21 +
  22 +body.template { }
  23 +.template .template-wrap { }
  24 +.template .template-wrap canvas { }
  25 +
  26 +/****************************************
  27 + ==== Overriding
  28 +****************************************/
  29 +html, #canvas, .template, .template-wrap {
  30 + width: 100%;
  31 + height: 100%;
  32 + margin: 0;
  33 + overflow: hidden;
  34 +}
  35 +
  36 +#loading-screen {
  37 + position: absolute;
  38 + top: 0;
  39 + left: 0;
  40 + display: none;
  41 + width: 100%;
  42 + height: 100%;
  43 + z-index: 9999;
  44 +}
  45 +
  46 +.message {
  47 + position: fixed;
  48 + top: 0;
  49 + left: 0;
  50 + width: 100%;
  51 + padding: 1em 0.5em;
  52 +}
  53 +
  54 +.message .info {
  55 + background-color: #3b8bba;
  56 +}
  57 +
  58 +.message .hidden {
  59 + display: none;
  60 +}
  61 +
  62 +.message .warning {
  63 + background-color: #f08a24;
  64 +}
0 \ No newline at end of file 65 \ No newline at end of file
webgl/bower.json 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +{
  2 + "name": "vlibras-player",
  3 + "version": "0.0.1",
  4 + "ignore": [
  5 + "**/.*",
  6 + "node_modules",
  7 + "bower_components",
  8 + "test",
  9 + "tests"
  10 + ],
  11 + "devDependencies": {
  12 + "qdclient": "git@git.lavid.ufpb.br:qdclient.git"
  13 + }
  14 +}
webgl/connect.js 0 → 100644
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +// connect to canvas
  2 + var Module = {
  3 + TOTAL_MEMORY: 268435456,
  4 + filePackagePrefixURL: "Release/",
  5 + memoryInitializerPrefixURL: "Release/",
  6 + preRun: [],
  7 + postRun: [],
  8 + print: (function() {
  9 + return function(text) {
  10 + console.log (text);
  11 + };
  12 + })(),
  13 + printErr: function(text) {
  14 + console.error (text);
  15 + },
  16 + canvas: document.getElementById('canvas'),
  17 + progress: null,
  18 + setStatus: function(text) {
  19 + if (this.progress == null)
  20 + {
  21 + if (typeof UnityProgress != 'function')
  22 + return;
  23 + this.progress = new UnityProgress (canvas);
  24 + }
  25 + if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
  26 + if (text === Module.setStatus.text) return;
  27 + this.progress.SetMessage (text);
  28 + var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
  29 + if (m)
  30 + this.progress.SetProgress (parseInt(m[2])/parseInt(m[4]));
  31 + if (text === "")
  32 + this.progress.Clear()
  33 + },
  34 + totalDependencies: 0,
  35 + monitorRunDependencies: function(left) {
  36 + this.totalDependencies = Math.max(this.totalDependencies, left);
  37 + Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
  38 + }
  39 + };
  40 + Module.setStatus('Downloading (0.0/1)');
webgl/load.js 0 → 100644
@@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
  1 +if (!(!Math.fround)) {
  2 + var script = document.createElement('script');
  3 + script.src = "Release/WEBGL.js";
  4 + document.body.appendChild(script);
  5 +} else {
  6 + var codeXHR = new XMLHttpRequest();
  7 + codeXHR.open('GET', 'Release/WEBGL.js', true);
  8 + codeXHR.onload = function() {
  9 + var code = codeXHR.responseText;
  10 + if (!Math.fround) {
  11 +try {
  12 + console.log('optimizing out Math.fround calls');
  13 + var m = /var ([^=]+)=global\.Math\.fround;/.exec(code);
  14 + var minified = m[1];
  15 + if (!minified) throw 'fail';
  16 + var startAsm = code.indexOf('// EMSCRIPTEN_START_FUNCS');
  17 + var endAsm = code.indexOf('// EMSCRIPTEN_END_FUNCS');
  18 + var asm = code.substring(startAsm, endAsm);
  19 + do {
  20 + var moar = false; // we need to re-do, as x(x( will not be fixed
  21 + asm = asm.replace(new RegExp('[^a-zA-Z0-9\\$\\_]' + minified + '\\(', 'g'), function(s) { moar = true; return s[0] + '(' });
  22 + } while (moar);
  23 + code = code.substring(0, startAsm) + asm + code.substring(endAsm);
  24 + code = code.replace("'use asm'", "'almost asm'");
  25 +} catch(e) { console.log('failed to optimize out Math.fround calls ' + e) }
  26 + }
  27 +
  28 + var blob = new Blob([code], { type: 'text/javascript' });
  29 + codeXHR = null;
  30 + var src = URL.createObjectURL(blob);
  31 + var script = document.createElement('script');
  32 + script.src = URL.createObjectURL(blob);
  33 + script.onload = function() {
  34 + URL.revokeObjectURL(script.src);
  35 + };
  36 + document.body.appendChild(script);
  37 + };
  38 + codeXHR.send(null);
  39 +}
webgl/window.html 0 → 100644
@@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
  1 +<!doctype html>
  2 +<html lang="en-us">
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6 + <title>VLibras Plugin</title>
  7 + <link rel="stylesheet" href="TemplateData/style.css">
  8 + <link rel="shortcut icon" href="TemplateData/favicon.png" />
  9 + <script src="TemplateData/UnityProgress.js"></script>
  10 +
  11 + <script src="vendors/qdclient/qdclient.js"></script>
  12 + <script src="js/message.js"></script>
  13 + <script src="js/loading.js"></script>
  14 +
  15 + <script src="../main.js"></script>
  16 + </head>
  17 + <body class="template">
  18 + <div id="message"></div>
  19 + <div id="loading-screen"></div>
  20 + <div class="template-wrap clear">
  21 + <canvas class="emscripten" id="canvas"></canvas>
  22 + </div>
  23 + <script src="connect.js"></script>
  24 + <script src="Release/UnityConfig.js"></script>
  25 + <script src="Release/fileloader.js"></script>
  26 + <script src="load.js"></script>
  27 + </body>
  28 +</html>
webplayer/.bowerrc 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +{
  2 + "directory": "vendors"
  3 +}
0 \ No newline at end of file 4 \ No newline at end of file
webplayer/TemplateData/favicon.png 0 → 100644

18.4 KB

webplayer/TemplateData/fullbar.png 0 → 100644

1.16 KB

webplayer/TemplateData/loadingbar.png 0 → 100644

2.78 KB

webplayer/TemplateData/progresslogo.png 0 → 100644

20.7 KB

webplayer/WEBPLAYER.unity3d 0 → 100644
No preview for this file type
webplayer/bower.json 0 → 100644
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
  1 +{
  2 + "name": "vlibras-player",
  3 + "version": "0.0.1",
  4 + "ignore": [
  5 + "**/.*",
  6 + "node_modules",
  7 + "bower_components",
  8 + "test",
  9 + "tests"
  10 + ],
  11 + "devDependencies": {
  12 + "qdclient": "git@git.lavid.ufpb.br:qdclient.git"
  13 + },
  14 + "dependencies": {
  15 + "jquery": "~2.1.4"
  16 + }
  17 +}
webplayer/player.js 0 → 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +(function(window, UnityObject2) {
  2 + var params = {
  3 + logoimage: 'TemplateData/progresslogo.png',
  4 + progressbarimage: 'TemplateData/fullbar.png',
  5 + progressframeimage: 'TemplateData/loadingbar.png'
  6 + };
  7 +
  8 + var Player = new UnityObject2({ params: params });
  9 + Player.initPlugin(document.getElementById('player'), 'WEBPLAYER.unity3d');
  10 +
  11 + window.SendMessage = function(object, method, params) {
  12 + Player.getUnity().SendMessage(object, method, params);
  13 + };
  14 +
  15 +})(window, UnityObject2);
0 \ No newline at end of file 16 \ No newline at end of file
webplayer/window.html 0 → 100644
@@ -0,0 +1,58 @@ @@ -0,0 +1,58 @@
  1 +<!doctype html>
  2 +<html lang="en-us">
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <title>VLibras Plugin</title>
  6 +
  7 + <link rel="shortcut icon" href="TemplateData/favicon.png" />
  8 + <style type="text/css">
  9 + html, body, #player {
  10 + width: 100%;
  11 + height: 100%;
  12 + margin: 0;
  13 + overflow: hidden;
  14 + }
  15 +
  16 + #loading-screen span {
  17 + position: absolute;
  18 + top: 5px;
  19 + right: 40px;
  20 + padding: 15px 10px;
  21 + background: #000;
  22 + color: #FFF;
  23 +
  24 + font-size: 1.2em;
  25 + -webkit-border-radius: 20px;
  26 + -moz-border-radius: 20px;
  27 + border-radius: 20px;
  28 + }
  29 +
  30 + #loading-screen {
  31 + position: absolute;
  32 + top: 0;
  33 + left: 0;
  34 + display: none;
  35 + width: 100%;
  36 + height: 100%;
  37 + z-index: 9999;
  38 + }
  39 + </style>
  40 + </head>
  41 + <body>
  42 + <div id="loading-screen"><span>Carregando...</span></div>
  43 + <div id="player">
  44 + <div class="missing">
  45 + <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
  46 + <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
  47 + </a>
  48 + </div>
  49 + </div>
  50 +
  51 + <script src="vendors/jquery/dist/jquery.min.js"></script>
  52 + <script src="http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js"></script>
  53 + <script src="vendors/qdclient/qdclient.js"></script>
  54 + <script src="player.js"></script>
  55 +
  56 + <script src="../main.js"></script>
  57 + </body>
  58 +</html>
0 \ No newline at end of file 59 \ No newline at end of file