File size: 2,561 Bytes
d827f03 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Echo Print Results</title>
<!-- Include jQuery and jQuery.Terminal -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery.terminal/css/jquery.terminal.min.css">
<script src="https://cdn.jsdelivr.net/npm/jquery"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.terminal/js/jquery.terminal.min.js"></script>
<style>
body {
margin: 0;
background: black;
color: green;
}
#terminal {
height: 100vh;
}
</style>
</head>
<body>
<div id="terminal"></div>
<script>
$(function () {
const terminal = $('#terminal').terminal({
// Echo Command: Basic Example
echo: function (...args) {
this.echo(`[[;cyan;]${args.join(' ')}]`);
},
// Example: Printing Results in a Clear Format
print_results: function (title, results) {
this.echo(`[[;yellow;]${title}]`);
results.forEach((result, index) => {
this.echo(`[[;green;]- Result ${index + 1}: ${result}]`);
});
this.echo('[[;cyan;]End of results.]');
},
// Example: Simulated Operation with Output
simulate: function (operation) {
this.echo(`[[;yellow;]Simulating ${operation}...]`);
this.pause();
setTimeout(() => {
const results = ['Step 1 completed', 'Step 2 completed', 'Operation successful'];
this.print_results(`${operation} Simulation Results`, results);
this.resume();
}, 2000);
},
// Help Command
help: function () {
this.echo(`
[[;yellow;]Available Commands:]
- echo <text> : Echoes back the input text
- print_results : Displays a formatted list of results
- simulate <action> : Simulates an action and prints results
- help : Displays this help menu
`);
}
}, {
greetings: '[[;yellow;]Welcome to the Echo Terminal]',
name: 'echo_terminal',
prompt: '>> '
});
});
</script>
</body>
</html> |