Commit d7fee3a3b60ce7e38e4a2a0b7df963d880f273a2

Authored by Cassio Cabral
1 parent 53344726
Exists in master and in 1 other branch dynamic

passed lint over files to fix tabs and indetation

view/assets/js/articulation.js
1 (function(articulation, $, undefined) { 1 (function(articulation, $, undefined) {
2 -  
3 - var server_host = "";  
4 - var selectedY = "";  
5 -  
6 - function _updateASelector(container, ballSelector) {  
7 - $(container + " .ball-selector.active").each(function() {  
8 - $(this).removeClass("active"), $(this).find(".point-a-selector").remove()  
9 - }), ballSelector.addClass("active"), ballSelector.append('<div class="point-a-selector"><img src="' + server_host +  
10 - '/img/pa/A-Seletor.png" class="point-a-selector" alt=""></div>')  
11 - }  
12 -  
13 - function _setupModuleZ(hand) {  
14 - if (typeof selectedY == "undefined" || selectedY == "") return;  
15 -  
16 - var base_id = ".selection-panel-body[mainConfig=right-hand][subConfig=articulacao][step=2]";  
17 - var articulation_z = base_id + " .module-z";  
18 - $(articulation_z + " .ball-selector").hide();  
19 - $(articulation_z + " .row-number-" + selectedY + " .ball-selector").show();  
20 -  
21 - var z = $(articulation_z).attr("data-z");  
22 - if (typeof z != "undefined") {  
23 - var ball_selector = $(articulation_z + " .row-number-" + selectedY + " .ball-" + z);  
24 - _updateASelector(articulation_z, ball_selector);  
25 - }  
26 - }  
27 -  
28 - function _setupBallSelectorXY(hand) {  
29 - var base_id = ".selection-panel-body[mainConfig=right-hand][subConfig=articulacao][step=1]";  
30 - var articulation_x_y = base_id + " .module-x-y";  
31 - $(articulation_x_y + " .ball-selector").off("click").on("click", function(a) {  
32 - var b = $(a.target);  
33 - if (!b.hasClass("ball-selector")) {  
34 - dynworkflow.userSelectedAnOption();  
35 - return;  
36 - }  
37 - var c = b.parent(".grid-row"),  
38 - d = $(articulation_x_y),  
39 - f = b.attr("data-x"),  
40 - g = c.attr("data-y");  
41 - d.attr("data-x", f), d.attr("data-y", g), _updateASelector(articulation_x_y, b)  
42 - selectedY = g;  
43 - _setupModuleZ(hand);  
44 -  
45 - wikilibras.updateTempParameterJSON("right-hand", "articulacao", "1", f + ";" + g);  
46 - dynworkflow.userSelectedAnOption();  
47 - });  
48 - }  
49 -  
50 - function _setupBallSelectorZ(hand) {  
51 - var base_id = ".selection-panel-body[mainConfig=right-hand][subConfig=articulacao][step=2]";  
52 - var articulation_z = base_id + " .module-z";  
53 - $(articulation_z + " .ball-selector").off("click").on("click", function(a) {  
54 - var b = $(a.target);  
55 - if (!b.hasClass("ball-selector")) {  
56 - dynworkflow.userSelectedAnOption();  
57 - return;  
58 - }  
59 - var c = b.parent(".grid-row"),  
60 - e = $(articulation_z),  
61 - h = b.attr("data-z");  
62 - b.attr("data-z") && e.attr("data-z", h), _updateASelector(articulation_z, b);  
63 -  
64 - wikilibras.updateTempParameterJSON("right-hand", "articulacao", "2", h);  
65 - dynworkflow.userSelectedAnOption();  
66 - });  
67 - }  
68 -  
69 - function _updateParameterJSON(hand) {  
70 - var value = _readValue(hand);  
71 - wikilibras.updateParameterJSON("articulacao", value);  
72 - }  
73 -  
74 - function _calculateArticulationPointIndex(hand, xValue, yValue, zValue) {  
75 - var x = xValue;  
76 - var y = yValue;  
77 - var z = zValue;  
78 - if (hand == "left-hand") {  
79 - x = 10 - x + 1;  
80 - }  
81 - var value = (z-1)*10 + x + 30*(y-1);  
82 - //console.log(value);  
83 - return value;  
84 - }  
85 -  
86 - articulation.processValue = function(hand, selectionArray) {  
87 - var xyValueSplit = selectionArray[0].split(";");  
88 - var xValue = parseInt(xyValueSplit[0]);  
89 - var yValue = parseInt(xyValueSplit[1]);  
90 - var zValue = parseInt(selectionArray[1]);  
91 - return _calculateArticulationPointIndex(hand, xValue, yValue, zValue);  
92 - }  
93 -  
94 - articulation.setupModuleXY = function(serverhost) {  
95 - server_host = serverhost;  
96 - _setupBallSelectorXY("right-hand");  
97 - _setupBallSelectorXY("left-hand");  
98 - };  
99 -  
100 - articulation.setupModuleZ = function(serverhost) {  
101 - server_host = serverhost;  
102 - _setupBallSelectorZ("right-hand");  
103 - _setupBallSelectorZ("left-hand");  
104 - _setupModuleZ("right-hand");  
105 - _setupModuleZ("left-hand");  
106 - };  
107 -  
108 -}(window.articulation = window.articulation || {}, jQuery));  
109 \ No newline at end of file 2 \ No newline at end of file
  3 +
  4 + var server_host = '';
  5 + var selectedY = '';
  6 +
  7 + function _updateASelector(container, ballSelector) {
  8 + $(container + ' .ball-selector.active').each(function() {
  9 + $(this).removeClass('active'), $(this).find('.point-a-selector').remove();
  10 + }), ballSelector.addClass('active'), ballSelector.append('<div class="point-a-selector"><img src="' + server_host +
  11 + '/img/pa/A-Seletor.png" class="point-a-selector" alt=""></div>');
  12 + }
  13 +
  14 + function _setupModuleZ(hand) {
  15 + if (typeof selectedY == 'undefined' || selectedY == '') return;
  16 +
  17 + var base_id = '.selection-panel-body[mainConfig=right-hand][subConfig=articulacao][step=2]';
  18 + var articulation_z = base_id + ' .module-z';
  19 + $(articulation_z + ' .ball-selector').hide();
  20 + $(articulation_z + ' .row-number-' + selectedY + ' .ball-selector').show();
  21 +
  22 + var z = $(articulation_z).attr('data-z');
  23 + if (typeof z != 'undefined') {
  24 + var ball_selector = $(articulation_z + ' .row-number-' + selectedY + ' .ball-' + z);
  25 + _updateASelector(articulation_z, ball_selector);
  26 + }
  27 + }
  28 +
  29 + function _setupBallSelectorXY(hand) {
  30 + var base_id = '.selection-panel-body[mainConfig=right-hand][subConfig=articulacao][step=1]';
  31 + var articulation_x_y = base_id + ' .module-x-y';
  32 + $(articulation_x_y + ' .ball-selector').off('click').on('click', function(a) {
  33 + var b = $(a.target);
  34 + if (!b.hasClass('ball-selector')) {
  35 + dynworkflow.userSelectedAnOption();
  36 + return;
  37 + }
  38 + var c = b.parent('.grid-row'),
  39 + d = $(articulation_x_y),
  40 + f = b.attr('data-x'),
  41 + g = c.attr('data-y');
  42 + d.attr('data-x', f), d.attr('data-y', g), _updateASelector(articulation_x_y, b);
  43 + selectedY = g;
  44 + _setupModuleZ(hand);
  45 +
  46 + wikilibras.updateTempParameterJSON('right-hand', 'articulacao', '1', f + ';' + g);
  47 + dynworkflow.userSelectedAnOption();
  48 + });
  49 + }
  50 +
  51 + function _setupBallSelectorZ(hand) {
  52 + var base_id = '.selection-panel-body[mainConfig=right-hand][subConfig=articulacao][step=2]';
  53 + var articulation_z = base_id + ' .module-z';
  54 + $(articulation_z + ' .ball-selector').off('click').on('click', function(a) {
  55 + var b = $(a.target);
  56 + if (!b.hasClass('ball-selector')) {
  57 + dynworkflow.userSelectedAnOption();
  58 + return;
  59 + }
  60 + var c = b.parent('.grid-row'),
  61 + e = $(articulation_z),
  62 + h = b.attr('data-z');
  63 + b.attr('data-z') && e.attr('data-z', h), _updateASelector(articulation_z, b);
  64 +
  65 + wikilibras.updateTempParameterJSON('right-hand', 'articulacao', '2', h);
  66 + dynworkflow.userSelectedAnOption();
  67 + });
  68 + }
  69 +
  70 + function _updateParameterJSON(hand) {
  71 + var value = _readValue(hand);
  72 + wikilibras.updateParameterJSON('articulacao', value);
  73 + }
  74 +
  75 + function _calculateArticulationPointIndex(hand, xValue, yValue, zValue) {
  76 + var x = xValue;
  77 + var y = yValue;
  78 + var z = zValue;
  79 + if (hand == 'left-hand') {
  80 + x = 10 - x + 1;
  81 + }
  82 + var value = (z - 1) * 10 + x + 30 * (y - 1);
  83 + //console.log(value);
  84 + return value;
  85 + }
  86 +
  87 + articulation.processValue = function(hand, selectionArray) {
  88 + var xyValueSplit = selectionArray[0].split(';');
  89 + var xValue = parseInt(xyValueSplit[0]);
  90 + var yValue = parseInt(xyValueSplit[1]);
  91 + var zValue = parseInt(selectionArray[1]);
  92 + return _calculateArticulationPointIndex(hand, xValue, yValue, zValue);
  93 + };
  94 +
  95 + articulation.setupModuleXY = function(serverhost) {
  96 + server_host = serverhost;
  97 + _setupBallSelectorXY('right-hand');
  98 + _setupBallSelectorXY('left-hand');
  99 + };
  100 +
  101 + articulation.setupModuleZ = function(serverhost) {
  102 + server_host = serverhost;
  103 + _setupBallSelectorZ('right-hand');
  104 + _setupBallSelectorZ('left-hand');
  105 + _setupModuleZ('right-hand');
  106 + _setupModuleZ('left-hand');
  107 + };
  108 +
  109 +}(window.articulation = window.articulation || {}, jQuery));
