Spaces:
BG5
/
Sleeping

File size: 920 Bytes
643de08
 
 
 
 
e44d5f8
 
 
 
 
 
643de08
 
e44d5f8
 
643de08
e44d5f8
643de08
e44d5f8
 
 
643de08
e44d5f8
 
 
 
 
 
643de08
 
 
e44d5f8
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bash Shell</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.0/socket.io.js"></script>
    <style>
        body { font-family: monospace; }
        #output { white-space: pre; }
    </style>
</head>
<body>
    <div id="output"></div>
    <input id="input" autofocus />
    <script>
        const socket = io();

        socket.on('output', function(data) {
            document.getElementById('output').innerText += data;
        });

        document.getElementById('input').addEventListener('keydown', function(event) {
            if (event.key === 'Enter') {
                const input = this.value;
                socket.emit('input', input);
                this.value = '';
            }
        });
    </script>
</body>
</html>