JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
move output to browser (from inspector)
[watch-my-terminal.git] / index.html
index e55e8c0..d540026 100644 (file)
@@ -1,9 +1,38 @@
-<script src="/socket.io/socket.io.js"></script>
-<script>
-  var socket = io.connect('http://localhost');
-  socket.on('news', function (data) {
-    console.log(data);
-    socket.emit('my other event', { my: 'data' });
-    socket.emit('jason', { is: 'large and in charge' });
-  });
-</script>
+<!DOCTYPE html>
+<html lang="en">
+<head>
+       <title>Remote Terminal Viewer</title>
+       <script src="/jquery.js"></script>
+       <script src="/socket.io/socket.io.js"></script>
+       <script>
+               $(function() {
+                       var $body = $('body');
+                       var lines = 0;
+                       var log = function (str) {
+                               if(lines > 66) {
+                                       $($body.children().get(0)).remove();
+                               } else {
+                                       lines += 1;
+                               }
+                               $body.append($('<div>').text(str));
+                       };
+                       var socket = io.connect('http://localhost');
+                       socket.on('write', function (data) {
+                               log(data);
+                       });
+               });
+       </script>
+       <style>
+               body {
+                       color: white;
+                       background: black;
+                       font-family: monospace;
+                       font-size: 12px;
+                       line-height: 14px;
+                       white-space: pre;
+               }
+       </style>
+</head>
+<body>
+</body>
+</html>