minor changes

This commit is contained in:
valentijn
2024-01-19 16:04:41 +01:00
parent 4f86aa8cb2
commit 33db47102c

View File

@@ -41,7 +41,6 @@ async function sendCommand(e){
} }
} }
createNewTerminalLine(); createNewTerminalLine();
addInputEventListeners();
return; return;
} catch { } catch {
handleExecutionResponse({"response": "Invalid Argument"}) handleExecutionResponse({"response": "Invalid Argument"})
@@ -54,7 +53,6 @@ async function sendCommand(e){
line.remove(); line.remove();
}) })
createNewTerminalLine(); createNewTerminalLine();
addInputEventListeners();
return; return;
} }
@@ -102,27 +100,26 @@ function deactivateAllStuff() {
function handleExecutionResponse(response) { function handleExecutionResponse(response) {
//Show Response //Show Response
createNewTextLine(response.response);
//create new terminal line.
createNewTerminalLine();
}
function createNewTextLine(text){
let commandResponse = document.createElement("div") let commandResponse = document.createElement("div")
commandResponse.classList.add("terminalLine"); commandResponse.classList.add("terminalLine");
let textElement = document.createElement("span"); let textElement = document.createElement("span");
textElement.classList.add("responseText"); textElement.classList.add("responseText");
textElement.innerHTML = response.response; textElement.innerHTML = text;
commandResponse.appendChild(textElement) commandResponse.appendChild(textElement)
terminalContainer.appendChild(commandResponse); terminalContainer.appendChild(commandResponse);
//create new terminal line.
createNewTerminalLine();
addInputEventListeners();
} }
function createNewTerminalLine(){ function createNewTerminalLine(){
let newTerminalLine = document.createElement("div"); let newTerminalLine = document.createElement("div");
newTerminalLine.classList.add("terminalLine"); newTerminalLine.classList.add("terminalLine");
@@ -164,6 +161,8 @@ function createNewTerminalLine(){
newTerminalLine.appendChild(blinky); newTerminalLine.appendChild(blinky);
terminalContainer.appendChild(newTerminalLine) terminalContainer.appendChild(newTerminalLine)
addInputEventListeners();
} }