mirror of
https://github.com/ivabus/www
synced 2024-11-23 21:35:06 +03:00
63 lines
2.2 KiB
HTML
63 lines
2.2 KiB
HTML
|
|
||
|
<script>
|
||
|
const commands = [
|
||
|
{ input: "$ node --eval 'console.log(\"Hello World!\")'", output: `command not found: node<br><span class="dark-gray">#Node is not installed, thus command is not found :/ ...</span><br>` },
|
||
|
{ input: "$ sh <(curl tea.xyz) --yes", output: `installing ~/.tea...<br><table class="teal">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>% Total</th>
|
||
|
<th>% Received</th>
|
||
|
<th>% Xferd</th>
|
||
|
<th>Average Speed</th>
|
||
|
<th>Time</th>
|
||
|
<th>Time</th>
|
||
|
<th>Time</th>
|
||
|
<th>Current</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>100</td>
|
||
|
<td>13306</td>
|
||
|
<td>100</td>
|
||
|
<td>54983</td>
|
||
|
<td>0</td>
|
||
|
<td>--:--:--</td>
|
||
|
<td>--:--:--</td>
|
||
|
<td>--:--:--</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td colspan="8">k, we installed <mark>/Users/userName/.tea/tea.xyz/v0.21.0/bin/tea</mark></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
` },
|
||
|
{ input: "$ node --eval 'console.log(\"Hello World!\")'", output: `tea: installing nodejs.org^19<br><span class="dark-gray">#tea magically installs needed dependencies...</span>` },
|
||
|
{ input: "", output: `Hello World! 😎<br><span class="dark-gray">#and tah-dah!</span>` },
|
||
|
];
|
||
|
|
||
|
let commandIndex = 0;
|
||
|
let command = commands[commandIndex];
|
||
|
let commandOutput = "";
|
||
|
|
||
|
function typeCommand() {
|
||
|
if (commandIndex === commands.length) {
|
||
|
return;
|
||
|
}
|
||
|
if (command.input.length === 0) {
|
||
|
commandOutput += '\n' + command.output + '\n';
|
||
|
document.querySelector("#terminal-output").innerHTML = commandOutput;
|
||
|
commandIndex++;
|
||
|
command = commands[commandIndex];
|
||
|
setTimeout(typeCommand, 1000);
|
||
|
return;
|
||
|
}
|
||
|
commandOutput += command.input[0];
|
||
|
command.input = command.input.slice(1);
|
||
|
document.querySelector("#terminal-output").innerHTML = commandOutput;
|
||
|
setTimeout(typeCommand, 100);
|
||
|
}
|
||
|
|
||
|
typeCommand();
|
||
|
</script>
|