12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- // Imports
- import {createVariable, deleteAllVariable} from './modules/variables/variables';
- import {createOperation, createPrintOperation, deleteAllOperation} from './modules/operations/operations';
- import {runCode} from "./compiler";
- // Imports
- // Html references
- export const htmlOlCommandsVariables = document.getElementById('htmlOlCommandsVariablesVariables');
- export const htmlOlCommandsOperations = document.getElementById('htmlOlCommandsVariablesOperations');
- export const terminal = document.getElementById('terminal');
- // ***********************************************************************
- // Init Accessible UI
- // ***********************************************************************
- // Accessible UI buttons references
- const createVariableButton = document.getElementById('createVariableButton');
- const assignVariableButton = document.getElementById('assignVariableButton');
- const printButton = document.getElementById('printButton');
- const runCodeButton = document.getElementById('runCodeButton');
- const cleanCommands = document.getElementById('cleanCommands');
- const ivprogConsoleClearbtn = document.getElementById('ivprog-console-clearbtn');
- export function initAccessibleUI () {
- // Initializing dropdown menus
- $(".dropdown-submenu a.test").on("click", function (e) {
- $(this).next("ul").toggle();
- e.stopPropagation();
- e.preventDefault();
- });
- $('#goToCommands').click(ev => {
- $('#commands').click();
- });
- // Adding listeners
- createVariableButton.addEventListener('click', ev => {
- createVariable();
- });
- assignVariableButton.addEventListener('click', ev => {
- createOperation();
- });
- printButton.addEventListener('click', ev => {
- createPrintOperation();
- });
- runCodeButton.addEventListener('click', ev => {
- ivprogConsoleClearbtn.click();
- runCode();
- });
- cleanCommands.addEventListener('click', ev => {
- deleteAllVariable();
- deleteAllOperation();
- });
- }
- // ***********************************************************************
- // 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)
- );
- }
- // ***********************************************************************
|