Create app/static/js/terminal.js
Browse files- app/static/js/terminal.js +20 -0
app/static/js/terminal.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
document.addEventListener('DOMContentLoaded', function() {
|
2 |
+
const input = document.getElementById('terminal-input');
|
3 |
+
const output = document.getElementById('terminal-output');
|
4 |
+
|
5 |
+
input.addEventListener('keypress', function(e) {
|
6 |
+
if (e.key === 'Enter') {
|
7 |
+
const command = input.value;
|
8 |
+
output.innerHTML += `<div><span class="prompt">$</span> ${command}</div>`;
|
9 |
+
|
10 |
+
// Add basic command handling here
|
11 |
+
if (command === 'clear') {
|
12 |
+
output.innerHTML = '';
|
13 |
+
} else {
|
14 |
+
output.innerHTML += `<div>Command not found: ${command}</div>`;
|
15 |
+
}
|
16 |
+
|
17 |
+
input.value = '';
|
18 |
+
}
|
19 |
+
});
|
20 |
+
});
|