1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- // Imports
- import {createVariable} from './modules/variables/variables';
- import {createOperation} 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');
- 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)
- );
- }
- // ***********************************************************************
|