123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- // Imports
- import {createVariable, deleteAllVariable} from './modules/variables/variables';
- import {createOperation, 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 runCodeButton = document.getElementById('runCodeButton');
- const cleanCommands = document.getElementById('cleanCommands');
- 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();
- });
- runCodeButton.addEventListener('click', ev => {
- 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)
- );
- }
- // ***********************************************************************
|