view/assets/js/configuration.js
1 (function(configuration, $, undefined) { 1 (function(configuration, $, undefined) {
2 -  
3 - configuration.setupFingersGroup = function() {  
4 - var baseId = ".selection-panel-body[mainConfig=right-hand][subConfig=configuracao][step=1]";  
5 - $(baseId + " .selection-panel-option"  
6 - ).off("click").on("click", function() {  
7 - wikilibras.selectAnOption(baseId, this);  
8 - dynworkflow.userSelectedAnOption();  
9 - });  
10 - };  
11 -  
12 - configuration.setupFingersPosition = function() {  
13 - var stepTwoBaseId = ".selection-panel-body[mainConfig=right-hand][subConfig=configuracao][step=2]";  
14 - $(stepTwoBaseId + " .selection-panel-option").off("click").on(  
15 - "click", function() {  
16 - wikilibras.selectAnOption(stepTwoBaseId, this);  
17 - dynworkflow.userSelectedAnOption();  
18 - });  
19 -  
20 - var stepOneBaseId = ".selection-panel-body[mainConfig=right-hand][subConfig=configuracao][step=1]";  
21 - var finger_group = $(stepOneBaseId + " .selection-panel-option[select=true]").attr("value");  
22 - finger_group = typeof finger_group == "undefined" ? "0" : finger_group;  
23 - $(stepTwoBaseId + " .finger-group").hide();  
24 - $(stepTwoBaseId + " .finger-group[group=" + finger_group + "]").show();  
25 - }  
26 -  
27 -}(window.configuration = window.configuration || {}, jQuery));  
28 \ No newline at end of file 2 \ No newline at end of file
  3 +
  4 + configuration.setupFingersGroup = function() {
  5 + var baseId = '.selection-panel-body[mainConfig=right-hand][subConfig=configuracao][step=1]';
  6 + $(baseId + ' .selection-panel-option'
  7 + ).off('click').on('click', function() {
  8 + wikilibras.selectAnOption(baseId, this);
  9 + dynworkflow.userSelectedAnOption();
  10 + });
  11 + };
  12 +
  13 + configuration.setupFingersPosition = function() {
  14 + var stepTwoBaseId = '.selection-panel-body[mainConfig=right-hand][subConfig=configuracao][step=2]';
  15 + $(stepTwoBaseId + ' .selection-panel-option').off('click').on(
  16 + 'click', function() {
  17 + wikilibras.selectAnOption(stepTwoBaseId, this);
  18 + dynworkflow.userSelectedAnOption();
  19 + });
  20 +
  21 + var stepOneBaseId = '.selection-panel-body[mainConfig=right-hand][subConfig=configuracao][step=1]';
  22 + var finger_group = $(stepOneBaseId + ' .selection-panel-option[select=true]').attr('value');
  23 + finger_group = typeof finger_group == 'undefined' ? '0' : finger_group;
  24 + $(stepTwoBaseId + ' .finger-group').hide();
  25 + $(stepTwoBaseId + ' .finger-group[group=' + finger_group + ']').show();
  26 + };
  27 +
  28 +}(window.configuration = window.configuration || {}, jQuery));
