Added a bit of help for consoles
This commit is contained in:
parent
9e3da8dfe8
commit
b6755991cf
|
@ -47,11 +47,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.console_command {
|
.console_command {
|
||||||
width: calc(min(95%, 1024px) - 10em);
|
width: calc(min(95%, 1024px) - 8em);
|
||||||
}
|
}
|
||||||
|
|
||||||
.console_submit {
|
.console_submit {
|
||||||
width: 10em;
|
width: 6em;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
text-shadow: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.console_help {
|
||||||
|
width: 2em;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function createConsole(root, game_name, text_colour_function, initial_command) {
|
function createConsole(root, game_name, text_colour_function, initial_command, help_url, tooltip) {
|
||||||
const div_card = document.createElement('div');
|
const div_card = document.createElement('div');
|
||||||
const div_card_header = document.createElement('div');
|
const div_card_header = document.createElement('div');
|
||||||
const h5 = document.createElement('h5');
|
const h5 = document.createElement('h5');
|
||||||
|
@ -11,6 +11,7 @@ function createConsole(root, game_name, text_colour_function, initial_command) {
|
||||||
const input = document.createElement('form');
|
const input = document.createElement('form');
|
||||||
const input_text = document.createElement('input');
|
const input_text = document.createElement('input');
|
||||||
const input_submit = document.createElement('button');
|
const input_submit = document.createElement('button');
|
||||||
|
const input_help = document.createElement('button');
|
||||||
|
|
||||||
div_card.className = "card";
|
div_card.className = "card";
|
||||||
div_card_header.className = "card-header";
|
div_card_header.className = "card-header";
|
||||||
|
@ -29,9 +30,17 @@ function createConsole(root, game_name, text_colour_function, initial_command) {
|
||||||
input_text.className = "console_command";
|
input_text.className = "console_command";
|
||||||
input_text.size = 80;
|
input_text.size = 80;
|
||||||
input_text.autocomplete = "off";
|
input_text.autocomplete = "off";
|
||||||
|
if(tooltip) {
|
||||||
|
input_text.title = tooltip;
|
||||||
|
}
|
||||||
input_submit.id = game_name + "_submit";
|
input_submit.id = game_name + "_submit";
|
||||||
input_submit.className = "console_submit";
|
input_submit.className = "console_submit";
|
||||||
input_submit.innerText = "Enter";
|
input_submit.innerText = "Enter";
|
||||||
|
input_help.id = game_name + "_submit";
|
||||||
|
input_help.className = "console_help";
|
||||||
|
input_help.innerText = "?";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
root.appendChild(div_card);
|
root.appendChild(div_card);
|
||||||
div_card.appendChild(div_card_header);
|
div_card.appendChild(div_card_header);
|
||||||
|
@ -44,8 +53,14 @@ function createConsole(root, game_name, text_colour_function, initial_command) {
|
||||||
div_card_body.appendChild(output);
|
div_card_body.appendChild(output);
|
||||||
input.appendChild(input_text);
|
input.appendChild(input_text);
|
||||||
input.appendChild(input_submit);
|
input.appendChild(input_submit);
|
||||||
|
input.appendChild(input_help);
|
||||||
div_card_body.appendChild(input);
|
div_card_body.appendChild(input);
|
||||||
|
|
||||||
|
input_help.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
window.open(help_url, '_blank');
|
||||||
|
});
|
||||||
|
|
||||||
input.addEventListener('submit', function(e){
|
input.addEventListener('submit', function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let line = document.createElement('p')
|
let line = document.createElement('p')
|
||||||
|
@ -79,10 +94,38 @@ function createConsole(root, game_name, text_colour_function, initial_command) {
|
||||||
|
|
||||||
function consoles_init() {
|
function consoles_init() {
|
||||||
const root = document.getElementById('console-div');
|
const root = document.getElementById('console-div');
|
||||||
createConsole(root, 'armagetronad', convertTerminalCodeToHtml, 'players');
|
createConsole(
|
||||||
createConsole(root, 'mindustry', convertTerminalCodeToHtml, 'status');
|
root,
|
||||||
createConsole(root, 'unvanquished', convertDaemonedCodeToHtml, '/status');
|
'armagetronad',
|
||||||
createConsole(root, 'xonotic', convertTerminalCodeToHtml, 'who');
|
convertTerminalCodeToHtml,
|
||||||
|
'players',
|
||||||
|
'http://wiki.armagetronad.org/index.php?title=Console_Commands',
|
||||||
|
"Helpful commands:\n• players\tShow current players\n• kick <name>\tKick the player\n• num_ais <num>\tSet the number of AIs for games with more than one player.\n• limit_rounds\tEnd the match after this number of rounds"
|
||||||
|
);
|
||||||
|
createConsole(
|
||||||
|
root,
|
||||||
|
'mindustry',
|
||||||
|
convertTerminalCodeToHtml,
|
||||||
|
'status',
|
||||||
|
'https://mindustrygame.github.io/wiki/servers/#dedicated-server-commands',
|
||||||
|
"Helpful commands:\n• status\tDisplay server status\n• runwave\tTrigger the next wave\n• kick <name>\tKick a person by name"
|
||||||
|
);
|
||||||
|
createConsole(
|
||||||
|
root,
|
||||||
|
'unvanquished',
|
||||||
|
convertDaemonedCodeToHtml,
|
||||||
|
'/status',
|
||||||
|
'https://wiki.unvanquished.net/wiki/Server/Running#Commands',
|
||||||
|
"Helpful commands:\n• /listplayers\tList current players in-game\n• /kick <name>\tKick the player\n• /nextmap\tGo to the next map in the rotation"
|
||||||
|
);
|
||||||
|
createConsole(
|
||||||
|
root,
|
||||||
|
'xonotic',
|
||||||
|
convertTerminalCodeToHtml,
|
||||||
|
'who',
|
||||||
|
'https://gitlab.com/xonotic/xonotic/-/wikis/Basic-server-configuration',
|
||||||
|
"Helpful commands:\n• who\tList current players in-game\n• kick <name>\tKick the player\n• gotomap <name>\tGo to the specified map"
|
||||||
|
);
|
||||||
|
|
||||||
collapse_init();
|
collapse_init();
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue