(command, text)
| 953 | * @param {string} text the result string of the command |
| 954 | */ |
| 955 | const 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 |
no test coverage detected