rename and moving text generating function
This commit is contained in:
parent
05bbb8ba2b
commit
c0d750acfb
@ -1,3 +1,3 @@
|
|||||||
function cmd_help() {
|
function cmd_help() {
|
||||||
return "Help haha";
|
return "You need help? Sucks to be you! Hahahahaha";
|
||||||
}
|
}
|
18
js/main.js
18
js/main.js
@ -76,17 +76,10 @@ document.addEventListener("keydown", e => {
|
|||||||
// Run command and return output???
|
// Run command and return output???
|
||||||
let commandOutput = runCommand(text);
|
let commandOutput = runCommand(text);
|
||||||
|
|
||||||
const aTag = str => {
|
tbDiv.appendChild(createText(text));
|
||||||
const link = document.createElement("a");
|
|
||||||
link.style.color = "lightgrey";
|
|
||||||
link.textContent = str;
|
|
||||||
return link;
|
|
||||||
};
|
|
||||||
|
|
||||||
tbDiv.appendChild(aTag(text));
|
|
||||||
tbDiv.innerHTML += `<br>`;
|
tbDiv.innerHTML += `<br>`;
|
||||||
if (commandOutput !== "") {
|
if (commandOutput !== "") {
|
||||||
tbDiv.append(aTag(commandOutput))
|
tbDiv.append(createText(commandOutput))
|
||||||
tbDiv.innerHTML += `<br>`;
|
tbDiv.innerHTML += `<br>`;
|
||||||
cursorYOffset++;
|
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) {
|
function runCommand(input) {
|
||||||
let output = "";
|
let output = "";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user