first commit
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Retro Terminal</title>
|
||||
<style>
|
||||
body { margin:0; background:black; color:#0f0; font-family:monospace; padding:20px; }
|
||||
input { background:black; color:#0f0; border:none; width:100%; font-family:monospace; font-size:16px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h3>Fake Terminal</h3>
|
||||
<div id="output"></div>
|
||||
<input id="cmd" placeholder="Type command..." autofocus>
|
||||
<script>
|
||||
const output=document.getElementById('output');
|
||||
const input=document.getElementById('cmd');
|
||||
|
||||
const responses = {
|
||||
help: "Try: hello, date, joke",
|
||||
hello: "Hello there, human!",
|
||||
date: new Date().toString(),
|
||||
joke: "Why do programmers prefer dark mode? Because light attracts bugs!"
|
||||
};
|
||||
|
||||
input.addEventListener('keydown', e=>{
|
||||
if(e.key==='Enter'){
|
||||
const cmd=input.value.trim();
|
||||
output.innerHTML += `> ${cmd}<br>`;
|
||||
output.innerHTML += (responses[cmd]||"Command not found") + '<br>';
|
||||
input.value='';
|
||||
window.scrollTo(0,document.body.scrollHeight);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user