-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (47 loc) · 1.27 KB
/
Copy pathscript.js
File metadata and controls
57 lines (47 loc) · 1.27 KB
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
// Update Clock
setInterval(() => {
const clock = document.getElementById("clock");
const now = new Date();
clock.textContent = now.toLocaleTimeString();
}, 1000);
// Terminal Behavior
const output = document.getElementById("terminalOutput");
const input = document.getElementById("terminalInput");
input.addEventListener("keydown", e => {
if (e.key === "Enter") {
const cmd = input.value.trim();
runCommand(cmd);
input.value = "";
}
});
function print(text) {
output.innerHTML += text + "<br>";
output.scrollTop = output.scrollHeight;
}
function runCommand(cmd) {
print("> " + cmd);
switch (cmd) {
case "help":
print("Commands: help, neofetch, clear, version, exit");
break;
case "neofetch":
print(`
Ubuntu 25.04 (Lunar Lynx)
Kernel: 6.8.0-sim
GNOME: 47.1
Memory: 8GB (virtual)
CPU: Simulated`)
break;
case "clear":
output.innerHTML = "";
break;
case "version":
print("Ubuntu 25.04 Simulator v1.0");
break;
case "exit":
document.getElementById("terminalWindow").classList.add("hidden");
break;
default:
print("Unknown command: " + cmd);
}
}