view/assets/js/dynamic-selection-workflow.js
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 var jsonWF = {}; 4 var jsonWF = {};
5 var baseUrl = ''; 5 var baseUrl = '';
6 6
7 - // Main configurations: right-hand, left-hand and facial 7 + // Main configurations: right-hand, left-hand and facial
8 var mainConfig = ''; 8 var mainConfig = '';
9 // The converted Main Config (right/left-hand) to hand for using the same configuration 9 // The converted Main Config (right/left-hand) to hand for using the same configuration
10 var preprocessedMainConfig = ''; 10 var preprocessedMainConfig = '';
@@ -14,19 +14,19 @@ @@ -14,19 +14,19 @@
14 var currentSubconfigParent = ''; 14 var currentSubconfigParent = '';
15 var currentStep = 0; 15 var currentStep = 0;
16 16
17 - function _preprocessMainConfig(config) { 17 + function _preprocessMainConfig(config) {
18 config = config.replace('right-hand', 'hand'); 18 config = config.replace('right-hand', 'hand');
19 config = config.replace('left-hand', 'hand'); 19 config = config.replace('left-hand', 'hand');
20 return config; 20 return config;
21 } 21 }
22 22
23 - function _getFirstKey(json) { 23 + function _getFirstKey(json) {
24 var first_key = undefined; 24 var first_key = undefined;
25 for (first_key in json) break; 25 for (first_key in json) break;
26 return first_key; 26 return first_key;
27 } 27 }
28 28
29 - function _getAttributes(json) { 29 + function _getAttributes(json) {
30 var result = []; 30 var result = [];
31 for (attr in json) { 31 for (attr in json) {
32 result.push(attr); 32 result.push(attr);
@@ -34,22 +34,22 @@ @@ -34,22 +34,22 @@
34 return result; 34 return result;
35 } 35 }
36 36
37 - function _updateAndGetFirstMovementSubConfig() { 37 + function _updateAndGetFirstMovementSubConfig() {
38 var selectedMovement = movement.getPreviousSelectedMovement(mainConfig); 38 var selectedMovement = movement.getPreviousSelectedMovement(mainConfig);
39 - if (typeof selectedMovement == "undefined") return -1; 39 + if (typeof selectedMovement == 'undefined') return -1;
40 40
41 - currentSubconfigParent = jsonWF[preprocessedMainConfig]["movimento"][selectedMovement]; 41 + currentSubconfigParent = jsonWF[preprocessedMainConfig]['movimento'][selectedMovement];
42 currentSubConfigName = _getFirstKey(currentSubconfigParent); 42 currentSubConfigName = _getFirstKey(currentSubconfigParent);
43 return currentSubConfigName; 43 return currentSubConfigName;
44 } 44 }
45 45
46 - function _updateAndGetMovementConfig() { 46 + function _updateAndGetMovementConfig() {
47 currentSubconfigParent = jsonWF[preprocessedMainConfig]; 47 currentSubconfigParent = jsonWF[preprocessedMainConfig];
48 currentSubConfigName = _getFirstKey(currentSubconfigParent); 48 currentSubConfigName = _getFirstKey(currentSubconfigParent);
49 return currentSubConfigName; 49 return currentSubConfigName;
50 } 50 }
51 51
52 - function _getNextSubConfig(toForward) { 52 + function _getNextSubConfig(toForward) {
53 var attrs = _getAttributes(currentSubconfigParent); 53 var attrs = _getAttributes(currentSubconfigParent);
54 for (var i = 0; i < attrs.length; i++) { 54 for (var i = 0; i < attrs.length; i++) {
55 if (toForward && attrs[i] == currentSubConfigName && i < attrs.length - 1) { 55 if (toForward && attrs[i] == currentSubConfigName && i < attrs.length - 1) {
@@ -58,9 +58,9 @@ @@ -58,9 +58,9 @@
58 return attrs[i - 1]; 58 return attrs[i - 1];
59 } 59 }
60 } 60 }
61 - if (toForward && currentSubConfigName == "movimento") { 61 + if (toForward && currentSubConfigName == 'movimento') {
62 return _updateAndGetFirstMovementSubConfig(); 62 return _updateAndGetFirstMovementSubConfig();
63 - } else if (!toForward && preprocessedMainConfig == "hand") { 63 + } else if (!toForward && preprocessedMainConfig == 'hand') {
64 return _updateAndGetMovementConfig(); 64 return _updateAndGetMovementConfig();
65 } else if (!toForward) { 65 } else if (!toForward) {
66 return currentSubConfigName; 66 return currentSubConfigName;
@@ -69,39 +69,39 @@ @@ -69,39 +69,39 @@
69 } 69 }
70 } 70 }
71 71
72 - function _showCurrentSubconfig() { 72 + function _showCurrentSubconfig() {
73 _showSubconfiguration(mainConfig, currentSubConfigName, currentStep); 73 _showSubconfiguration(mainConfig, currentSubConfigName, currentStep);
74 } 74 }
75 75
76 - // It checks if a selection panel is already loaded 76 + // It checks if a selection panel is already loaded
77 function _isSubconfigurationPanelLoaded(mainConfig, subConfig, stepNumber) { 77 function _isSubconfigurationPanelLoaded(mainConfig, subConfig, stepNumber) {
78 var stepNumber = stepNumber + 1; 78 var stepNumber = stepNumber + 1;
79 - return $(".selection-panel-body[mainConfig=" + mainConfig + "][subConfig=" + subConfig +  
80 - "][step=" + stepNumber + "]").length > 0; 79 + return $('.selection-panel-body[mainConfig=' + mainConfig + '][subConfig=' + subConfig +
  80 + '][step=' + stepNumber + ']').length > 0;
81 } 81 }
82 82
83 - function _showLoadedSubconfigurationPanel(mainConfig, subConfig, stepNumber) { 83 + function _showLoadedSubconfigurationPanel(mainConfig, subConfig, stepNumber) {
84 var stepNumber = stepNumber + 1; 84 var stepNumber = stepNumber + 1;
85 - return $(".selection-panel-body[mainConfig=" + mainConfig + "][subConfig=" + subConfig +  
86 - "][step=" + stepNumber + "]").show(); 85 + return $('.selection-panel-body[mainConfig=' + mainConfig + '][subConfig=' + subConfig +
  86 + '][step=' + stepNumber + ']').show();
87 } 87 }
88 88
89 - // It renders or shows the requested selection panel 89 + // It renders or shows the requested selection panel
90 function _showSubconfiguration(mainConfig, subConfig, stepNumber) { 90 function _showSubconfiguration(mainConfig, subConfig, stepNumber) {
91 - $(".selection-panel-body").hide(); 91 + $('.selection-panel-body').hide();
92 if (_isSubconfigurationPanelLoaded(mainConfig, subConfig, stepNumber)) { 92 if (_isSubconfigurationPanelLoaded(mainConfig, subConfig, stepNumber)) {
93 _showLoadedSubconfigurationPanel(mainConfig, subConfig, stepNumber); 93 _showLoadedSubconfigurationPanel(mainConfig, subConfig, stepNumber);
94 } else { 94 } else {
95 var step = currentSubconfig[stepNumber]; 95 var step = currentSubconfig[stepNumber];
96 - step = typeof step == "undefined" ? "passo-1" : step;  
97 - dynengine.render(baseUrl, "/" + preprocessedMainConfig + "/" + subConfig +  
98 - "/" + step + ".html", "#selection-panel", true); 96 + step = typeof step == 'undefined' ? 'passo-1' : step;
  97 + dynengine.render(baseUrl, '/' + preprocessedMainConfig + '/' + subConfig +
  98 + '/' + step + '.html', '#selection-panel', true);
99 } 99 }
100 _selectTimelineIcon(mainConfig, subConfig, true); 100 _selectTimelineIcon(mainConfig, subConfig, true);
101 } 101 }
102 102
103 - function _selectSubConfig(subConfig) {  
104 - if (currentSubConfigName == "movimento") { 103 + function _selectSubConfig(subConfig) {
  104 + if (currentSubConfigName == 'movimento') {
105 _updateAndGetFirstMovementSubConfig(); 105 _updateAndGetFirstMovementSubConfig();
106 } 106 }
107 currentSubConfigName = subConfig; 107 currentSubConfigName = subConfig;
@@ -110,19 +110,19 @@ @@ -110,19 +110,19 @@
110 _showCurrentSubconfig(); 110 _showCurrentSubconfig();
111 } 111 }
112 112
113 - // It shows the next selection panel on the workflow 113 + // It shows the next selection panel on the workflow
114 function _showNextSubConfig() { 114 function _showNextSubConfig() {
115 _walkOnTheWorklow(true); 115 _walkOnTheWorklow(true);
116 } 116 }
117 117
118 - function _showPreviousSubConfig() { 118 + function _showPreviousSubConfig() {
119 _walkOnTheWorklow(false); 119 _walkOnTheWorklow(false);
120 } 120 }
121 121
122 - function _walkOnTheWorklow(toForward) { 122 + function _walkOnTheWorklow(toForward) {
123 currentStep = toForward ? currentStep + 1 : currentStep - 1; 123 currentStep = toForward ? currentStep + 1 : currentStep - 1;
124 124
125 - if (currentStep >= 0 && currentStep < currentSubconfig.length) { 125 + if (currentStep >= 0 && currentStep < currentSubconfig.length) {
126 _showCurrentSubconfig(); 126 _showCurrentSubconfig();
127 } else { 127 } else {
128 var nextSubConfig = _getNextSubConfig(toForward); 128 var nextSubConfig = _getNextSubConfig(toForward);
@@ -134,99 +134,98 @@ @@ -134,99 +134,98 @@
134 } 134 }
135 } 135 }
136 136
137 - // A callback function to be called when the user selects a option on a panel 137 + // A callback function to be called when the user selects a option on a panel
138 function _userSelectedAnOption() { 138 function _userSelectedAnOption() {
139 if (currentStep == currentSubconfig.length - 1) { 139 if (currentStep == currentSubconfig.length - 1) {
140 _setupCheckIcon(mainConfig, currentSubConfigName); 140 _setupCheckIcon(mainConfig, currentSubConfigName);
141 } 141 }
142 _showNextSubConfig(); 142 _showNextSubConfig();
143 - } 143 + }
144 144
145 - // Timeline functions 145 + // Timeline functions
146 function _selectTimelineIcon(mainConfig, subConfig) { 146 function _selectTimelineIcon(mainConfig, subConfig) {
147 - var icon_id = ".subconfiguration-panel[mainConfig=" + mainConfig +  
148 - "] .icon_container[json_name=" + subConfig + "]"; 147 + var icon_id = '.subconfiguration-panel[mainConfig=' + mainConfig +
  148 + '] .icon_container[json_name=' + subConfig + ']';
149 149
150 - var previousSelected = $(".subconfiguration-panel[mainConfig=" + mainConfig  
151 - +  
152 - "] .icon_container[select=true]").attr("json_name");  
153 - if (typeof previousSelected != "undefined") { 150 + var previousSelected = $('.subconfiguration-panel[mainConfig=' + mainConfig +
  151 + '] .icon_container[select=true]').attr('json_name');
  152 + if (typeof previousSelected != 'undefined') {
154 _deselectTimelineIcon(mainConfig, previousSelected); 153 _deselectTimelineIcon(mainConfig, previousSelected);
155 } 154 }
156 155
157 - wikilibras.enableIconHover($(icon_id), true);  
158 - $(icon_id).attr("select", true); 156 + wikilibras.enableIconHover($(icon_id), true);
  157 + $(icon_id).attr('select', true);
159 } 158 }
160 159
161 - function _deselectTimelineIcon(mainConfig, subConfig) {  
162 - var icon_id = ".subconfiguration-panel[mainConfig=" + mainConfig +  
163 - "] .icon_container[json_name=" + subConfig + "]"; 160 + function _deselectTimelineIcon(mainConfig, subConfig) {
  161 + var icon_id = '.subconfiguration-panel[mainConfig=' + mainConfig +
  162 + '] .icon_container[json_name=' + subConfig + ']';
164 163
165 - if ($(icon_id + "[complete=true]").length > 0) { 164 + if ($(icon_id + '[complete=true]').length > 0) {
166 _setupCheckIcon(mainConfig, subConfig); 165 _setupCheckIcon(mainConfig, subConfig);
167 } else { 166 } else {
168 wikilibras.enableIconHover($(icon_id), false); 167 wikilibras.enableIconHover($(icon_id), false);
169 - $(icon_id).attr("select", false); 168 + $(icon_id).attr('select', false);
170 } 169 }
171 } 170 }
172 171
173 - function _setupCheckIcon(mainConfig, subConfig) {  
174 - var icon_id = $(".subconfiguration-panel[mainConfig=" + mainConfig +  
175 - "] .icon_container[json_name=" + subConfig + "]"); 172 + function _setupCheckIcon(mainConfig, subConfig) {
  173 + var icon_id = $('.subconfiguration-panel[mainConfig=' + mainConfig +
  174 + '] .icon_container[json_name=' + subConfig + ']');
176 wikilibras.enableIconCheck(icon_id, true); 175 wikilibras.enableIconCheck(icon_id, true);
177 - $(icon_id).attr("complete", true);  
178 - $(icon_id).attr("select", false); 176 + $(icon_id).attr('complete', true);
  177 + $(icon_id).attr('select', false);
179 } 178 }
180 179
181 - function _isTimelineLoaded() {  
182 - return $(".subconfiguration-panel[mainConfig=" + mainConfig + "]").length > 0; 180 + function _isTimelineLoaded() {
  181 + return $('.subconfiguration-panel[mainConfig=' + mainConfig + ']').length > 0;
183 } 182 }
184 183
185 - function _setupTimelineListeners(timelineBaseId) {  
186 - $(timelineBaseId + " .icon_container[json_name]").off("click").on("click",  
187 - function() {  
188 - var subConfig = $(this).attr("json_name");  
189 - _selectSubConfig(subConfig);  
190 - }); 184 + function _setupTimelineListeners(timelineBaseId) {
  185 + $(timelineBaseId + ' .icon_container[json_name]').off('click').on('click',
  186 + function() {
  187 + var subConfig = $(this).attr('json_name');
  188 + _selectSubConfig(subConfig);
  189 + });
191 190
192 - $(timelineBaseId + " .arrow[name=right-arrow]").off("click").on("click", function() { 191 + $(timelineBaseId + ' .arrow[name=right-arrow]').off('click').on('click', function() {
193 _showNextSubConfig(); 192 _showNextSubConfig();
194 }); 193 });
195 194
196 - $(timelineBaseId + " .arrow[name=left-arrow]").off("click").on("click", function() { 195 + $(timelineBaseId + ' .arrow[name=left-arrow]').off('click').on('click', function() {
197 _showPreviousSubConfig(); 196 _showPreviousSubConfig();
198 }); 197 });
199 } 198 }
200 199
201 - function _setupTimelineIcons(timelineBaseId) {  
202 - $(timelineBaseId + " .icon_container[json_name]").hide(); 200 + function _setupTimelineIcons(timelineBaseId) {
  201 + $(timelineBaseId + ' .icon_container[json_name]').hide();
203 202
204 - for (var name in currentSubconfigParent) {  
205 - $(timelineBaseId + " .icon_container[json_name=" + name + "]").show(); 203 + for (var name in currentSubconfigParent) {
  204 + $(timelineBaseId + ' .icon_container[json_name=' + name + ']').show();
206 } 205 }
207 - if (preprocessedMainConfig == "hand") {  
208 - $(timelineBaseId + " .icon_container[json_name=movimento]").show();  
209 - _setupCheckIcon(mainConfig, "movimento"); 206 + if (preprocessedMainConfig == 'hand') {
  207 + $(timelineBaseId + ' .icon_container[json_name=movimento]').show();
  208 + _setupCheckIcon(mainConfig, 'movimento');
210 _selectTimelineIcon(mainConfig, currentSubConfigName); 209 _selectTimelineIcon(mainConfig, currentSubConfigName);
211 } 210 }
212 211
213 - _setupTimelineListeners(timelineBaseId); 212 + _setupTimelineListeners(timelineBaseId);
214 $(timelineBaseId).show(); 213 $(timelineBaseId).show();
215 } 214 }
216 215
217 - function _setupTimeline() {  
218 - var timelineBaseId = ".subconfiguration-panel[mainConfig=" + mainConfig + "]"; 216 + function _setupTimeline() {
  217 + var timelineBaseId = '.subconfiguration-panel[mainConfig=' + mainConfig + ']';
219 if (_isTimelineLoaded()) { 218 if (_isTimelineLoaded()) {
220 $(timelineBaseId).show(); 219 $(timelineBaseId).show();
221 } else { 220 } else {
222 - dynengine.render(baseUrl, "/" + preprocessedMainConfig +  
223 - "/timeline.html", "#selection-panel", false, function() {  
224 - _setupTimelineIcons(timelineBaseId);  
225 - }); 221 + dynengine.render(baseUrl, '/' + preprocessedMainConfig +
  222 + '/timeline.html', '#selection-panel', false, function() {
  223 + _setupTimelineIcons(timelineBaseId);
  224 + });
226 } 225 }
227 } 226 }
228 227
229 - // Public methods 228 + // Public methods
230 dynworkflow.selectMainConfig = function(config) { 229 dynworkflow.selectMainConfig = function(config) {
231 mainConfig = config; 230 mainConfig = config;
232 preprocessedMainConfig = _preprocessMainConfig(mainConfig); 231 preprocessedMainConfig = _preprocessMainConfig(mainConfig);
@@ -235,47 +234,47 @@ @@ -235,47 +234,47 @@
235 currentSubconfig = currentSubconfigParent[currentSubConfigName]; 234 currentSubconfig = currentSubconfigParent[currentSubConfigName];
236 currentStep = 0; 235 currentStep = 0;
237 236
238 - _showCurrentSubconfig(); 237 + _showCurrentSubconfig();
239 // hide the timeline on the first subconfiguration for "hand" 238 // hide the timeline on the first subconfiguration for "hand"
240 - if (preprocessedMainConfig != "hand" || _isTimelineLoaded()) { 239 + if (preprocessedMainConfig != 'hand' || _isTimelineLoaded()) {
241 _setupTimeline(); 240 _setupTimeline();
242 } 241 }
243 - } 242 + };
244 243
245 - dynworkflow.selectMovement = function(movement) {  
246 - var subconfigJSON = currentSubconfig[movement] 244 + dynworkflow.selectMovement = function(movement) {
  245 + var subconfigJSON = currentSubconfig[movement];
247 currentSubConfigName = _getFirstKey(subconfigJSON); 246 currentSubConfigName = _getFirstKey(subconfigJSON);
248 currentSubconfigParent = subconfigJSON; 247 currentSubconfigParent = subconfigJSON;
249 currentSubconfig = subconfigJSON[currentSubConfigName]; 248 currentSubconfig = subconfigJSON[currentSubConfigName];
250 currentStep = 0; 249 currentStep = 0;
251 250
252 - _showCurrentSubconfig(); 251 + _showCurrentSubconfig();
253 _setupTimeline(); 252 _setupTimeline();
254 - } 253 + };
255 254
256 - dynworkflow.selectSubConfig = function(subConfig) { 255 + dynworkflow.selectSubConfig = function(subConfig) {
257 _selectSubConfig(subConfig); 256 _selectSubConfig(subConfig);
258 - } 257 + };
259 258
260 - dynworkflow.userSelectedAnOption = function() { 259 + dynworkflow.userSelectedAnOption = function() {
261 _userSelectedAnOption(); 260 _userSelectedAnOption();
262 - } 261 + };
263 262
264 - dynworkflow.getFacialParameters = function() {  
265 - return _getAttributes(jsonWF["facial"]);  
266 - } 263 + dynworkflow.getFacialParameters = function() {
  264 + return _getAttributes(jsonWF['facial']);
  265 + };
267 266
268 - dynworkflow.getMovementParameters = function(movementName) {  
269 - return _getAttributes(jsonWF["hand"]["movimento"][movementName]);  
270 - } 267 + dynworkflow.getMovementParameters = function(movementName) {
  268 + return _getAttributes(jsonWF['hand']['movimento'][movementName]);
  269 + };
271 270
272 - dynworkflow.load = function() { 271 + dynworkflow.load = function() {
273 baseUrl = $('#server-url').data('url'); 272 baseUrl = $('#server-url').data('url');
274 - $.get(baseUrl + "/conf/selection-workflow-json", function(result) { 273 + $.get(baseUrl + '/conf/selection-workflow-json', function(result) {
275 jsonWF = $.parseJSON(result); 274 jsonWF = $.parseJSON(result);
276 }).fail(function() { 275 }).fail(function() {
277 - console.log("Failed to load the workflow configuration"); 276 + console.log('Failed to load the workflow configuration');
278 }); 277 });
279 - } 278 + };
280 279
281 }(window.dynworkflow = window.dynworkflow || {}, jQuery)); 280 }(window.dynworkflow = window.dynworkflow || {}, jQuery));
view/assets/js/facial.js
1 (function(facial, $, undefined) { 1 (function(facial, $, undefined) {
2 -  
3 - facial.setup = function() {  
4 - var baseId = ".selection-panel-body[mainConfig=facial]";  
5 - $(baseId + " .selection-panel-option").off("click").on(  
6 - "click", function() {  
7 - wikilibras.selectAnOption(baseId, this);  
8 - dynworkflow.userSelectedAnOption();  
9 - });  
10 - };  
11 -  
12 -}(window.facial = window.facial || {}, jQuery));  
13 \ No newline at end of file 2 \ No newline at end of file
  3 +
  4 + facial.setup = function() {
  5 + var baseId = '.selection-panel-body[mainConfig=facial]';
  6 + $(baseId + ' .selection-panel-option').off('click').on(
  7 + 'click', function() {
  8 + wikilibras.selectAnOption(baseId, this);
  9 + dynworkflow.userSelectedAnOption();
  10 + });
  11 + };
  12 +
  13 +}(window.facial = window.facial || {}, jQuery));
