rename and moving text generating function

This commit is contained in:
Baipyrus 2023-01-12 14:40:53 +01:00
parent 05bbb8ba2b
commit c0d750acfb
2 changed files with 10 additions and 10 deletions

View File

@ -1,3 +1,3 @@
function cmd_help() {
return "Help haha";
return "You need help? Sucks to be you! Hahahahaha";
}

View File

@ -76,17 +76,10 @@ document.addEventListener("keydown", e => {
// Run command and return output???
let commandOutput = runCommand(text);
const aTag = str => {
const link = document.createElement("a");
link.style.color = "lightgrey";
link.textContent = str;
return link;
};
tbDiv.appendChild(aTag(text));
tbDiv.appendChild(createText(text));
tbDiv.innerHTML += `<br>`;
if (commandOutput !== "") {
tbDiv.append(aTag(commandOutput))
tbDiv.append(createText(commandOutput))
tbDiv.innerHTML += `<br>`;
cursorYOffset++;
}
@ -110,6 +103,13 @@ document.addEventListener("keydown", e => {
}
});
function createText(str) {
const link = document.createElement("a");
link.style.color = "lightgrey";
link.textContent = str;
return link;
}
function runCommand(input) {
let output = "";