MCPcopy Create free account
hub / github.com/Cu-chi/cuchi_computer / AddConsoleLine

Function AddConsoleLine

nui/scripts/script.js:955–969  ·  view source on GitHub ↗
(command, text)

Source from the content-addressed store, hash-verified

953 * @param {string} text the result string of the command
954 */
955const AddConsoleLine = (command, text) => {
956 let consoleText = document.getElementById("console-text");
957 let oldInput = document.getElementById("console-input");
958 let enteredCommand = document.createElement("p");
959 enteredCommand.innerText = command;
960 enteredCommand.classList.add("entered-command");
961 oldInput.onkeydown = null;
962 oldInput.replaceWith(enteredCommand);
963
964 consoleText.innerHTML += "<div>" + text + "</div>";
965 consoleText.innerHTML += "<div class='console-line'><p>" + ConsolePrefix() + "</p><input id='console-input' type='text'></div>";
966 let newInput = document.getElementById("console-input");
967 newInput.focus();
968 newInput.onkeydown = (e) => OnConsoleCommand(e, newInput);
969};
970
971/**
972 * Clears console output

Callers 2

OnConsoleCommandFunction · 0.85
commands.jsFile · 0.85

Calls 2

ConsolePrefixFunction · 0.85
OnConsoleCommandFunction · 0.85

Tested by

no test coverage detected