function placeOperationAt() { let firstVariable = document.getElementById('firstOperationSubMenuVariable'); let operation = document.getElementById('operationTypeSubMenu'); let secondVariable = document.getElementById('secondOperationSubMenuVariable'); let id = universalId.next(); let html = ``; let compiledView = `${variables[firstVariable.value].name} ${getOperationByValue(operation.value).operator} ${variables[secondVariable.value].name}`; html += `
`; html += ` `; html += ` `; html += ` `; html += `
`; html += `
`; html += `
${compiledView}
`; html += `
`; html += `
`; html += ` `; html += `
`; html += `
`; html += `
`; $(html).insertAfter(`#workspaceVariableDiv${document.getElementById('placeOperationAt').value}`); operations.push({ id: id, firstVariable: variables[firstVariable.value], operation: getOperationByValue(operation.value), secondVariable: variables[secondVariable.value], usage: document.getElementById(`workspaceVariableDiv${id}`) }); variables[firstVariable.value].usages.push(document.getElementById(`workspaceVariableDiv${id}`)); variables[secondVariable.value].usages.push(document.getElementById(`workspaceVariableDiv${id}`)); hideSubMenu(); } function placeOperatorAt() { let operator = getOperationByValue(document.getElementById('operatorTypeSubMenu').value); let id = universalId.next(); let html = ``; html += `
`; html += ` `; html += ` `; html += ` `; html += `
`; html += `
`; html += `
${operator.operator}
`; html += `
`; html += `
`; html += ` `; html += `
`; html += `
`; html += `
`; $(html).insertAfter(`#workspaceVariableDiv${document.getElementById('placeOperatorAt').value}`); operatorsMain.push({ id: id, operation: operator, usage: document.getElementById(`workspaceVariableDiv${id}`) }); hideSubMenu(); } function deleteOperationFromMain(id) { for (let i = 0; i < operations.length; i++) { if (operations[i].id === id) { operations[i].usage.remove(); operations.splice(i, 1); } } } function deleteOperatorFromMain(id) { for (let i = 0; i < operatorsMain.length; i++) { if (operatorsMain[i].id === id) { operatorsMain[i].usage.remove(); operatorsMain.splice(i, 1); } } }