Browse Source

Code refactoring

main
Stipe Varnica 6 months ago
parent
commit
eeaf298adb
  1. 1
      TEMPEST/tempest-devel
  2. 12
      index.html
  3. 8
      javascript/filesHandling.js
  4. 8
      javascript/index.js
  5. 2
      node_modules/.package-lock.json
  6. 2
      package-lock.json

1
TEMPEST/tempest-devel

@ -1 +0,0 @@
Subproject commit 8da32343531799e827816124932063a28e9c885b

12
index.html

@ -25,6 +25,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.53.2/mode/javascript/javascript.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.53.2/mode/javascript/javascript.min.js"></script>
<script src="node_modules/@viz-js/viz/lib/viz-standalone.js"></script> <script src="node_modules/@viz-js/viz/lib/viz-standalone.js"></script>
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="row gx-0"> <div class="row gx-0">
@ -186,16 +187,6 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<!-- <label for="fname">File name</label>
<br />
<input type="text" id="fname" name="fname" />
<button id="create" type="button" class="btn btn-success">
Create File
</button>
<a download="info.txt" id="downloadlink" style="display: none"
>Download Here</a
> -->
<h4 class="mt-1">Upload a file</h4> <h4 class="mt-1">Upload a file</h4>
<div class="mb-3"> <div class="mb-3">
<input type="file" id="fileInput" class="form-control" /> <input type="file" id="fileInput" class="form-control" />
@ -280,7 +271,6 @@
></script> ></script>
<script src="javascript/syntax.js"></script> <script src="javascript/syntax.js"></script>
<script src="javascript/index.js"></script> <script src="javascript/index.js"></script>
<script src="javascript/zoom.js"></script> <script src="javascript/zoom.js"></script>
<script src="javascript/filesHandling.js"></script> <script src="javascript/filesHandling.js"></script>
</body> </body>

8
javascript/filesHandling.js

@ -99,14 +99,14 @@ document.addEventListener("DOMContentLoaded", function () {
return textFile; return textFile;
}; };
var download = document.getElementById("downloadFirstEditor");
var download2 = document.getElementById("downloadSpecifications");
var downloadEditorText = document.getElementById("downloadFirstEditor");
var downloadSpecifications = document.getElementById("downloadSpecifications");
var input1 = editor; var input1 = editor;
var input2 = editor2; var input2 = editor2;
// Add an event listener to the button for the click event // Add an event listener to the button for the click event
download.addEventListener("click", function () {
downloadEditorText.addEventListener("click", function () {
// Check if the editor is empty // Check if the editor is empty
if (!editor.getValue()) { if (!editor.getValue()) {
Toastify({ Toastify({
@ -137,7 +137,7 @@ document.addEventListener("DOMContentLoaded", function () {
} }
}); });
download2.addEventListener("click", function () {
downloadSpecifications.addEventListener("click", function () {
if (!editor2.getValue()) { if (!editor2.getValue()) {
Toastify({ Toastify({
text: "Specifications field empty", text: "Specifications field empty",

8
javascript/index.js

@ -15,13 +15,7 @@ var editor2 = CodeMirror.fromTextArea(input2, {
lineNumbers: true, lineNumbers: true,
}); });
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
// var input = document.createElement("input");
// input.type = "file";
// input.classList.add("customInput", "col-3");
// input.setAttribute("id", "fileInputEditor");
// const position = { line: 1, ch: 2 };
// editor.addWidget(position, input, false);
//Run function //Run function
document.getElementById("runBtn").addEventListener("click", function () { document.getElementById("runBtn").addEventListener("click", function () {
@ -69,6 +63,8 @@ function graphFunction(svg) {
graph = svg; graph = svg;
} }
function getActiveTabContent() { function getActiveTabContent() {
var activeTabId = document.querySelector(".rightNav.active").id; var activeTabId = document.querySelector(".rightNav.active").id;
switch (activeTabId) { switch (activeTabId) {

2
node_modules/.package-lock.json

@ -1,5 +1,5 @@
{ {
"name": "Internship",
"name": "testingwasm_new",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

2
package-lock.json

@ -1,5 +1,5 @@
{ {
"name": "Internship",
"name": "testingwasm_new",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

Loading…
Cancel
Save