4 <title>Remote Terminal Viewer</title>
5 <script src="/jquery.js"></script>
6 <script src="/socket.io/socket.io.js"></script>
10 var socket = io.connect('http://localhost');
11 var color_to_css = function(i) {
13 ((i & 0xe0) ? 'ff' : '00') +
14 ((i & 0x1c) ? 'ff' : '00') +
15 ((i & 0x03) ? 'ff' : '00') +
18 var stylize = function (txt, style) {
19 if(txt.length == 0 || style == 0) {
23 if(style & 0x10000) css += 'font-weight: bold; ';
24 if(style & 0x20000) css += 'text-decoration: underline; ';
25 if(style & 0x40000) css += 'text-decoration: underline; '; // blink
26 if(style & 0x80000) css += 'text-decoration: line-through; '; // invisible
27 if(style & 0x000ff) css += color_to_css(style & 0xff);
28 if(style & 0x0ff00) css += 'background-' + color_to_css((style & 0xff00) >> 8);
29 return $('<span style="'+css+'"></span>').text(txt);
31 socket.on('init', function (v) {
32 $body.children().remove();
38 if(v.attributes[i][j] != a) {
40 div.append(stylize(txt, a));
43 a = v.attributes[i][j]
48 div.append(stylize(txt, a));
59 font-family: monospace;