view/assets/js/js.cookie.js
@@ -5,141 +5,141 @@ @@ -5,141 +5,141 @@
5 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 5 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6 * Released under the MIT license 6 * Released under the MIT license
7 */ 7 */
8 -(function (factory) {  
9 - if (typeof define === 'function' && define.amd) {  
10 - define(factory);  
11 - } else if (typeof exports === 'object') {  
12 - module.exports = factory();  
13 - } else {  
14 - var _OldCookies = window.Cookies;  
15 - var api = window.Cookies = factory();  
16 - api.noConflict = function () {  
17 - window.Cookies = _OldCookies;  
18 - return api;  
19 - };  
20 - }  
21 -}(function () {  
22 - function extend () {  
23 - var i = 0;  
24 - var result = {};  
25 - for (; i < arguments.length; i++) {  
26 - var attributes = arguments[ i ];  
27 - for (var key in attributes) {  
28 - result[key] = attributes[key];  
29 - }  
30 - }  
31 - return result;  
32 - }  
33 -  
34 - function init (converter) {  
35 - function api (key, value, attributes) {  
36 - var result;  
37 -  
38 - // Write  
39 -  
40 - if (arguments.length > 1) {  
41 - attributes = extend({  
42 - path: '/'  
43 - }, api.defaults, attributes);  
44 -  
45 - if (typeof attributes.expires === 'number') {  
46 - var expires = new Date();  
47 - expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);  
48 - attributes.expires = expires;  
49 - }  
50 -  
51 - try {  
52 - result = JSON.stringify(value);  
53 - if (/^[\{\[]/.test(result)) {  
54 - value = result;  
55 - }  
56 - } catch (e) {}  
57 -  
58 - if (!converter.write) {  
59 - value = encodeURIComponent(String(value))  
60 - .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);  
61 - } else {  
62 - value = converter.write(value, key);  
63 - }  
64 -  
65 - key = encodeURIComponent(String(key));  
66 - key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);  
67 - key = key.replace(/[\(\)]/g, escape);  
68 -  
69 - return (document.cookie = [  
70 - key, '=', value,  
71 - attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE  
72 - attributes.path && '; path=' + attributes.path,  
73 - attributes.domain && '; domain=' + attributes.domain,  
74 - attributes.secure ? '; secure' : ''  
75 - ].join(''));  
76 - }  
77 -  
78 - // Read  
79 -  
80 - if (!key) {  
81 - result = {};  
82 - }  
83 -  
84 - // To prevent the for loop in the first place assign an empty array  
85 - // in case there are no cookies at all. Also prevents odd result when  
86 - // calling "get()"  
87 - var cookies = document.cookie ? document.cookie.split('; ') : [];  
88 - var rdecode = /(%[0-9A-Z]{2})+/g;  
89 - var i = 0;  
90 -  
91 - for (; i < cookies.length; i++) {  
92 - var parts = cookies[i].split('=');  
93 - var name = parts[0].replace(rdecode, decodeURIComponent);  
94 - var cookie = parts.slice(1).join('=');  
95 -  
96 - if (cookie.charAt(0) === '"') {  
97 - cookie = cookie.slice(1, -1);  
98 - }  
99 -  
100 - try {  
101 - cookie = converter.read ?  
102 - converter.read(cookie, name) : converter(cookie, name) ||  
103 - cookie.replace(rdecode, decodeURIComponent);  
104 -  
105 - if (this.json) {  
106 - try {  
107 - cookie = JSON.parse(cookie);  
108 - } catch (e) {}  
109 - }  
110 -  
111 - if (key === name) {  
112 - result = cookie;  
113 - break;  
114 - }  
115 -  
116 - if (!key) {  
117 - result[name] = cookie;  
118 - }  
119 - } catch (e) {}  
120 - }  
121 -  
122 - return result;  
123 - }  
124 -  
125 - api.get = api.set = api;  
126 - api.getJSON = function () {  
127 - return api.apply({  
128 - json: true  
129 - }, [].slice.call(arguments));  
130 - };  
131 - api.defaults = {};  
132 -  
133 - api.remove = function (key, attributes) {  
134 - api(key, '', extend(attributes, {  
135 - expires: -1  
136 - }));  
137 - };  
138 -  
139 - api.withConverter = init;  
140 -  
141 - return api;  
142 - }  
143 -  
144 - return init(function () {}); 8 +(function(factory) {
  9 + if (typeof define === 'function' && define.amd) {
  10 + define(factory);
  11 + } else if (typeof exports === 'object') {
  12 + module.exports = factory();
  13 + } else {
  14 + var _OldCookies = window.Cookies;
  15 + var api = window.Cookies = factory();
  16 + api.noConflict = function() {
  17 + window.Cookies = _OldCookies;
  18 + return api;
  19 + };
  20 + }
  21 +}(function() {
  22 + function extend() {
  23 + var i = 0;
  24 + var result = {};
  25 + for (; i < arguments.length; i++) {
  26 + var attributes = arguments[ i ];
  27 + for (var key in attributes) {
  28 + result[key] = attributes[key];
  29 + }
  30 + }
  31 + return result;
  32 + }
  33 +
  34 + function init(converter) {
  35 + function api(key, value, attributes) {
  36 + var result;
  37 +
  38 + // Write
  39 +
  40 + if (arguments.length > 1) {
  41 + attributes = extend({
  42 + path: '/'
  43 + }, api.defaults, attributes);
  44 +
  45 + if (typeof attributes.expires === 'number') {
  46 + var expires = new Date();
  47 + expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
  48 + attributes.expires = expires;
  49 + }
  50 +
  51 + try {
  52 + result = JSON.stringify(value);
  53 + if (/^[\{\[]/.test(result)) {
  54 + value = result;
  55 + }
  56 + } catch (e) {}
  57 +
  58 + if (!converter.write) {
  59 + value = encodeURIComponent(String(value))
  60 + .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
  61 + } else {
  62 + value = converter.write(value, key);
  63 + }
  64 +
  65 + key = encodeURIComponent(String(key));
  66 + key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
  67 + key = key.replace(/[\(\)]/g, escape);
  68 +
  69 + return (document.cookie = [
  70 + key, '=', value,
  71 + attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
  72 + attributes.path && '; path=' + attributes.path,
  73 + attributes.domain && '; domain=' + attributes.domain,
  74 + attributes.secure ? '; secure' : ''
  75 + ].join(''));
  76 + }
  77 +
  78 + // Read
  79 +
  80 + if (!key) {
  81 + result = {};
  82 + }
  83 +
  84 + // To prevent the for loop in the first place assign an empty array
  85 + // in case there are no cookies at all. Also prevents odd result when
  86 + // calling "get()"
  87 + var cookies = document.cookie ? document.cookie.split('; ') : [];
  88 + var rdecode = /(%[0-9A-Z]{2})+/g;
  89 + var i = 0;
  90 +
  91 + for (; i < cookies.length; i++) {
  92 + var parts = cookies[i].split('=');
  93 + var name = parts[0].replace(rdecode, decodeURIComponent);
  94 + var cookie = parts.slice(1).join('=');
  95 +
  96 + if (cookie.charAt(0) === '"') {
  97 + cookie = cookie.slice(1, -1);
  98 + }
  99 +
  100 + try {
  101 + cookie = converter.read ?
  102 + converter.read(cookie, name) : converter(cookie, name) ||
  103 + cookie.replace(rdecode, decodeURIComponent);
  104 +
  105 + if (this.json) {
  106 + try {
  107 + cookie = JSON.parse(cookie);
  108 + } catch (e) {}
  109 + }
  110 +
  111 + if (key === name) {
  112 + result = cookie;
  113 + break;
  114 + }
  115 +
  116 + if (!key) {
  117 + result[name] = cookie;
  118 + }
  119 + } catch (e) {}
  120 + }
  121 +
  122 + return result;
  123 + }
  124 +
  125 + api.get = api.set = api;
  126 + api.getJSON = function() {
  127 + return api.apply({
  128 + json: true
  129 + }, [].slice.call(arguments));
  130 + };
  131 + api.defaults = {};
  132 +
  133 + api.remove = function(key, attributes) {
  134 + api(key, '', extend(attributes, {
  135 + expires: -1
  136 + }));
  137 + };
  138 +
  139 + api.withConverter = init;
  140 +
  141 + return api;
  142 + }
  143 +
  144 + return init(function() {});
145 })); 145 }));
view/assets/js/movement.js
1 (function(movement, $, undefined) { 1 (function(movement, $, undefined) {
2 -  
3 - movement.getPreviousSelectedMovement = function(mainConfig) {  
4 - return $(".selection-panel-body[mainConfig=" + mainConfig +  
5 - "][subConfig=movimento][step=1] .selection-panel-option[select=true]").attr("value");  
6 - };  
7 2
8 - movement.setup = function(serverhost) {  
9 - var baseId = ".selection-panel-body[mainConfig=right-hand][subConfig=movimento][step=1]";  
10 - $(baseId + " .selection-panel-option").off("click").on(  
11 - "click", function() {  
12 - wikilibras.selectAnOption(baseId, this);  
13 - dynworkflow.selectMovement($(this).attr("value"));  
14 - });  
15 - };  
16 -}(window.movement = window.movement || {}, jQuery));  
17 \ No newline at end of file 3 \ No newline at end of file
  4 + movement.getPreviousSelectedMovement = function(mainConfig) {
  5 + return $('.selection-panel-body[mainConfig=' + mainConfig +
  6 + '][subConfig=movimento][step=1] .selection-panel-option[select=true]').attr('value');
  7 + };
  8 +
  9 + movement.setup = function(serverhost) {
  10 + var baseId = '.selection-panel-body[mainConfig=right-hand][subConfig=movimento][step=1]';
  11 + $(baseId + ' .selection-panel-option').off('click').on(
  12 + 'click', function() {
  13 + wikilibras.selectAnOption(baseId, this);
  14 + dynworkflow.selectMovement($(this).attr('value'));
  15 + });
  16 + };
  17 +}(window.movement = window.movement || {}, jQuery));
view/assets/js/orientation.js
1 (function(orientation, $, undefined) { 1 (function(orientation, $, undefined) {
2 -  
3 - orientation.setup = function() {  
4 - var baseId = ".selection-panel-body[mainConfig=right-hand][subConfig=orientacao][step=1]";  
5 - $(baseId + " .selection-panel-option").off("click").on(  
6 - "click", function() {  
7 - wikilibras.selectAnOption(baseId, this);  
8 - dynworkflow.userSelectedAnOption();  
9 - });  
10 - };  
11 -  
12 -}(window.orientation = window.orientation || {}, jQuery));  
13 \ No newline at end of file 2 \ No newline at end of file
  3 +
  4 + orientation.setup = function() {
  5 + var baseId = '.selection-panel-body[mainConfig=right-hand][subConfig=orientacao][step=1]';
  6 + $(baseId + ' .selection-panel-option').off('click').on(
  7 + 'click', function() {
  8 + wikilibras.selectAnOption(baseId, this);
  9 + dynworkflow.userSelectedAnOption();
  10 + });
  11 + };
  12 +
  13 +}(window.orientation = window.orientation || {}, jQuery));
view/assets/js/string
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -testtest  
2 \ No newline at end of file 0 \ No newline at end of file
view/assets/js/tmpJSONParser.js
1 (function(tmpJSONParser, $, undefined) { 1 (function(tmpJSONParser, $, undefined) {
2 -  
3 - var base_parameter_json = {};  
4 - var movement_parameter_json = {};  
5 -  
6 - function _getLoggedUser() {  
7 - var pybossa_rembember_token = Cookies.get('remember_token');  
8 - var splitted_token_id = pybossa_rembember_token.split('|');  
9 - return splitted_token_id.length > 0 ? splitted_token_id[0]  
10 - : 'anonymous';  
11 - }  
12 -  
13 - function _setupBaseParameterJSON(tmpJSON) {  
14 - base_parameter_json["userId"] = _getLoggedUser();  
15 - base_parameter_json["sinal"] = tmpJSON["sinal"];  
16 - base_parameter_json["interpolacao"] = "normal";  
17 - base_parameter_json["movimentos"] = [];  
18 - movement_parameter_json = {  
19 - "facial" : {},  
20 - "mao_direita" : {},  
21 - "mao_esquerda" : {}  
22 - };  
23 - base_parameter_json["movimentos"].push(movement_parameter_json);  
24 - }  
25 -  
26 - function _parseParameterValue(value) {  
27 - return !isNaN(value) ? parseInt(value) : value;  
28 - }  
29 -  
30 - function _parseTempFacialParameterJSON(tmpJSON) {  
31 - var attrs = dynworkflow.getFacialParameters();  
32 - for (var i in attrs) {  
33 - var attr = attrs[i];  
34 - parameterValue = tmpJSON["facial"][attr][0];  
35 - movement_parameter_json["facial"][attr] = _parseParameterValue(parameterValue);  
36 - }  
37 - }  
38 -  
39 - function _parseTempMovementParameterJSON(tmpJSON, hand) {  
40 - var movimentConfig = tmpJSON[hand]["movimento"];  
41 - if (typeof movimentConfig == "undefined") return;  
42 -  
43 - var movementName = movimentConfig[0];  
44 - var attrs = dynworkflow.getMovementParameters(movementName);  
45 - var parsedHand = hand == "right-hand" ? "mao_direita" : hand;  
46 - parsedHand = hand == "left-hand" ? "mao_esquerda" : parsedHand;  
47 - movement_parameter_json[parsedHand][movementName] = {};  
48 -  
49 - for (var i in attrs) {  
50 - var attr = attrs[i];  
51 - var parameterValue = "";  
52 - if (attr == "configuracao") {  
53 - parameterValue = tmpJSON[hand][attr][1];  
54 - } else if (attr == "articulacao") {  
55 - parameterValue = articulation.processValue(hand,  
56 - tmpJSON[hand][attr]);  
57 - } else {  
58 - parameterValue = tmpJSON[hand][attr][0];  
59 - }  
60 - movement_parameter_json[parsedHand][movementName][attr] =  
61 - _parseParameterValue(parameterValue);  
62 - }  
63 - }  
64 -  
65 - tmpJSONParser.parse = function(tmpJSON) {  
66 - _setupBaseParameterJSON(tmpJSON);  
67 - _parseTempFacialParameterJSON(tmpJSON);  
68 - _parseTempMovementParameterJSON(tmpJSON, "right-hand");  
69 - return base_parameter_json;  
70 - };  
71 -  
72 -}(window.tmpJSONParser = window.tmpJSONParser || {}, jQuery));  
73 \ No newline at end of file 2 \ No newline at end of file
  3 +
  4 + var base_parameter_json = {};
  5 + var movement_parameter_json = {};
  6 +
  7 + function _getLoggedUser() {
  8 + var pybossa_rembember_token = Cookies.get('remember_token');
  9 + var splitted_token_id = pybossa_rembember_token.split('|');
  10 + return splitted_token_id.length > 0 ? splitted_token_id[0]
  11 + : 'anonymous';
  12 + }
  13 +
  14 + function _setupBaseParameterJSON(tmpJSON) {
  15 + base_parameter_json['userId'] = _getLoggedUser();
  16 + base_parameter_json['sinal'] = tmpJSON['sinal'];
  17 + base_parameter_json['interpolacao'] = 'normal';
  18 + base_parameter_json['movimentos'] = [];
  19 + movement_parameter_json = {
  20 + 'facial': {},
  21 + 'mao_direita': {},
  22 + 'mao_esquerda': {}
  23 + };
  24 + base_parameter_json['movimentos'].push(movement_parameter_json);
  25 + }
  26 +
  27 + function _parseParameterValue(value) {
  28 + return !isNaN(value) ? parseInt(value) : value;
  29 + }
  30 +
  31 + function _parseTempFacialParameterJSON(tmpJSON) {
  32 + var attrs = dynworkflow.getFacialParameters();
  33 + for (var i in attrs) {
  34 + var attr = attrs[i];
  35 + parameterValue = tmpJSON['facial'][attr][0];
  36 + movement_parameter_json['facial'][attr] = _parseParameterValue(parameterValue);
  37 + }
  38 + }
  39 +
  40 + function _parseTempMovementParameterJSON(tmpJSON, hand) {
  41 + var movimentConfig = tmpJSON[hand]['movimento'];
  42 + if (typeof movimentConfig == 'undefined') return;
  43 +
  44 + var movementName = movimentConfig[0];
  45 + var attrs = dynworkflow.getMovementParameters(movementName);
  46 + var parsedHand = hand == 'right-hand' ? 'mao_direita' : hand;
  47 + parsedHand = hand == 'left-hand' ? 'mao_esquerda' : parsedHand;
  48 + movement_parameter_json[parsedHand][movementName] = {};
  49 +
  50 + for (var i in attrs) {
  51 + var attr = attrs[i];
  52 + var parameterValue = '';
  53 + if (attr == 'configuracao') {
  54 + parameterValue = tmpJSON[hand][attr][1];
  55 + } else if (attr == 'articulacao') {
  56 + parameterValue = articulation.processValue(hand,
  57 + tmpJSON[hand][attr]);
  58 + } else {
  59 + parameterValue = tmpJSON[hand][attr][0];
  60 + }
  61 + movement_parameter_json[parsedHand][movementName][attr] =
  62 + _parseParameterValue(parameterValue);
  63 + }
  64 + }
  65 +
  66 + tmpJSONParser.parse = function(tmpJSON) {
  67 + _setupBaseParameterJSON(tmpJSON);
  68 + _parseTempFacialParameterJSON(tmpJSON);
  69 + _parseTempMovementParameterJSON(tmpJSON, 'right-hand');
  70 + return base_parameter_json;
  71 + };
  72 +
  73 +}(window.tmpJSONParser = window.tmpJSONParser || {}, jQuery));
view/assets/js/wikilibras.js
@@ -87,9 +87,9 @@ @@ -87,9 +87,9 @@
87 87
88 function _canHover(el) { 88 function _canHover(el) {
89 var incompleteConfig = typeof $(el).attr('complete') == 'undefined' || 89 var incompleteConfig = typeof $(el).attr('complete') == 'undefined' ||
90 - $(el).attr('complete') == 'false'; 90 + $(el).attr('complete') == 'false';
91 return (!_isSelectingState() && incompleteConfig) || 91 return (!_isSelectingState() && incompleteConfig) ||
92 - (typeof $(el).attr('select') == 'undefined' && incompleteConfig); 92 + (typeof $(el).attr('select') == 'undefined' && incompleteConfig);
93 } 93 }
94 94
95 function _getCurrentMainConfiguration() { 95 function _getCurrentMainConfiguration() {
@@ -102,50 +102,50 @@ @@ -102,50 +102,50 @@
102 $('#avatar-default') 102 $('#avatar-default')
103 .fadeOut( 103 .fadeOut(
104 500, 104 500,
105 - function() {  
106 - $('#avatar-container').removeClass('col-sm-7');  
107 - $('#avatar-container').addClass('col-sm-5');  
108 - $('#selection-container').removeClass('col-sm-2');  
109 - $('#selection-container').addClass('col-sm-4');  
110 - $('#avatar-container').removeClass(  
111 - 'avatar-container-zoom-out');  
112 - $('#avatar-container').addClass(  
113 - 'avatar-container-zoom-in');  
114 - $('#avatar-' + option).removeClass(  
115 - 'avatar-img-zoom-out');  
116 - $('#avatar-' + option).fadeIn(  
117 - 500,  
118 - function() {  
119 - $('#avatar-' + option).addClass(  
120 - 'avatar-' + option +  
121 - '-img-zoom-in');  
122 - callback();  
123 - });  
124 - }); 105 + function() {
  106 + $('#avatar-container').removeClass('col-sm-7');
  107 + $('#avatar-container').addClass('col-sm-5');
  108 + $('#selection-container').removeClass('col-sm-2');
  109 + $('#selection-container').addClass('col-sm-4');
  110 + $('#avatar-container').removeClass(
  111 + 'avatar-container-zoom-out');
  112 + $('#avatar-container').addClass(
  113 + 'avatar-container-zoom-in');
  114 + $('#avatar-' + option).removeClass(
  115 + 'avatar-img-zoom-out');
  116 + $('#avatar-' + option).fadeIn(
  117 + 500,
  118 + function() {
  119 + $('#avatar-' + option).addClass(
  120 + 'avatar-' + option +
  121 + '-img-zoom-in');
  122 + callback();
  123 + });
  124 + });
125 } 125 }
126 126
127 function _addZoomOutToAvatar(option, callback) { 127 function _addZoomOutToAvatar(option, callback) {
128 $('#avatar-' + option).fadeOut( 128 $('#avatar-' + option).fadeOut(
129 500, 129 500,
130 - function() {  
131 - $('#selection-container').removeClass('col-sm-4');  
132 - $('#selection-container').addClass('col-sm-2');  
133 - $('#avatar-container').removeClass('col-sm-5');  
134 - $('#avatar-container').addClass('col-sm-7');  
135 - $('#avatar-container').removeClass(  
136 - 'avatar-container-zoom-in');  
137 - $('#avatar-container')  
138 - .addClass('avatar-container-zoom-out');  
139 - $('#avatar-default').fadeIn(  
140 - 500,  
141 - function() {  
142 - $('#avatar-' + option).removeClass(  
143 - 'avatar-' + option + '-img-zoom-in');  
144 - $('#avatar-' + option).addClass(  
145 - 'avatar-img-zoom-out');  
146 - callback();  
147 - });  
148 - }); 130 + function() {
  131 + $('#selection-container').removeClass('col-sm-4');
  132 + $('#selection-container').addClass('col-sm-2');
  133 + $('#avatar-container').removeClass('col-sm-5');
  134 + $('#avatar-container').addClass('col-sm-7');
  135 + $('#avatar-container').removeClass(
  136 + 'avatar-container-zoom-in');
  137 + $('#avatar-container')
  138 + .addClass('avatar-container-zoom-out');
  139 + $('#avatar-default').fadeIn(
  140 + 500,
  141 + function() {
  142 + $('#avatar-' + option).removeClass(
  143 + 'avatar-' + option + '-img-zoom-in');
  144 + $('#avatar-' + option).addClass(
  145 + 'avatar-img-zoom-out');
  146 + callback();
  147 + });
  148 + });
149 } 149 }
150 150
151 function _clearPreviousSelection() { 151 function _clearPreviousSelection() {
@@ -158,7 +158,7 @@ @@ -158,7 +158,7 @@
158 if (_isConfigurationComplete(current_option)) { 158 if (_isConfigurationComplete(current_option)) {
159 _setupCheckIcon(current_option, true); 159 _setupCheckIcon(current_option, true);
160 } 160 }
161 - $("#avatar-" + current_option).fadeOut(500); 161 + $('#avatar-' + current_option).fadeOut(500);
162 } 162 }
163 } 163 }
164 164
@@ -178,75 +178,75 @@ @@ -178,75 +178,75 @@
178 } 178 }
179 179
180 _addZoomOutToAvatar(config, function() { 180 _addZoomOutToAvatar(config, function() {
181 - $("#ready-button").fadeIn(300);  
182 - $(".edit-container").fadeIn(300); 181 + $('#ready-button').fadeIn(300);
  182 + $('.edit-container').fadeIn(300);
183 }); 183 });
184 - $("#selection-panel").fadeOut(300); 184 + $('#selection-panel').fadeOut(300);
185 } 185 }
186 186
187 function _canRenderSignVideo() { 187 function _canRenderSignVideo() {
188 - return _isConfigurationComplete("facial") &&  
189 - (_isConfigurationComplete("right-hand") || _isConfigurationComplete("left-hand")); 188 + return _isConfigurationComplete('facial') &&
  189 + (_isConfigurationComplete('right-hand') || _isConfigurationComplete('left-hand'));
190 } 190 }
191 191
192 function _finishConfiguration(config) { 192 function _finishConfiguration(config) {
193 _setupCheckIcon(config, true); 193 _setupCheckIcon(config, true);
194 - _setupCheckIcon("avatar-" + config, true);  
195 - $("#" + config + "-edit .check-icon").show(); 194 + _setupCheckIcon('avatar-' + config, true);
  195 + $('#' + config + '-edit .check-icon').show();
196 196
197 if (_canRenderSignVideo()) { 197 if (_canRenderSignVideo()) {
198 - $("#ready-button").removeClass("disabled"); 198 + $('#ready-button').removeClass('disabled');
199 } 199 }
200 } 200 }
201 201
202 function _unfinishConfiguration(config, panel) { 202 function _unfinishConfiguration(config, panel) {
203 _setupCheckIcon(config, false, panel); 203 _setupCheckIcon(config, false, panel);
204 - _setupCheckIcon("avatar-" + config, false, panel);  
205 - $("#" + config + "-edit .check-icon").hide(); 204 + _setupCheckIcon('avatar-' + config, false, panel);
  205 + $('#' + config + '-edit .check-icon').hide();
206 206
207 if (!_canRenderSignVideo()) { 207 if (!_canRenderSignVideo()) {
208 - $("#ready-button").addClass("disabled"); 208 + $('#ready-button').addClass('disabled');
209 } 209 }
210 } 210 }
211 211
212 function _setupGUIOnSelection(option) { 212 function _setupGUIOnSelection(option) {
213 - $("#ready-button").fadeOut(300);  
214 - $(".edit-container").fadeOut(300); 213 + $('#ready-button').fadeOut(300);
  214 + $('.edit-container').fadeOut(300);
215 _addZoomInToAvatar(option, function() { 215 _addZoomInToAvatar(option, function() {
216 - $("#selection-panel").fadeIn(300); 216 + $('#selection-panel').fadeIn(300);
217 }); 217 });
218 } 218 }
219 219
220 function _setupConfigurationPanel() { 220 function _setupConfigurationPanel() {
221 - $(".icon_container").off("mouseover").on("mouseover", function() { 221 + $('.icon_container').off('mouseover').on('mouseover', function() {
222 if (_canHover(this)) { 222 if (_canHover(this)) {
223 _enableIconHover(this, true); 223 _enableIconHover(this, true);
224 } 224 }
225 }); 225 });
226 - $(".icon_container").off("mouseout").on("mouseout", function() { 226 + $('.icon_container').off('mouseout').on('mouseout', function() {
227 if (_canHover(this)) { 227 if (_canHover(this)) {
228 _enableIconHover(this, false); 228 _enableIconHover(this, false);
229 } 229 }
230 }); 230 });
231 - $(".config-panel-option").off("click").on("click", function() {  
232 - _showSelectionPanel($(this).attr("panel")); 231 + $('.config-panel-option').off('click').on('click', function() {
  232 + _showSelectionPanel($(this).attr('panel'));
233 }); 233 });
234 - $("#minimize-icon-container").off("click").on("click", function() {  
235 - $("#ref-video-container").hide();  
236 - $("#minimize-icon-container").hide();  
237 - $("#maximize-icon-container").show(); 234 + $('#minimize-icon-container').off('click').on('click', function() {
  235 + $('#ref-video-container').hide();
  236 + $('#minimize-icon-container').hide();
  237 + $('#maximize-icon-container').show();
238 }); 238 });
239 - $("#maximize-icon-container").off("click").on("click", function() {  
240 - $("#ref-video-container").show();  
241 - $("#maximize-icon-container").hide();  
242 - $("#minimize-icon-container").show(); 239 + $('#maximize-icon-container').off('click').on('click', function() {
  240 + $('#ref-video-container').show();
  241 + $('#maximize-icon-container').hide();
  242 + $('#minimize-icon-container').show();
243 }); 243 });
244 } 244 }
245 245
246 function _updateTempParameterJSON(mainConfig, subConfig, step, value) { 246 function _updateTempParameterJSON(mainConfig, subConfig, step, value) {
247 var subConfigJSON = tmpParameterJSON[mainConfig][subConfig]; 247 var subConfigJSON = tmpParameterJSON[mainConfig][subConfig];
248 248
249 - if (typeof subConfigJSON == "undefined") { 249 + if (typeof subConfigJSON == 'undefined') {
250 tmpParameterJSON[mainConfig][subConfig] = []; 250 tmpParameterJSON[mainConfig][subConfig] = [];
251 subConfigJSON = tmpParameterJSON[mainConfig][subConfig]; 251 subConfigJSON = tmpParameterJSON[mainConfig][subConfig];
252 } 252 }
@@ -256,18 +256,18 @@ @@ -256,18 +256,18 @@
256 } 256 }
257 257
258 function _selectAnOption(parentId, el) { 258 function _selectAnOption(parentId, el) {
259 - $(parentId + " .selection-panel-option[select=true]").removeAttr(  
260 - "select");  
261 - $(el).attr("select", true); 259 + $(parentId + ' .selection-panel-option[select=true]').removeAttr(
  260 + 'select');
  261 + $(el).attr('select', true);
262 262
263 - var mainConfig = $(parentId).attr("mainConfig");  
264 - var subConfig = $(parentId).attr("subConfig");  
265 - var step = $(parentId).attr("step");  
266 - _updateTempParameterJSON(mainConfig, subConfig, step, $(el).attr("value")); 263 + var mainConfig = $(parentId).attr('mainConfig');
  264 + var subConfig = $(parentId).attr('subConfig');
  265 + var step = $(parentId).attr('step');
  266 + _updateTempParameterJSON(mainConfig, subConfig, step, $(el).attr('value'));
267 } 267 }
268 268
269 function _setupSelectionPanel() { 269 function _setupSelectionPanel() {
270 - $("#selection-panel .x").off("click").on("click", function() { 270 + $('#selection-panel .x').off('click').on('click', function() {
271 _hideSelectionPanel(); 271 _hideSelectionPanel();
272 }); 272 });
273 } 273 }
@@ -278,10 +278,10 @@ @@ -278,10 +278,10 @@
278 //console.log(parsedParameterJSON); 278 //console.log(parsedParameterJSON);
279 279
280 $.ajax({ 280 $.ajax({
281 - type: "POST",  
282 - url: api_url + "/sign", 281 + type: 'POST',
  282 + url: api_url + '/sign',
283 data: JSON.stringify(parsedParameterJSON), 283 data: JSON.stringify(parsedParameterJSON),
284 - contentType: "application/json", 284 + contentType: 'application/json',
285 success: function(response) { 285 success: function(response) {
286 console.log(response); 286 console.log(response);
287 callback(); 287 callback();
@@ -293,10 +293,10 @@ @@ -293,10 +293,10 @@
293 } 293 }
294 294
295 function _showRenderedAvatar() { 295 function _showRenderedAvatar() {
296 - var user_id = parsedParameterJSON["userId"];  
297 - var sign_name = parsedParameterJSON["sinal"];  
298 - var rendered_avatar_url = api_url + "/public/" + user_id + "/" +  
299 - sign_name + ".webm"; 296 + var user_id = parsedParameterJSON['userId'];
  297 + var sign_name = parsedParameterJSON['sinal'];
  298 + var rendered_avatar_url = api_url + '/public/' + user_id + '/' +
  299 + sign_name + ".webm";
300 $("#render-avatar video").attr("src", rendered_avatar_url); 300 $("#render-avatar video").attr("src", rendered_avatar_url);
301 $("#render-avatar").fadeIn(300); 301 $("#render-avatar").fadeIn(300);
302 } 302 }
@@ -323,10 +323,10 @@ @@ -323,10 +323,10 @@
323 $(".selection-panel-option").removeAttr("select"); 323 $(".selection-panel-option").removeAttr("select");
324 $(".icon_container").removeAttr("select"); 324 $(".icon_container").removeAttr("select");
325 $(".icon_container[complete=true]").each( 325 $(".icon_container[complete=true]").each(
326 - function() {  
327 - _unfinishConfiguration($(this).attr("name"), $(this).attr(  
328 - "panel"));  
329 - }); 326 + function() {
  327 + _unfinishConfiguration($(this).attr("name"), $(this).attr(
  328 + "panel"));
  329 + });
330 } 330 }
331 331
332 function _setupMainScreen(task, deferred) { 332 function _setupMainScreen(task, deferred) {
@@ -374,11 +374,11 @@ @@ -374,11 +374,11 @@
374 answer["parameter_json"] = parsedParameterJSON; 374 answer["parameter_json"] = parsedParameterJSON;
375 375
376 /*pybossa.saveTask(task.id, answer).done(function() { 376 /*pybossa.saveTask(task.id, answer).done(function() {
377 - setTimeout(function() {  
378 - $("#thanks-screen").hide();  
379 - deferred.resolve();  
380 - }, 2500);  
381 - });*/ 377 + setTimeout(function() {
  378 + $("#thanks-screen").hide();
  379 + deferred.resolve();
  380 + }, 2500);
  381 + });*/
382 382
383 setTimeout(function() { 383 setTimeout(function() {
384 $("#thanks-screen").hide(); 384 $("#thanks-screen").hide();