4 <title>Remote Terminal Viewer</title>
5 <script src="/jquery.js"></script>
6 <script src="/socket.io/socket.io.js"></script>
19 var $body = $('body');
20 var socket = io.connect('http://localhost');
21 var color_to_css = function(i) {
22 return 'color: #' + palette[i] + '; ';
24 var bg_color_to_css = function(i) {
25 return 'background-' + color_to_css(i);
27 var stylize = function (txt, style) {
28 if(txt.length == 0 || style == 0) {
32 if(style & 0x10000) css += 'font-weight: bold; ';
33 if(style & 0x20000) css += 'text-decoration: underline; ';
34 if(style & 0x40000) css += 'text-decoration: underline; '; // blink
35 if(style & 0x80000) css += 'text-decoration: line-through; '; // invisible
36 if(style & 0x000ff) css += color_to_css(style & 0xff);
37 if(style & 0x0ff00) css += bg_color_to_css((style & 0xff00) >> 8);
38 return $('<span style="'+css+'"></span>').text(txt);
40 socket.on('init', function (v) {
41 $body.children().remove();
47 if(v.attributes[i][j] != a) {
49 div.append(stylize(txt, a));
52 a = v.attributes[i][j]
57 div.append(stylize(txt, a));
68 font-family: monospace;