Browse Source

style: reformatted code

Marcelo Vilas Boas Correa Filho 2 years ago
parent
commit
91ac323ed2

File diff suppressed because it is too large
+ 6506 - 6504
js/accessibleUI/bootstrap/bootstrap.bundle.js


File diff suppressed because it is too large
+ 764 - 1
js/accessibleUI/bootstrap/bootstrap.bundle.js.map


File diff suppressed because it is too large
+ 950 - 1
js/accessibleUI/bootstrap/bootstrap.bundle.min.js.map


File diff suppressed because it is too large
+ 4284 - 4282
js/accessibleUI/bootstrap/bootstrap.js


File diff suppressed because it is too large
+ 762 - 1
js/accessibleUI/bootstrap/bootstrap.js.map


File diff suppressed because it is too large
+ 664 - 1
js/accessibleUI/bootstrap/bootstrap.min.js.map


+ 1 - 1
js/accessibleUI/code-view.js

@@ -21,7 +21,7 @@ let universalId = {
     }
 };
 
-function getCurrentMainLineNumber() {
+function getCurrentMainLineNumber () {
     // TO DO: Find a way to know in wath line the main code is
     return $(".code-line").length + 1;
 }

+ 120 - 120
js/accessibleUI/compiler.js

@@ -23,145 +23,145 @@ const runCodeStopIcon = document.getElementById('runCodeStopIcon');
 //Debug
 const generatedCode = document.getElementById('generatedCode');
 
-function generateCode() {
-
-  console.log(variables);
-  console.log(operations);
-
-  let code = `programa {\n`;
-
-  for (let i = 0; i < variables.length; i++) {
-    code += `    ${variables[i].type.name} ${variables[i].name} <- ${variables[i].type.barrier}${variables[i].value}${variables[i].type.barrier}\n`;
-  }
-
-  code += `    funcao vazio inicio () {\n`;
-
-  for (let i = 0; i < operations.length; i++) {
-    code += `        ${operations[i].assignedVariable.name} <- `;
-
-    for (let j = 0; j < operations[i].operators.length; j++) {
-      switch (operations[i].operators[j].type.value) {
-        case 'VARIABLE':
-          code += operations[i].operators[j].variable.name;
-          break;
-        case 'VALUE':
-          code += operations[i].operators[j].value;
-          break;
-        case 'OPERATOR':
-          code += operations[i].operators[j].operator.name;
-          break;
-      }
+function generateCode () {
+
+    console.log(variables);
+    console.log(operations);
+
+    let code = `programa {\n`;
+
+    for (let i = 0; i < variables.length; i++) {
+        code += `    ${variables[i].type.name} ${variables[i].name} <- ${variables[i].type.barrier}${variables[i].value}${variables[i].type.barrier}\n`;
     }
 
-    code += `\n`;
-  }
+    code += `    funcao vazio inicio () {\n`;
+
+    for (let i = 0; i < operations.length; i++) {
+        code += `        ${operations[i].assignedVariable.name} <- `;
+
+        for (let j = 0; j < operations[i].operators.length; j++) {
+            switch (operations[i].operators[j].type.value) {
+                case 'VARIABLE':
+                    code += operations[i].operators[j].variable.name;
+                    break;
+                case 'VALUE':
+                    code += operations[i].operators[j].value;
+                    break;
+                case 'OPERATOR':
+                    code += operations[i].operators[j].operator.name;
+                    break;
+            }
+        }
+
+        code += `\n`;
+    }
 
-  for (let i = 0; i < variables.length; i++) {
-    code += `        escreva ("${variables[i].name}: " + ${variables[i].name} + "\\n")\n`;
-  }
+    for (let i = 0; i < variables.length; i++) {
+        code += `        escreva ("${variables[i].name}: " + ${variables[i].name} + "\\n")\n`;
+    }
 
-  code += `    }\n`;
+    code += `    }\n`;
 
-  code += `}`;
+    code += `}`;
 
-  generatedCode.innerText = code;
+    generatedCode.innerText = code;
 
-  return code;
+    return code;
 }
 
-export function runCode() {
-  if (isRunning) {
-    return;
-  }
-  let strCode = generateCode();
-
-  if (strCode == null) {
-    return;
-  }
-
-  // toggleConsole(true);
-
-  // if(domConsole == null)
-  //   domConsole = new DOMConsole("#ivprog-term");
-  //$("#ivprog-term").slideDown(500);
-  try {
-    const data = SemanticAnalyser.analyseFromSource(strCode);
-    proc = new IVProgProcessor(data);
-    proc.registerInput(domConsole);
-    proc.registerOutput(domConsole);
-    $("#ivprog-term").addClass('ivprog-term-active');
-    isRunning = true;
-    proc.interpretAST().then(_ => {
-      scheduleCall(() => {
-        if (domConsole.pending_writes.length == 0) {
-          if (proc.mode === Modes.ABORT) {
-            domConsole.info(LocalizedStrings.getMessage("aborted_execution"));
-          } else {
-            domConsole.info(LocalizedStrings.getMessage("success_execution"));
-          }
-          $("#ivprog-term").removeClass('ivprog-term-active');
-          isRunning = false;
-          proc = null;
-          showRunButton();
-          return true;
-        }
-        return false;
-      }, 100);
-    }).catch(err => {
-      scheduleCall(() => {
-        if (domConsole.pending_writes.length == 0) {
-          if (err instanceof Error) {
-            domConsole.err(err.message);
-          } else {
-            domConsole.err(err);
-          }
-          // $("#ivprog-term").removeClass('ivprog-term-active');
-          isRunning = false;
-          proc = null;
-          showRunButton();
-          return true;
-        }
-        return false;
-      }, 100);
-    })
-  } catch (error) {
-    scheduleCall(() => {
-      if (domConsole.pending_writes.length == 0) {
-        isRunning = false;
-        proc = null;
-        showRunButton();
-        domConsole.err(error.message);
-        console.log(error);
-        return true;
-      }
-      return false;
-    }, 100);
-  }
+export function runCode () {
+    if (isRunning) {
+        return;
+    }
+    let strCode = generateCode();
+
+    if (strCode == null) {
+        return;
+    }
+
+    // toggleConsole(true);
+
+    // if(domConsole == null)
+    //   domConsole = new DOMConsole("#ivprog-term");
+    //$("#ivprog-term").slideDown(500);
+    try {
+        const data = SemanticAnalyser.analyseFromSource(strCode);
+        proc = new IVProgProcessor(data);
+        proc.registerInput(domConsole);
+        proc.registerOutput(domConsole);
+        $("#ivprog-term").addClass('ivprog-term-active');
+        isRunning = true;
+        proc.interpretAST().then(_ => {
+            scheduleCall(() => {
+                if (domConsole.pending_writes.length == 0) {
+                    if (proc.mode === Modes.ABORT) {
+                        domConsole.info(LocalizedStrings.getMessage("aborted_execution"));
+                    } else {
+                        domConsole.info(LocalizedStrings.getMessage("success_execution"));
+                    }
+                    $("#ivprog-term").removeClass('ivprog-term-active');
+                    isRunning = false;
+                    proc = null;
+                    showRunButton();
+                    return true;
+                }
+                return false;
+            }, 100);
+        }).catch(err => {
+            scheduleCall(() => {
+                if (domConsole.pending_writes.length == 0) {
+                    if (err instanceof Error) {
+                        domConsole.err(err.message);
+                    } else {
+                        domConsole.err(err);
+                    }
+                    // $("#ivprog-term").removeClass('ivprog-term-active');
+                    isRunning = false;
+                    proc = null;
+                    showRunButton();
+                    return true;
+                }
+                return false;
+            }, 100);
+        })
+    } catch (error) {
+        scheduleCall(() => {
+            if (domConsole.pending_writes.length == 0) {
+                isRunning = false;
+                proc = null;
+                showRunButton();
+                domConsole.err(error.message);
+                console.log(error);
+                return true;
+            }
+            return false;
+        }, 100);
+    }
 }
 
 // ***********************************************************************
 
-function scheduleCall(callback, time) {
-  const scheduled_call = () => {
-    const id = setInterval(() => {
-      if (callback()) {
-        clearInterval(id);
-      }
-    }, time)
-  }
-  scheduled_call();
+function scheduleCall (callback, time) {
+    const scheduled_call = () => {
+        const id = setInterval(() => {
+            if (callback()) {
+                clearInterval(id);
+            }
+        }, time)
+    }
+    scheduled_call();
 }
 
 // ***********************************************************************
 
-function showRunButton() {
-  runCodePlayIcon.style.display = 'inline';
-  runCodeStopIcon.style.display = 'none';
+function showRunButton () {
+    runCodePlayIcon.style.display = 'inline';
+    runCodeStopIcon.style.display = 'none';
 }
 
-function showStopButton() {
-  runCodePlayIcon.style.display = 'none';
-  runCodeStopIcon.style.display = 'inline';
+function showStopButton () {
+    runCodePlayIcon.style.display = 'none';
+    runCodeStopIcon.style.display = 'inline';
 }
 
 // ***********************************************************************

+ 1 - 1
js/accessibleUI/data-types.js

@@ -10,7 +10,7 @@ const dataTypes = {
     char: 'Char'
 };
 
-function getVariableTypeBarrier(dataType) {
+function getVariableTypeBarrier (dataType) {
     switch (dataType) {
         case 'String':
             return "\"";

+ 25 - 25
js/accessibleUI/main.js

@@ -18,36 +18,36 @@ const createVariableButton = document.getElementById('createVariableButton');
 const assignVariableButton = document.getElementById('assignVariableButton');
 const runCodeButton = document.getElementById('runCodeButton');
 
-export function initAccessibleUI() {
-
-  // Initializing dropdown menus
-  $(".dropdown-submenu a.test").on("click", function (e) {
-    $(this).next("ul").toggle();
-    e.stopPropagation();
-    e.preventDefault();
-  });
-
-  // Adding listeners
-  createVariableButton.addEventListener('click', ev => {
-    createVariable();
-  });
-
-  assignVariableButton.addEventListener('click', ev => {
-    createOperation();
-  });
-
-  runCodeButton.addEventListener('click', ev => {
-    runCode();
-  });
+export function initAccessibleUI () {
+
+    // Initializing dropdown menus
+    $(".dropdown-submenu a.test").on("click", function (e) {
+        $(this).next("ul").toggle();
+        e.stopPropagation();
+        e.preventDefault();
+    });
+
+    // Adding listeners
+    createVariableButton.addEventListener('click', ev => {
+        createVariable();
+    });
+
+    assignVariableButton.addEventListener('click', ev => {
+        createOperation();
+    });
+
+    runCodeButton.addEventListener('click', ev => {
+        runCode();
+    });
 }
 
 // ***********************************************************************
 
 // Reference: https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid
-export function generateUUID() {
-  return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
-    (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
-  );
+export function generateUUID () {
+    return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
+        (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
+    );
 }
 
 // ***********************************************************************

+ 3 - 3
js/accessibleUI/modules/functions.js

@@ -1,7 +1,7 @@
 let creatingFunction = false;
 
-function addFunctionToScreen({
-                                 name = "functionName",
-                             }) {
+function addFunctionToScreen ({
+                                  name = "functionName",
+                              }) {
 
 }

+ 1 - 3
js/accessibleUI/modules/main-code-type.js

@@ -1,5 +1,3 @@
-
-
-function dsa() {
+function dsa () {
 
 }

+ 109 - 109
js/accessibleUI/modules/operations/operations-schemes.js

@@ -9,9 +9,9 @@ import {operations} from "./operations";
 // *********************************************************************************
 
 export const operationScheme = {
-  hash: 'UUID for the operation',
-  assignedVariable: 'Reference to the assigned variable',
-  operators: []
+    hash: 'UUID for the operation',
+    assignedVariable: 'Reference to the assigned variable',
+    operators: []
 }
 
 // *********************************************************************************
@@ -19,11 +19,11 @@ export const operationScheme = {
 // *********************************************************************************
 
 export const operatorScheme = {
-  hash: 'UUID for the operator',
-  type: 'Operator type',
-  value: 'Operator value',
-  variable: 'Reference to the variable',
-  operator: 'Reference to operator'
+    hash: 'UUID for the operator',
+    type: 'Operator type',
+    value: 'Operator value',
+    variable: 'Reference to the variable',
+    operator: 'Reference to operator'
 }
 
 // *********************************************************************************
@@ -31,18 +31,18 @@ export const operatorScheme = {
 // *********************************************************************************
 
 export const operatorTypes = [
-  {
-    name: 'Variável',
-    value: 'VARIABLE'
-  },
-  {
-    name: 'Valor',
-    value: 'VALUE'
-  },
-  {
-    name: 'Operator',
-    value: 'OPERATOR'
-  }
+    {
+        name: 'Variável',
+        value: 'VARIABLE'
+    },
+    {
+        name: 'Valor',
+        value: 'VALUE'
+    },
+    {
+        name: 'Operator',
+        value: 'OPERATOR'
+    }
 ]
 
 // *********************************************************************************
@@ -50,34 +50,34 @@ export const operatorTypes = [
 // *********************************************************************************
 
 export const operationTypes = [
-  {
-    name: ';',
-    value: 'SEMICOLON'
-  },
-  {
-    name: '+',
-    value: 'PLUS'
-  },
-  {
-    name: '-',
-    value: 'MINUS'
-  },
-  {
-    name: '*',
-    value: 'MULTIPLICATION'
-  },
-  {
-    name: '/',
-    value: 'DIVISION'
-  },
-  {
-    name: '(',
-    value: 'OPEN_PARENTHESES'
-  },
-  {
-    name: ')',
-    value: 'CLOSE_PARENTHESES'
-  },
+    {
+        name: ';',
+        value: 'SEMICOLON'
+    },
+    {
+        name: '+',
+        value: 'PLUS'
+    },
+    {
+        name: '-',
+        value: 'MINUS'
+    },
+    {
+        name: '*',
+        value: 'MULTIPLICATION'
+    },
+    {
+        name: '/',
+        value: 'DIVISION'
+    },
+    {
+        name: '(',
+        value: 'OPEN_PARENTHESES'
+    },
+    {
+        name: ')',
+        value: 'CLOSE_PARENTHESES'
+    },
 ]
 
 // *********************************************************************************
@@ -85,28 +85,28 @@ export const operationTypes = [
 // *********************************************************************************
 
 export const operatorKinds = [
-  {
-    name: 'Variável',
-    value: 'VARIABLE'
-  },
-  {
-    name: 'Valor',
-    value: 'VALUE'
-  }
+    {
+        name: 'Variável',
+        value: 'VARIABLE'
+    },
+    {
+        name: 'Valor',
+        value: 'VALUE'
+    }
 ]
 
 // *********************************************************************************
 // Operation type html schemes
 // *********************************************************************************
 
-export function htmlOperationTypeScheme() {
-  let operationTypesSelect = ``;
+export function htmlOperationTypeScheme () {
+    let operationTypesSelect = ``;
 
-  for (let i = 0; i < operationTypes.length; i++) {
-    operationTypesSelect += `<option value="${operationTypes[i].value}">${operationTypes[i].name}</option>`;
-  }
+    for (let i = 0; i < operationTypes.length; i++) {
+        operationTypesSelect += `<option value="${operationTypes[i].value}">${operationTypes[i].name}</option>`;
+    }
 
-  return `<select  id="operation<operationKindId>Select" title="selecione o tipo da operação" >
+    return `<select  id="operation<operationKindId>Select" title="selecione o tipo da operação" >
     <option > selecione</option>
     ${operationTypesSelect}
 </select>`;
@@ -116,14 +116,14 @@ export function htmlOperationTypeScheme() {
 // Assign variable operation kind html schemes
 // *********************************************************************************
 
-export function htmlOperationKindScheme(operation) {
-  let operatorKindsSelect = ``;
+export function htmlOperationKindScheme (operation) {
+    let operatorKindsSelect = ``;
 
-  for (let i = 0; i < operatorKinds.length; i++) {
-    operatorKindsSelect += `<option value="${operatorKinds[i].value}">${operatorKinds[i].name}</option>`;
-  }
+    for (let i = 0; i < operatorKinds.length; i++) {
+        operatorKindsSelect += `<option value="${operatorKinds[i].value}">${operatorKinds[i].name}</option>`;
+    }
 
-  return `<select  id="operation${operation.hash}KindSelect" title="selecione o tipo de atrabuição" operation-id="${operation.hash}">
+    return `<select  id="operation${operation.hash}KindSelect" title="selecione o tipo de atrabuição" operation-id="${operation.hash}">
     <option > selecione</option>
     ${operatorKindsSelect}
 </select>`;
@@ -133,11 +133,11 @@ export function htmlOperationKindScheme(operation) {
 // Assign variable html schemes
 // *********************************************************************************
 
-export function htmlAssignVariableScheme() {
+export function htmlAssignVariableScheme () {
 
-  let variablesSelect = htmlVariablesSelectScheme();
+    let variablesSelect = htmlVariablesSelectScheme();
 
-  return `<li id="operation<operationId>Li">
+    return `<li id="operation<operationId>Li">
     <div class="row">
         <form id="operation<operationId>Form">
             <select title="selecione a variável" id="operation<operationId>AssignVariableSelect" name="variableSelect" operation-id="<operationId>"> 
@@ -155,14 +155,14 @@ export function htmlAssignVariableScheme() {
 // Variable select html schemes
 // *********************************************************************************
 
-export function htmlVariablesSelectScheme() {
-  let variablesSelect = variables.length === 0 ? `<option>N/A</option>` : ``;
+export function htmlVariablesSelectScheme () {
+    let variablesSelect = variables.length === 0 ? `<option>N/A</option>` : ``;
 
-  for (let i = 0; i < variables.length; i++) {
-    variablesSelect += `<option value="${variables[i].hash}">${variables[i].name}</option>`
-  }
+    for (let i = 0; i < variables.length; i++) {
+        variablesSelect += `<option value="${variables[i].hash}">${variables[i].name}</option>`
+    }
 
-  return variablesSelect;
+    return variablesSelect;
 }
 
 // *********************************************************************************
@@ -171,14 +171,14 @@ export function htmlVariablesSelectScheme() {
 // Operator variable select
 // *********************************************************************************
 
-export function htmlOperatorVariablesSelectScheme(operation, operator) {
-  let variablesSelect = variables.length === 0 ? `<option>N/A</option>` : ``;
+export function htmlOperatorVariablesSelectScheme (operation, operator) {
+    let variablesSelect = variables.length === 0 ? `<option>N/A</option>` : ``;
 
-  for (let i = 0; i < variables.length; i++) {
-    variablesSelect += `<option value="${variables[i].hash}">${variables[i].name}</option>`
-  }
+    for (let i = 0; i < variables.length; i++) {
+        variablesSelect += `<option value="${variables[i].hash}">${variables[i].name}</option>`
+    }
 
-  return `<select id="operation${operation.hash}Operator${operator.hash}VariableSelect" name="variableSelect" title="selecione a variável" operation-id="${operation.hash}" operator-id="${operator.hash}">
+    return `<select id="operation${operation.hash}Operator${operator.hash}VariableSelect" name="variableSelect" title="selecione a variável" operation-id="${operation.hash}" operator-id="${operator.hash}">
     ${variablesSelect}
 </select>`;
 }
@@ -187,22 +187,22 @@ export function htmlOperatorVariablesSelectScheme(operation, operator) {
 // Operator value input
 // *********************************************************************************
 
-export function htmlOperatorValueInputScheme(operation, operator) {
-  return `<input type="number" id="operation${operation.hash}Operator${operator.hash}ValueInput" name="" title="valor" operation-id="${operation.hash}" operator-id="${operator.hash}">`;
+export function htmlOperatorValueInputScheme (operation, operator) {
+    return `<input type="number" id="operation${operation.hash}Operator${operator.hash}ValueInput" name="" title="valor" operation-id="${operation.hash}" operator-id="${operator.hash}">`;
 }
 
 // *********************************************************************************
 // Operation type select
 // *********************************************************************************
 
-export function htmlOperationTypeSelect(operation, operator) {
-  let operationTypesSelect = ``;
+export function htmlOperationTypeSelect (operation, operator) {
+    let operationTypesSelect = ``;
 
-  for (let i = 0; i < operationTypes.length; i++) {
-    operationTypesSelect += `<option value="${operationTypes[i].value}">${operationTypes[i].name}</option>`;
-  }
+    for (let i = 0; i < operationTypes.length; i++) {
+        operationTypesSelect += `<option value="${operationTypes[i].value}">${operationTypes[i].name}</option>`;
+    }
 
-  return `<select  id="operation${operation.hash}Operator${operator.hash}OperationTypeSelect" title="selecione o tipo da operação" operation-id="${operation.hash}" operator-id="${operator.hash}">
+    return `<select  id="operation${operation.hash}Operator${operator.hash}OperationTypeSelect" title="selecione o tipo da operação" operation-id="${operation.hash}" operator-id="${operator.hash}">
     ${operationTypesSelect}
 </select>`;
 }
@@ -211,35 +211,35 @@ export function htmlOperationTypeSelect(operation, operator) {
 // Util
 // *********************************************************************************
 
-export function getOperatorTypeByValue(value) {
-  for (let i = 0; i < operatorTypes.length; i++) {
-    if (operatorTypes[i].value === value)
-      return operatorTypes[i];
-  }
+export function getOperatorTypeByValue (value) {
+    for (let i = 0; i < operatorTypes.length; i++) {
+        if (operatorTypes[i].value === value)
+            return operatorTypes[i];
+    }
 
-  return null;
+    return null;
 }
 
 // *********************************************************************************
 
-export function getOperationTypeByValue(value) {
-  for (let i = 0; i < operationTypes.length; i++) {
-    if (operationTypes[i].value === value)
-      return operationTypes[i];
-  }
+export function getOperationTypeByValue (value) {
+    for (let i = 0; i < operationTypes.length; i++) {
+        if (operationTypes[i].value === value)
+            return operationTypes[i];
+    }
 
-  return null;
+    return null;
 }
 
 // *********************************************************************************
 
-export function getOperatorByHash(operation, operatorHash) {
-  for (let i = 0; i < operation.operators.length; i++) {
-    if (operation.operators[i].hash === operatorHash)
-      return operation.operators[i];
-  }
+export function getOperatorByHash (operation, operatorHash) {
+    for (let i = 0; i < operation.operators.length; i++) {
+        if (operation.operators[i].hash === operatorHash)
+            return operation.operators[i];
+    }
 
-  return null;
+    return null;
 }
 
 // *********************************************************************************

+ 108 - 108
js/accessibleUI/modules/operations/operations.js

@@ -1,12 +1,12 @@
 // Imports
 import {generateUUID, htmlOlCommandsOperations} from './../../main';
 import {
-  getOperationTypeByValue, getOperatorByHash,
-  getOperatorTypeByValue,
-  htmlAssignVariableScheme,
-  htmlOperationKindScheme, htmlOperationTypeSelect, htmlOperatorValueInputScheme,
-  htmlOperatorVariablesSelectScheme,
-  operationScheme, operatorScheme, operatorTypes
+    getOperationTypeByValue, getOperatorByHash,
+    getOperatorTypeByValue,
+    htmlAssignVariableScheme,
+    htmlOperationKindScheme, htmlOperationTypeSelect, htmlOperatorValueInputScheme,
+    htmlOperatorVariablesSelectScheme,
+    operationScheme, operatorScheme, operatorTypes
 } from "./operations-schemes";
 import {getVariableByHash, variables} from "../variables/variables";
 // Imports
@@ -14,171 +14,171 @@ import {getVariableByHash, variables} from "../variables/variables";
 export const operations = [];
 
 // Creating operation
-export function createOperation() {
-  let operation = Object.assign({}, operationScheme);
+export function createOperation () {
+    let operation = Object.assign({}, operationScheme);
 
-  operation.hash = generateUUID().replaceAll('-', '');
-  // TODO: Fix
-  operation.assignedVariable = variables[0];
-  operation.operators = [];
+    operation.hash = generateUUID().replaceAll('-', '');
+    // TODO: Fix
+    operation.assignedVariable = variables[0];
+    operation.operators = [];
 
-  operations.push(operation);
+    operations.push(operation);
 
-  let htmlOperation = htmlAssignVariableScheme();
+    let htmlOperation = htmlAssignVariableScheme();
 
-  htmlOperation = htmlOperation.replaceAll('<operationId>', operation.hash);
+    htmlOperation = htmlOperation.replaceAll('<operationId>', operation.hash);
 
-  htmlOlCommandsOperations.insertAdjacentHTML('beforeend', htmlOperation);
+    htmlOlCommandsOperations.insertAdjacentHTML('beforeend', htmlOperation);
 
-  document.getElementById(`operation${operation.hash}AssignVariableSelect`).addEventListener('change', ev => {
-    updateOperationAssignValue(ev.target.getAttribute('operation-id'), ev.target.value);
-  });
+    document.getElementById(`operation${operation.hash}AssignVariableSelect`).addEventListener('change', ev => {
+        updateOperationAssignValue(ev.target.getAttribute('operation-id'), ev.target.value);
+    });
 
-  addOperatorKind(operation.hash);
+    addOperatorKind(operation.hash);
 }
 
 // Add operator kind to the operation
-export function addOperatorKind(hash) {
-  let operation = getOperationByHash(hash);
+export function addOperatorKind (hash) {
+    let operation = getOperationByHash(hash);
 
-  console.log(operation);
+    console.log(operation);
 
-  let htmlOperationKind = htmlOperationKindScheme(operation);
+    let htmlOperationKind = htmlOperationKindScheme(operation);
 
-  document.getElementById(`operation${operation.hash}OperatorsDiv`).insertAdjacentHTML('beforeend', htmlOperationKind);
+    document.getElementById(`operation${operation.hash}OperatorsDiv`).insertAdjacentHTML('beforeend', htmlOperationKind);
 
-  document.getElementById(`operation${operation.hash}KindSelect`).addEventListener('change', ev => {
-    selectedOperationKind(ev.target.getAttribute('operation-id'));
-  });
+    document.getElementById(`operation${operation.hash}KindSelect`).addEventListener('change', ev => {
+        selectedOperationKind(ev.target.getAttribute('operation-id'));
+    });
 }
 
 // Function to be trigger when the operator kind is selected
-export function selectedOperationKind(operationHash) {
-  let operation = getOperationByHash(operationHash);
+export function selectedOperationKind (operationHash) {
+    let operation = getOperationByHash(operationHash);
 
-  console.log(operation);
+    console.log(operation);
 
-  let kindSelect = document.getElementById(`operation${operation.hash}KindSelect`);
+    let kindSelect = document.getElementById(`operation${operation.hash}KindSelect`);
 
-  // TODO: think into an way to make this dynamic
-  if (kindSelect.value === 'VARIABLE') {
-    insertVariableAfterOperationKind(kindSelect, operation);
-  } else if (kindSelect.value === 'VALUE') {
-    insertValueAfterOperationKind(kindSelect, operation);
-  }
+    // TODO: think into an way to make this dynamic
+    if (kindSelect.value === 'VARIABLE') {
+        insertVariableAfterOperationKind(kindSelect, operation);
+    } else if (kindSelect.value === 'VALUE') {
+        insertValueAfterOperationKind(kindSelect, operation);
+    }
 }
 
 // Insert variable after operator kind select
-export function insertVariableAfterOperationKind(kindSelect, operation) {
-  let operator = Object.assign({}, operatorScheme);
+export function insertVariableAfterOperationKind (kindSelect, operation) {
+    let operator = Object.assign({}, operatorScheme);
 
-  operator.hash = generateUUID().replaceAll('-', '');
-  // TODO: Fix ?
-  operator.variable = variables[0];
-  operator.type = getOperatorTypeByValue('VARIABLE');
+    operator.hash = generateUUID().replaceAll('-', '');
+    // TODO: Fix ?
+    operator.variable = variables[0];
+    operator.type = getOperatorTypeByValue('VARIABLE');
 
-  let operatorVariableSelect = htmlOperatorVariablesSelectScheme(operation, operator);
+    let operatorVariableSelect = htmlOperatorVariablesSelectScheme(operation, operator);
 
-  operation.operators.push(operator);
+    operation.operators.push(operator);
 
-  kindSelect.insertAdjacentHTML('afterend', operatorVariableSelect);
-  kindSelect.remove();
+    kindSelect.insertAdjacentHTML('afterend', operatorVariableSelect);
+    kindSelect.remove();
 
-  insertOperationTypeAtEndOfOperation(operation, operator);
+    insertOperationTypeAtEndOfOperation(operation, operator);
 
-  document.getElementById(`operation${operation.hash}Operator${operator.hash}VariableSelect`).addEventListener('change', ev => {
-    updateOperationOperator(ev.target.getAttribute('operation-id'), ev.target.getAttribute('operator-id'), ev.target.value)
-  });
+    document.getElementById(`operation${operation.hash}Operator${operator.hash}VariableSelect`).addEventListener('change', ev => {
+        updateOperationOperator(ev.target.getAttribute('operation-id'), ev.target.getAttribute('operator-id'), ev.target.value)
+    });
 }
 
 // Insert value after operator kind select
-export function insertValueAfterOperationKind(kindSelect, operation) {
-  let operator = Object.assign({}, operatorScheme);
+export function insertValueAfterOperationKind (kindSelect, operation) {
+    let operator = Object.assign({}, operatorScheme);
 
-  operator.hash = generateUUID().replaceAll('-', '');
-  operator.type = getOperatorTypeByValue('VALUE');
+    operator.hash = generateUUID().replaceAll('-', '');
+    operator.type = getOperatorTypeByValue('VALUE');
 
-  let operatorValueInput = htmlOperatorValueInputScheme(operation, operator);
+    let operatorValueInput = htmlOperatorValueInputScheme(operation, operator);
 
-  operation.operators.push(operator);
+    operation.operators.push(operator);
 
-  kindSelect.insertAdjacentHTML('afterend', operatorValueInput);
-  kindSelect.remove();
+    kindSelect.insertAdjacentHTML('afterend', operatorValueInput);
+    kindSelect.remove();
 
-  insertOperationTypeAtEndOfOperation(operation, operator);
+    insertOperationTypeAtEndOfOperation(operation, operator);
 
-  document.getElementById(`operation${operation.hash}Operator${operator.hash}ValueInput`).addEventListener('change', ev => {
-    updateOperationOperator(ev.target.getAttribute('operation-id'), ev.target.getAttribute('operator-id'), ev.target.value)
-  });
+    document.getElementById(`operation${operation.hash}Operator${operator.hash}ValueInput`).addEventListener('change', ev => {
+        updateOperationOperator(ev.target.getAttribute('operation-id'), ev.target.getAttribute('operator-id'), ev.target.value)
+    });
 }
 
 // Add final operation typt end of the operation
-export function insertOperationTypeAtEndOfOperation(operation, afterOperator) {
-  let operator = Object.assign({}, operatorScheme);
+export function insertOperationTypeAtEndOfOperation (operation, afterOperator) {
+    let operator = Object.assign({}, operatorScheme);
 
-  operator.hash = generateUUID().replaceAll('-', '');
-  operator.type = getOperatorTypeByValue('OPERATOR');
-  operator.operator = getOperationTypeByValue('SEMICOLON');
+    operator.hash = generateUUID().replaceAll('-', '');
+    operator.type = getOperatorTypeByValue('OPERATOR');
+    operator.operator = getOperationTypeByValue('SEMICOLON');
 
-  let operationTypeInput = htmlOperationTypeSelect(operation, operator);
+    let operationTypeInput = htmlOperationTypeSelect(operation, operator);
 
-  operationTypeInput.replaceAll('<operatorId>', operator.hash);
-  operation.operators.push(operator);
+    operationTypeInput.replaceAll('<operatorId>', operator.hash);
+    operation.operators.push(operator);
 
-  if (afterOperator.type.value === 'VARIABLE') {
-    document.querySelector(`select[operator-id='${afterOperator.hash}']`).insertAdjacentHTML('afterend', operationTypeInput);
-  } else if (afterOperator.type.value === 'VALUE') {
-    document.querySelector(`input[operator-id='${afterOperator.hash}']`).insertAdjacentHTML('afterend', operationTypeInput);
-  }
+    if (afterOperator.type.value === 'VARIABLE') {
+        document.querySelector(`select[operator-id='${afterOperator.hash}']`).insertAdjacentHTML('afterend', operationTypeInput);
+    } else if (afterOperator.type.value === 'VALUE') {
+        document.querySelector(`input[operator-id='${afterOperator.hash}']`).insertAdjacentHTML('afterend', operationTypeInput);
+    }
 
 
-  document.getElementById(`operation${operation.hash}Operator${operator.hash}OperationTypeSelect`).addEventListener('change', ev => {
-    updateOperationOperator(ev.target.getAttribute('operation-id'), ev.target.getAttribute('operator-id'), ev.target.value)
-  });
+    document.getElementById(`operation${operation.hash}Operator${operator.hash}OperationTypeSelect`).addEventListener('change', ev => {
+        updateOperationOperator(ev.target.getAttribute('operation-id'), ev.target.getAttribute('operator-id'), ev.target.value)
+    });
 }
 
 // ***********************************************************************
 // Listeners
 // ***********************************************************************
 
-export function updateOperationAssignValue(operationHash, newVariable) {
-  let operation = getOperationByHash(operationHash);
-  let variable = getVariableByHash(newVariable);
+export function updateOperationAssignValue (operationHash, newVariable) {
+    let operation = getOperationByHash(operationHash);
+    let variable = getVariableByHash(newVariable);
 
-  operation.assignedVariable = variable;
+    operation.assignedVariable = variable;
 }
 
-export function updateOperationOperator(operationHash, operatorHash, newValue) {
-  let operation = getOperationByHash(operationHash);
-  let operator = getOperatorByHash(operation, operatorHash);
-
-  switch (operator.type.value) {
-    case 'VARIABLE':
-      let variable = getVariableByHash(newValue);
-      operator.variable = variable;
-      break;
-    case 'VALUE':
-      operator.value = newValue;
-      break;
-    case 'OPERATOR':
-      operator.operator = getOperationTypeByValue(newValue);
-      if (operator.operator.name !== ';')
-        addOperatorKind(operation.hash);
-      break;
-  }
+export function updateOperationOperator (operationHash, operatorHash, newValue) {
+    let operation = getOperationByHash(operationHash);
+    let operator = getOperatorByHash(operation, operatorHash);
+
+    switch (operator.type.value) {
+        case 'VARIABLE':
+            let variable = getVariableByHash(newValue);
+            operator.variable = variable;
+            break;
+        case 'VALUE':
+            operator.value = newValue;
+            break;
+        case 'OPERATOR':
+            operator.operator = getOperationTypeByValue(newValue);
+            if (operator.operator.name !== ';')
+                addOperatorKind(operation.hash);
+            break;
+    }
 }
 
 // ***********************************************************************
 // Util
 // ***********************************************************************
 
-export function getOperationByHash(hash) {
-  for (let i = 0; i < operations.length; i++) {
-    if (operations[i].hash === hash)
-      return operations[i];
-  }
+export function getOperationByHash (hash) {
+    for (let i = 0; i < operations.length; i++) {
+        if (operations[i].hash === hash)
+            return operations[i];
+    }
 
-  return null;
+    return null;
 }
 
 // ***********************************************************************

+ 56 - 56
js/accessibleUI/modules/variables/variables-schemes.js

@@ -3,10 +3,10 @@
 // *********************************************************************************
 
 export const variableScheme = {
-  hash: 'UUID for the variable',
-  name: 'Variable name',
-  type: 'Varaible type',
-  value: 'Variable value'
+    hash: 'UUID for the variable',
+    name: 'Variable name',
+    type: 'Varaible type',
+    value: 'Variable value'
 };
 
 // *********************************************************************************
@@ -14,53 +14,53 @@ export const variableScheme = {
 // *********************************************************************************
 
 export const variableTypes = [
-  {
-    name: 'inteiro',
-    value: 'INTEGER',
-    defaultValue: 0,
-    htmlType: 'number',
-    barrier: ''
-  },
-  {
-    name: 'real',
-    value: 'DOUBLE',
-    defaultValue: 0.0,
-    htmlType: 'number',
-    barrier: ''
-  },
-  {
-    name: 'cadeia',
-    value: 'STRING',
-    defaultValue: '',
-    htmlType: 'text',
-    barrier: '"'
-  },
-  {
-    name: 'lógico',
-    value: 'BOOLEAN',
-    vales: [
-      {
-        name: 'verdadeiro',
-        value: true
-      },
-      {
-        name: 'falso',
-        value: false
-      }
-    ],
-    defaultValue: true,
-    htmlType: 'select',
-    barrier: ''
-  }
+    {
+        name: 'inteiro',
+        value: 'INTEGER',
+        defaultValue: 0,
+        htmlType: 'number',
+        barrier: ''
+    },
+    {
+        name: 'real',
+        value: 'DOUBLE',
+        defaultValue: 0.0,
+        htmlType: 'number',
+        barrier: ''
+    },
+    {
+        name: 'cadeia',
+        value: 'STRING',
+        defaultValue: '',
+        htmlType: 'text',
+        barrier: '"'
+    },
+    {
+        name: 'lógico',
+        value: 'BOOLEAN',
+        vales: [
+            {
+                name: 'verdadeiro',
+                value: true
+            },
+            {
+                name: 'falso',
+                value: false
+            }
+        ],
+        defaultValue: true,
+        htmlType: 'select',
+        barrier: ''
+    }
 ];
 
-export function getVariableTypeByValue(value) {
-  for (let i = 0; i < variableTypes.length; i++) {
-    if (variableTypes[i].value === value)
-      return variableTypes[i];
-  }
+export function getVariableTypeByValue (value) {
+    for (let i = 0; i < variableTypes.length; i++) {
+        if (variableTypes[i].value === value)
+            return variableTypes[i];
+    }
 
-  return null;
+    return null;
 }
 
 // *********************************************************************************
@@ -69,18 +69,18 @@ export function getVariableTypeByValue(value) {
 
 let htmlVariableSchemeBuilt = '';
 
-export function htmlVariableScheme() {
+export function htmlVariableScheme () {
 
-  if (htmlVariableSchemeBuilt !== '')
-    return htmlVariableSchemeBuilt;
+    if (htmlVariableSchemeBuilt !== '')
+        return htmlVariableSchemeBuilt;
 
-  let variableTypesHtml = '';
+    let variableTypesHtml = '';
 
-  for (let i = 0; i < variableTypes.length; i++) {
-    variableTypesHtml += `<option value="${variableTypes[i].value}">${variableTypes[i].name}</option>\n`;
-  }
+    for (let i = 0; i < variableTypes.length; i++) {
+        variableTypesHtml += `<option value="${variableTypes[i].value}">${variableTypes[i].name}</option>\n`;
+    }
 
-  return `<li id="variable<variableId>Li">
+    return `<li id="variable<variableId>Li">
             <form id="variable<variableId>Form">
               <div class="row">
                 <div class="col-2">

+ 50 - 50
js/accessibleUI/modules/variables/variables.js

@@ -7,42 +7,42 @@ export const variables = [];
 let variablesIndex = 0;
 
 // Creating variable
-export function createVariable() {
-  const variable = Object.assign({}, variableScheme);
+export function createVariable () {
+    const variable = Object.assign({}, variableScheme);
 
-  variable.hash = generateUUID().replaceAll('-', '');
-  variable.name = 'var' + variablesIndex;
-  variable.type = variableTypes[0];
-  variable.value = variable.type.defaultValue;
+    variable.hash = generateUUID().replaceAll('-', '');
+    variable.name = 'var' + variablesIndex;
+    variable.type = variableTypes[0];
+    variable.value = variable.type.defaultValue;
 
-  variables.push(variable);
+    variables.push(variable);
 
-  variablesIndex++;
+    variablesIndex++;
 
-  let htmlVariable = htmlVariableScheme();
+    let htmlVariable = htmlVariableScheme();
 
-  htmlVariable = htmlVariable.replaceAll('<variableId>', variable.hash);
-  htmlVariable = htmlVariable.replaceAll('<variableName>', variable.name);
+    htmlVariable = htmlVariable.replaceAll('<variableId>', variable.hash);
+    htmlVariable = htmlVariable.replaceAll('<variableName>', variable.name);
 
-  htmlOlCommandsVariables.insertAdjacentHTML('beforeend', htmlVariable);
+    htmlOlCommandsVariables.insertAdjacentHTML('beforeend', htmlVariable);
 
-  document.getElementById(`variable${variable.hash}Type`).addEventListener('change', ev => {
-    let variableHash = ev.target.getAttribute('variable-id');
+    document.getElementById(`variable${variable.hash}Type`).addEventListener('change', ev => {
+        let variableHash = ev.target.getAttribute('variable-id');
 
-    updateVariable(variableHash);
-  });
+        updateVariable(variableHash);
+    });
 
-  document.getElementById(`variable${variable.hash}Name`).addEventListener('change', ev => {
-    let variableHash = ev.target.getAttribute('variable-id');
+    document.getElementById(`variable${variable.hash}Name`).addEventListener('change', ev => {
+        let variableHash = ev.target.getAttribute('variable-id');
 
-    updateVariable(variableHash);
-  });
+        updateVariable(variableHash);
+    });
 
-  document.getElementById(`variable${variable.hash}Value`).addEventListener('change', ev => {
-    let variableHash = ev.target.getAttribute('variable-id');
+    document.getElementById(`variable${variable.hash}Value`).addEventListener('change', ev => {
+        let variableHash = ev.target.getAttribute('variable-id');
 
-    updateVariable(variableHash);
-  });
+        updateVariable(variableHash);
+    });
 }
 
 // *********************************************************************************
@@ -53,50 +53,50 @@ let variableName;
 let variableType;
 let variableValue;
 
-function updateVariable(hash) {
-  let variable = getVariableByHash(hash);
+function updateVariable (hash) {
+    let variable = getVariableByHash(hash);
 
-  variableName = document.getElementById(`variable${hash}Name`).value;
-  if (variable.name !== variableName) {
-    variable.name = variableName;
-  }
+    variableName = document.getElementById(`variable${hash}Name`).value;
+    if (variable.name !== variableName) {
+        variable.name = variableName;
+    }
 
-  variableType = getVariableTypeByValue(document.getElementById(`variable${hash}Type`).value);
-  if (variable.type !== variableType) {
-    variable.type = variableType;
+    variableType = getVariableTypeByValue(document.getElementById(`variable${hash}Type`).value);
+    if (variable.type !== variableType) {
+        variable.type = variableType;
 
-    document.getElementById(`variable${hash}Value`).type = variable.type.htmlType;
-    document.getElementById(`variable${hash}Value`).value = variable.type.defaultValue;
-  }
+        document.getElementById(`variable${hash}Value`).type = variable.type.htmlType;
+        document.getElementById(`variable${hash}Value`).value = variable.type.defaultValue;
+    }
 
-  variableValue = document.getElementById(`variable${hash}Value`).value;
-  if (variable.value !== variableValue) {
-    variable.value = variableValue;
-  }
+    variableValue = document.getElementById(`variable${hash}Value`).value;
+    if (variable.value !== variableValue) {
+        variable.value = variableValue;
+    }
 }
 
 // *********************************************************************************
 
 // Deleting variable
-export function deleteVariable(hash) {
-  let variable = getVariableByHash(hash);
+export function deleteVariable (hash) {
+    let variable = getVariableByHash(hash);
 
-  document.getElementById(`variable${hash}Li`).remove();
+    document.getElementById(`variable${hash}Li`).remove();
 
-  variables.splice(variables.indexOf(variable), 1);
+    variables.splice(variables.indexOf(variable), 1);
 }
 
 // *********************************************************************************
 // Util
 // *********************************************************************************
 
-export function getVariableByHash(hash) {
-  for (let i = 0; i < variables.length; i++) {
-    if (variables[i].hash === hash)
-      return variables[i];
-  }
+export function getVariableByHash (hash) {
+    for (let i = 0; i < variables.length; i++) {
+        if (variables[i].hash === hash)
+            return variables[i];
+    }
 
-  return null;
+    return null;
 }
 
 // *********************************************************************************

+ 15 - 15
js/accessibleUI/script_marcos.js

@@ -86,27 +86,27 @@ escreva = "<li id='li_escreva'> <form id='form_escreva'>" +
     "</form></li>";
 "</form></li>";
 
-$(document).ready(function() {
+$(document).ready(function () {
 
-    $("#bt_cria_var").click(function() {
+    $("#bt_cria_var").click(function () {
 
         $("#comandos").append(variavel)
         $("#var_tipo").focus();
 
-        $("#bt_excluir_var").click(function() {
+        $("#bt_excluir_var").click(function () {
             $("#li_var").remove();
         });
     });
 });
 
-$(document).ready(function() {
+$(document).ready(function () {
 
-    $("#atribuir").click(function() {
+    $("#atribuir").click(function () {
 
         $("#comandos").append(atribuir)
         $("#var_atr").focus();
 
-        $('#tipo_atr').change(function() {
+        $('#tipo_atr').change(function () {
             if ($(this).val() === 'valor') {
                 $('#menu_variaveis').remove();
                 $('#menu_operadores').remove();
@@ -124,11 +124,11 @@ $(document).ready(function() {
 
             }
 
-            $('#menu_operadores').change(function() {
+            $('#menu_operadores').change(function () {
                 $("#menu_operadores").after(tipo_atr2);
                 $("#tipo_atr2").focus();
 
-                $('#tipo_atr2').change(function() {
+                $('#tipo_atr2').change(function () {
 
                     if ($(this).val() === 'valor') {
                         $('#menu_variaveis2').remove();
@@ -152,7 +152,7 @@ $(document).ready(function() {
             });
         });
 
-        $("#bt_excluir_comand").click(function() {
+        $("#bt_excluir_comand").click(function () {
             $("#li_comando").remove();
 
         });
@@ -160,14 +160,14 @@ $(document).ready(function() {
 });
 
 
-$(document).ready(function() {
+$(document).ready(function () {
 
-    $("#escreva").click(function() {
+    $("#escreva").click(function () {
 
         $("#comandos").append(escreva);
         $("#menu_escreva").focus();
 
-        $('#menu_escreva').change(function() {
+        $('#menu_escreva').change(function () {
 
             if ($(this).val() === 'valor') {
                 $('#valor_num').remove();
@@ -193,15 +193,15 @@ $(document).ready(function() {
 
         });
 
-        $("#bt_excluir_escreva").click(function() {
+        $("#bt_excluir_escreva").click(function () {
             $("#li_escreva").remove();
         });
     });
 });
 
-$(document).ready(function() {
+$(document).ready(function () {
 
-    $("#bt_executar").click(function() {
+    $("#bt_executar").click(function () {
         $("#terminal").append("<p id='resultado' tabindex='0'> resultado aqui</p>");
         $("#resultado").focus();
 

File diff suppressed because it is too large
+ 10331 - 10367
js/accessibleUI/util/jquery-3.5.0.js


+ 176 - 177
js/accessibleUI/util/jquery.hotkeys.js

@@ -18,187 +18,186 @@
  * Might be useful, when you want to pass some other data to your handler
  */
 
-(function(jQuery) {
-
-  jQuery.hotkeys = {
-    version: "0.2.0",
-
-    specialKeys: {
-      8: "backspace",
-      9: "tab",
-      10: "return",
-      13: "return",
-      16: "shift",
-      17: "ctrl",
-      18: "alt",
-      19: "pause",
-      20: "capslock",
-      27: "esc",
-      32: "space",
-      33: "pageup",
-      34: "pagedown",
-      35: "end",
-      36: "home",
-      37: "left",
-      38: "up",
-      39: "right",
-      40: "down",
-      45: "insert",
-      46: "del",
-      59: ";",
-      61: "=",
-      96: "0",
-      97: "1",
-      98: "2",
-      99: "3",
-      100: "4",
-      101: "5",
-      102: "6",
-      103: "7",
-      104: "8",
-      105: "9",
-      106: "*",
-      107: "+",
-      109: "-",
-      110: ".",
-      111: "/",
-      112: "f1",
-      113: "f2",
-      114: "f3",
-      115: "f4",
-      116: "f5",
-      117: "f6",
-      118: "f7",
-      119: "f8",
-      120: "f9",
-      121: "f10",
-      122: "f11",
-      123: "f12",
-      144: "numlock",
-      145: "scroll",
-      173: "-",
-      186: ";",
-      187: "=",
-      188: ",",
-      189: "-",
-      190: ".",
-      191: "/",
-      192: "`",
-      219: "[",
-      220: "\\",
-      221: "]",
-      222: "'"
-    },
-
-    shiftNums: {
-      "`": "~",
-      "1": "!",
-      "2": "@",
-      "3": "#",
-      "4": "$",
-      "5": "%",
-      "6": "^",
-      "7": "&",
-      "8": "*",
-      "9": "(",
-      "0": ")",
-      "-": "_",
-      "=": "+",
-      ";": ": ",
-      "'": "\"",
-      ",": "<",
-      ".": ">",
-      "/": "?",
-      "\\": "|"
-    },
-
-    // excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url
-    textAcceptingInputTypes: [
-      "text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime",
-      "datetime-local", "search", "color", "tel"],
-
-    // default input types not to bind to unless bound directly
-    textInputTypes: /textarea|input|select/i,
-
-    options: {
-      filterInputAcceptingElements: true,
-      filterTextInputs: true,
-      filterContentEditable: true
-    }
-  };
-
-  function keyHandler(handleObj) {
-    if (typeof handleObj.data === "string") {
-      handleObj.data = {
-        keys: handleObj.data
-      };
-    }
-
-    // Only care when a possible input has been specified
-    if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") {
-      return;
-    }
-
-    var origHandler = handleObj.handler,
-      keys = handleObj.data.keys.toLowerCase().split(" ");
-
-    handleObj.handler = function(event) {
-      //      Don't fire in text-accepting inputs that we didn't directly bind to
-      if (this !== event.target &&
-        (jQuery.hotkeys.options.filterInputAcceptingElements &&
-          jQuery.hotkeys.textInputTypes.test(event.target.nodeName) ||
-          (jQuery.hotkeys.options.filterContentEditable && jQuery(event.target).attr('contenteditable')) ||
-          (jQuery.hotkeys.options.filterTextInputs &&
-            jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {
-        return;
-      }
-
-      var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
-        character = String.fromCharCode(event.which).toLowerCase(),
-        modif = "",
-        possible = {};
-
-      jQuery.each(["alt", "ctrl", "shift"], function(index, specialKey) {
-
-        if (event[specialKey + 'Key'] && special !== specialKey) {
-          modif += specialKey + '+';
+(function (jQuery) {
+
+    jQuery.hotkeys = {
+        version: "0.2.0",
+
+        specialKeys: {
+            8: "backspace",
+            9: "tab",
+            10: "return",
+            13: "return",
+            16: "shift",
+            17: "ctrl",
+            18: "alt",
+            19: "pause",
+            20: "capslock",
+            27: "esc",
+            32: "space",
+            33: "pageup",
+            34: "pagedown",
+            35: "end",
+            36: "home",
+            37: "left",
+            38: "up",
+            39: "right",
+            40: "down",
+            45: "insert",
+            46: "del",
+            59: ";",
+            61: "=",
+            96: "0",
+            97: "1",
+            98: "2",
+            99: "3",
+            100: "4",
+            101: "5",
+            102: "6",
+            103: "7",
+            104: "8",
+            105: "9",
+            106: "*",
+            107: "+",
+            109: "-",
+            110: ".",
+            111: "/",
+            112: "f1",
+            113: "f2",
+            114: "f3",
+            115: "f4",
+            116: "f5",
+            117: "f6",
+            118: "f7",
+            119: "f8",
+            120: "f9",
+            121: "f10",
+            122: "f11",
+            123: "f12",
+            144: "numlock",
+            145: "scroll",
+            173: "-",
+            186: ";",
+            187: "=",
+            188: ",",
+            189: "-",
+            190: ".",
+            191: "/",
+            192: "`",
+            219: "[",
+            220: "\\",
+            221: "]",
+            222: "'"
+        },
+
+        shiftNums: {
+            "`": "~",
+            "1": "!",
+            "2": "@",
+            "3": "#",
+            "4": "$",
+            "5": "%",
+            "6": "^",
+            "7": "&",
+            "8": "*",
+            "9": "(",
+            "0": ")",
+            "-": "_",
+            "=": "+",
+            ";": ": ",
+            "'": "\"",
+            ",": "<",
+            ".": ">",
+            "/": "?",
+            "\\": "|"
+        },
+
+        // excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url
+        textAcceptingInputTypes: [
+            "text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime",
+            "datetime-local", "search", "color", "tel"],
+
+        // default input types not to bind to unless bound directly
+        textInputTypes: /textarea|input|select/i,
+
+        options: {
+            filterInputAcceptingElements: true,
+            filterTextInputs: true,
+            filterContentEditable: true
         }
-      });
-
-      // metaKey is triggered off ctrlKey erronously
-      if (event.metaKey && !event.ctrlKey && special !== "meta") {
-        modif += "meta+";
-      }
-
-      if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) {
-        modif = modif.replace("alt+ctrl+shift+", "hyper+");
-      }
-
-      if (special) {
-        possible[modif + special] = true;
-      }
-      else {
-        possible[modif + character] = true;
-        possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
-
-        // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
-        if (modif === "shift+") {
-          possible[jQuery.hotkeys.shiftNums[character]] = true;
+    };
+
+    function keyHandler (handleObj) {
+        if (typeof handleObj.data === "string") {
+            handleObj.data = {
+                keys: handleObj.data
+            };
         }
-      }
 
-      for (var i = 0, l = keys.length; i < l; i++) {
-        if (possible[keys[i]]) {
-          return origHandler.apply(this, arguments);
+        // Only care when a possible input has been specified
+        if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") {
+            return;
         }
-      }
-    };
-  }
 
-  jQuery.each(["keydown", "keyup", "keypress"], function() {
-    jQuery.event.special[this] = {
-      add: keyHandler
-    };
-  });
+        var origHandler = handleObj.handler,
+            keys = handleObj.data.keys.toLowerCase().split(" ");
+
+        handleObj.handler = function (event) {
+            //      Don't fire in text-accepting inputs that we didn't directly bind to
+            if (this !== event.target &&
+                (jQuery.hotkeys.options.filterInputAcceptingElements &&
+                    jQuery.hotkeys.textInputTypes.test(event.target.nodeName) ||
+                    (jQuery.hotkeys.options.filterContentEditable && jQuery(event.target).attr('contenteditable')) ||
+                    (jQuery.hotkeys.options.filterTextInputs &&
+                        jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {
+                return;
+            }
+
+            var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
+                character = String.fromCharCode(event.which).toLowerCase(),
+                modif = "",
+                possible = {};
+
+            jQuery.each(["alt", "ctrl", "shift"], function (index, specialKey) {
+
+                if (event[specialKey + 'Key'] && special !== specialKey) {
+                    modif += specialKey + '+';
+                }
+            });
+
+            // metaKey is triggered off ctrlKey erronously
+            if (event.metaKey && !event.ctrlKey && special !== "meta") {
+                modif += "meta+";
+            }
+
+            if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) {
+                modif = modif.replace("alt+ctrl+shift+", "hyper+");
+            }
+
+            if (special) {
+                possible[modif + special] = true;
+            } else {
+                possible[modif + character] = true;
+                possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
+
+                // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
+                if (modif === "shift+") {
+                    possible[jQuery.hotkeys.shiftNums[character]] = true;
+                }
+            }
+
+            for (var i = 0, l = keys.length; i < l; i++) {
+                if (possible[keys[i]]) {
+                    return origHandler.apply(this, arguments);
+                }
+            }
+        };
+    }
+
+    jQuery.each(["keydown", "keyup", "keypress"], function () {
+        jQuery.event.special[this] = {
+            add: keyHandler
+        };
+    });
 
 })(jQuery || this.jQuery || window.jQuery);

+ 1 - 1
js/accessibleUI/util/object-common.js

@@ -1,4 +1,4 @@
-Object.size = function(obj) {
+Object.size = function (obj) {
     let size = 0, key;
     for (key in obj) {
         if (obj.hasOwnProperty(key)) size++;

+ 3 - 2
js/accessibleUI/util/sub-menu.js

@@ -4,13 +4,14 @@ const subMenuOptionsTitleH3 = document.getElementById("subMenuOptionsTitleH3");
 const subMenuOptionsBody = document.getElementById("subMenuOptionsBody");
 const subMenuOptionsFooter = document.getElementById("subMenuOptionsFooter");
 
-function hideSubMenu() {
+function hideSubMenu () {
     subMenuOptions.style.display = 'none';
 }
 
-function showSubMenu() {
+function showSubMenu () {
     subMenuOptions.style.display = 'inline';
 }
+
 // ==> Code for an class observer that is triggered every time a element style is changed <==
 // var observer = new MutationObserver(function (mutations) {
 //     mutations.forEach(function (mutationRecord) {

+ 163 - 163
templates/index.html

@@ -18,214 +18,214 @@
     <script src="js/iassign-integration-functions.js"></script>
 
     <!-- Accessible UI CSS -->
-    <link rel="stylesheet" href="css/accessible/style.css" />
-    <link rel="stylesheet" href="css/accessible/bootstrap/bootstrap.css" />
-    <link rel="stylesheet" href="css/accessible/bootstrap/bootstrap-grid.css" />
-    <link rel="stylesheet" href="css/accessible/bootstrap/bootstrap-reboot.css" />
-    <link rel="stylesheet" href="css/accessible/design.css" />
-    <link rel="stylesheet" href="css/accessible/forms_var_comand.css" />
+    <link rel="stylesheet" href="css/accessible/style.css"/>
+    <link rel="stylesheet" href="css/accessible/bootstrap/bootstrap.css"/>
+    <link rel="stylesheet" href="css/accessible/bootstrap/bootstrap-grid.css"/>
+    <link rel="stylesheet" href="css/accessible/bootstrap/bootstrap-reboot.css"/>
+    <link rel="stylesheet" href="css/accessible/design.css"/>
+    <link rel="stylesheet" href="css/accessible/forms_var_comand.css"/>
 </head>
 
 <body>
-    <!-- Change UI -->
-    <div class="row">
-        <div class="col-12 text-center">
-            <div class="btn-group">
-                <button type="button" id="enableVisualUI">Interface interativa</button>
-                <button type="button" id="enableAccessibleUI">Interface acessível</button>
-            </div>
+<!-- Change UI -->
+<div class="row">
+    <div class="col-12 text-center">
+        <div class="btn-group">
+            <button type="button" id="enableVisualUI">Interface interativa</button>
+            <button type="button" id="enableAccessibleUI">Interface acessível</button>
         </div>
     </div>
-    <!-- Change UI -->
+</div>
+<!-- Change UI -->
 
-    <!-- Visual UI -->
-    <div id="visualInterface">
-        <div class="ui height_100 add_accordion" id="ui_main_div">
+<!-- Visual UI -->
+<div id="visualInterface">
+    <div class="ui height_100 add_accordion" id="ui_main_div">
 
-            <div class="title default_visual_title">
-                <i class="dropdown icon"></i>
-            </div>
-
-            <div class="content height_100">
+        <div class="title default_visual_title">
+            <i class="dropdown icon"></i>
+        </div>
 
-                <div class="ui raised container segment div_to_body">
+        <div class="content height_100">
 
-                    <div class="ui container main_title only_in_frame">
-                        <h2>iVProg</h2>
-                    </div>
+            <div class="ui raised container segment div_to_body">
 
-                    <div class="ui icon menu center aligned container" style="width: 438px; margin-top: -20px;">
-                        <a class="item active visual_coding_button">
-                            <i class="window maximize outline icon"></i>
-                        </a>
-                        <a class="item textual_coding_button">
-                            <i class="code icon"></i>
-                        </a>
-                        <a class="item upload_file_button disabled">
-                            <i class="upload icon"></i>
-                        </a>
-                        <a class="item download_file_button disabled">
-                            <i class="download icon"></i>
-                        </a>
-                        <a class="item undo_button disabled">
-                            <i class="undo icon"></i>
-                        </a>
-                        <a class="item redo_button disabled">
-                            <i class="redo icon"></i>
-                        </a>
-                        <a id="run_button" class="item run_button">
-                            <i class="play icon"></i>
-                        </a>
-                        <a id="stop_button" class="item stop_button" style="display: none">
-                            <i class="stop icon"></i>
-                        </a>
-                        <a class="item assessment assessment_button">
-                            <i class="check icon"></i>
-                        </a>
-                        <!--<a class="item expand_button">
-                      <i class="expand arrows alternate icon"></i>
-                    </a>-->
-                        <a class="item help_button">
-                            <i class="help icon"></i>
-                        </a>
-                    </div>
+                <div class="ui container main_title only_in_frame">
+                    <h2>iVProg</h2>
+                </div>
 
-                    <div class="ui one column container segment ivprog_visual_panel loading">
+                <div class="ui icon menu center aligned container" style="width: 438px; margin-top: -20px;">
+                    <a class="item active visual_coding_button">
+                        <i class="window maximize outline icon"></i>
+                    </a>
+                    <a class="item textual_coding_button">
+                        <i class="code icon"></i>
+                    </a>
+                    <a class="item upload_file_button disabled">
+                        <i class="upload icon"></i>
+                    </a>
+                    <a class="item download_file_button disabled">
+                        <i class="download icon"></i>
+                    </a>
+                    <a class="item undo_button disabled">
+                        <i class="undo icon"></i>
+                    </a>
+                    <a class="item redo_button disabled">
+                        <i class="redo icon"></i>
+                    </a>
+                    <a id="run_button" class="item run_button">
+                        <i class="play icon"></i>
+                    </a>
+                    <a id="stop_button" class="item stop_button" style="display: none">
+                        <i class="stop icon"></i>
+                    </a>
+                    <a class="item assessment assessment_button">
+                        <i class="check icon"></i>
+                    </a>
+                    <!--<a class="item expand_button">
+                  <i class="expand arrows alternate icon"></i>
+                </a>-->
+                    <a class="item help_button">
+                        <i class="help icon"></i>
+                    </a>
+                </div>
 
-                        <div class="global_var">
+                <div class="ui one column container segment ivprog_visual_panel loading">
 
+                    <div class="global_var">
 
-                            <div class="ui icon button add-globalVar-button add_global_button purple">
 
-                                <i class="icons">
-                                    <i class="icon superscript"
-                                        style="margin-top: -2px;margin-bottom: 2px;margin-left: 1px;margin-right: 1px; font-size: 18px;"></i>
-                                    <i class="corner add icon inverted"
-                                        style="font-size: 10px;padding-top: 5px;padding-left: 7px;"></i>
-                                </i>
+                        <div class="ui icon button add-globalVar-button add_global_button purple">
 
-                            </div>
-
-                            <div class="list_globals" id="listGlobalsHandle"></div>
+                            <i class="icons">
+                                <i class="icon superscript"
+                                   style="margin-top: -2px;margin-bottom: 2px;margin-left: 1px;margin-right: 1px; font-size: 18px;"></i>
+                                <i class="corner add icon inverted"
+                                   style="font-size: 10px;padding-top: 5px;padding-left: 7px;"></i>
+                            </i>
 
                         </div>
 
-                        <div class="all_functions list-group" id="listWithHandle">
-
-                        </div>
+                        <div class="list_globals" id="listGlobalsHandle"></div>
 
+                    </div>
 
-                        <div class="ui teal small labeled icon button add_function_button">
-                            <data class="i18n" value="ui:btn_function">Function</data>
-                            <i class="add icon"></i>
-                        </div>
-                        <div class="program_final"></div>
+                    <div class="all_functions list-group" id="listWithHandle">
 
                     </div>
 
 
-                    <div class="ui one column container segment ivprog_textual_panel loading" style="display: none;">
-                        <textarea id="ivprog-text-editor" class=".ivprog_textual_code"></textarea>
+                    <div class="ui teal small labeled icon button add_function_button">
+                        <data class="i18n" value="ui:btn_function">Function</data>
+                        <i class="add icon"></i>
                     </div>
-                    <div id='ivprog-term-div' class="six column wide">
+                    <div class="program_final"></div>
+
+                </div>
+
+
+                <div class="ui one column container segment ivprog_textual_panel loading" style="display: none;">
+                    <textarea id="ivprog-text-editor" class=".ivprog_textual_code"></textarea>
+                </div>
+                <div id='ivprog-term-div' class="six column wide">
 
-                    </div>
                 </div>
             </div>
-            <div class="dimmer_content_message">
-                <h3>Aconteceu um erro ao processar a atividade. <br> Recarregue a página para tentar novamente.</h3>
-                <button class="positive ui button" onclick="window.parent.location.reload()">Recarregar</button>
-            </div>
-            <script src="js/iassign-integration-functions.js"></script>
         </div>
+        <div class="dimmer_content_message">
+            <h3>Aconteceu um erro ao processar a atividade. <br> Recarregue a página para tentar novamente.</h3>
+            <button class="positive ui button" onclick="window.parent.location.reload()">Recarregar</button>
+        </div>
+        <script src="js/iassign-integration-functions.js"></script>
     </div>
-    <!-- Visual UI -->
-
-    <!-- Accessible UI -->
-    <div class="container" id="accessibleInterface" style="display: none;">
-        <!-- Header -->
-        <nav class="navbar navbar-expand-lg navbar-dark">
-            <a class="navbar-brand" tabindex="0">iVProg Acessível</a>
-            <div class="collapse navbar-collapse" id="navbarNav">
-                <ul class="navbar-nav">
-                    <li class="nav-item">
-                        <a class="nav-link" href="#inicio" title="Alt + i" accesskey="i">Ir função inicio</a>
-                    </li>
-                    <li class="nav-item">
-                        <a class="nav-link" href="#terminal" title="Alt + t" accesskey="t">Ir para o terminal</a>
-                    </li>
-                </ul>
-            </div>
-        </nav>
-        <!-- Header -->
-
-        <!-- Main container -->
-        <div id="main" class="row" role="main">
-            <div class="col-12">
-                <fieldset>
-                    <legend class="p-1">
-                        <h1 tabindex="0" id="inicio">Função início</h1>
-                    </legend>
-
-                    <ol id="htmlOlCommandsVariablesVariables"></ol>
-                    <ol id="htmlOlCommandsVariablesOperations"></ol>
-                    <div class="row">
-                        <div class="col-12 p-4" style="text-align: right;">
-                            <div id="botoes" class="btn-group">
-                                <div class="dropdown btn btn-primary" id="bt_add_comand">
-                                    <a class="btn btn-primary dropdown-toggle" role="button" tabindex="0"
-                                        id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true"
-                                        aria-expanded="false">
-                                        Comandos
+</div>
+<!-- Visual UI -->
+
+<!-- Accessible UI -->
+<div class="container" id="accessibleInterface" style="display: none;">
+    <!-- Header -->
+    <nav class="navbar navbar-expand-lg navbar-dark">
+        <a class="navbar-brand" tabindex="0">iVProg Acessível</a>
+        <div class="collapse navbar-collapse" id="navbarNav">
+            <ul class="navbar-nav">
+                <li class="nav-item">
+                    <a class="nav-link" href="#inicio" title="Alt + i" accesskey="i">Ir função inicio</a>
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link" href="#terminal" title="Alt + t" accesskey="t">Ir para o terminal</a>
+                </li>
+            </ul>
+        </div>
+    </nav>
+    <!-- Header -->
+
+    <!-- Main container -->
+    <div id="main" class="row" role="main">
+        <div class="col-12">
+            <fieldset>
+                <legend class="p-1">
+                    <h1 tabindex="0" id="inicio">Função início</h1>
+                </legend>
+
+                <ol id="htmlOlCommandsVariablesVariables"></ol>
+                <ol id="htmlOlCommandsVariablesOperations"></ol>
+                <div class="row">
+                    <div class="col-12 p-4" style="text-align: right;">
+                        <div id="botoes" class="btn-group">
+                            <div class="dropdown btn btn-primary" id="bt_add_comand">
+                                <a class="btn btn-primary dropdown-toggle" role="button" tabindex="0"
+                                   id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true"
+                                   aria-expanded="false">
+                                    Comandos
+                                </a>
+                                <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
+                                    <a class="dropdown-item" href="#" id="createVariableButton">
+                                        Nova Variável
+                                    </a>
+                                    <a class="dropdown-item" href="#" id="assignVariableButton">
+                                        Atribuição e Operações
                                     </a>
-                                    <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
-                                        <a class="dropdown-item" href="#" id="createVariableButton">
-                                            Nova Variável
-                                        </a>
-                                        <a class="dropdown-item" href="#" id="assignVariableButton">
-                                            Atribuição e Operações
-                                        </a>
-                                    </div>
                                 </div>
-
-                                <button class="btn btn-success" id="runCodeButton">
-                                    Executar
-                                    <i id="runCodePlayIcon" class="play icon" style="display: inline;"></i>
-                                    <i id="runCodeStopIcon" class="stop icon" style="display: none;"></i>
-                                </button>
                             </div>
+
+                            <button class="btn btn-success" id="runCodeButton">
+                                Executar
+                                <i id="runCodePlayIcon" class="play icon" style="display: inline;"></i>
+                                <i id="runCodeStopIcon" class="stop icon" style="display: none;"></i>
+                            </button>
                         </div>
                     </div>
-                </fieldset>
-            </div>
+                </div>
+            </fieldset>
         </div>
-        <!-- Main container -->
+    </div>
+    <!-- Main container -->
 
-        <br/>
+    <br/>
 
-        <!-- Terminal -->
-        <div class="row">
-            <div class="col-12">
-                <div id="terminal" class="acessible-terminal" style="width: 97%; margin-left: 2%"></div>
-            </div>
+    <!-- Terminal -->
+    <div class="row">
+        <div class="col-12">
+            <div id="terminal" class="acessible-terminal" style="width: 97%; margin-left: 2%"></div>
         </div>
-        <!-- Terminal -->
-
-        <!-- Debug only -->
-        <div class="row">
-            <div class="col-12">
-                <h5>Código gerado para debug - Código gerado</h5>
-                <div style="width: 97%; margin-left: 2%; background-color: wheat; color: black;">
-                    <code id="generatedCode">
+    </div>
+    <!-- Terminal -->
+
+    <!-- Debug only -->
+    <div class="row">
+        <div class="col-12">
+            <h5>Código gerado para debug - Código gerado</h5>
+            <div style="width: 97%; margin-left: 2%; background-color: wheat; color: black;">
+                <code id="generatedCode">
                 </code>
-                </div>
             </div>
         </div>
-        <!-- Debug only -->
     </div>
-    <!-- Accessible UI -->
+    <!-- Debug only -->
+</div>
+<!-- Accessible UI -->
 
-    <!-- Accessible UI JS -->
+<!-- Accessible UI JS -->
 </body>
 <script>
     var mouseX;