separated reload and clear commands

This commit is contained in:
Baipyrus 2023-01-20 09:34:42 +01:00
parent cd75deef30
commit 11ba7c8ef1

View File

@ -61,7 +61,8 @@ function runCommand(input) {
function cmd_help() { function cmd_help() {
return "Commands list:<br>" + return "Commands list:<br>" +
" -about Information about this website<br>"+ " -about Information about this website<br>"+
" -clear Clear terminal screen<br>" + " -reload Reload the page (deletes all session data)<br>" +
" -clear Clear terminal screen (keeps all session data)<br>" +
" -history Displays the command history of this session<br>" + " -history Displays the command history of this session<br>" +
" -exec Execute arbitrary math and logic equations<br>" + " -exec Execute arbitrary math and logic equations<br>" +
" -nick Choose your username. Do not use spaces in it<br>" + " -nick Choose your username. Do not use spaces in it<br>" +
@ -74,11 +75,27 @@ function cmd_about() {
"It serves the purpose of a homepage. It exists just for the fun of creating it."; "It serves the purpose of a homepage. It exists just for the fun of creating it.";
} }
// Clear terminal by reloading page // Reload page
function cmd_clear() { function cmd_reload() {
window.location.reload(); window.location.reload();
} }
// Clear terminal window
function cmd_clear() {
setTimeout(() => {
const tbc = tbDiv.children;
for (let i = tbc.length-3; i > 1; i--)
tbDiv.removeChild(tbc[i]);
pretext.current = pretext.original;
cursorPosition = 0;
cursorYOffset = 7;
updateCursor();
}, 50);
return null;
}
// Display the command history line by line // Display the command history line by line
function cmd_history() { function cmd_history() {
let output = ""; let output = "";
@ -176,7 +193,7 @@ function cmd_exit(error) {
} }
// List all users to be able to chat with // List all users to be able to chat with
function cmd_ll() { function cmd_ls() {
if (!user.connected) if (!user.connected)
return "You are not connected!"; return "You are not connected!";
requestUsernames(); requestUsernames();