4 <title>Remote Terminal Viewer</title>
5 <script src="/jquery.js"></script>
6 <script src="/socket.io/socket.io.js"></script>
9 // 8-14 are bolded versions
28 var $body = $('body');
29 var socket = io.connect('http://localhost');
30 var color_to_css = function(i) {
32 // lighten the basic 8 colors when they're bold
33 if (i & 0x10000 && index < 8) {
36 return 'color: #' + palette[index] + '; ';
38 var bg_color_to_css = function(i) {
39 return 'background-' + color_to_css((i&0x10000) | ((i&0xff00) >> 8));
41 var stylize = function (txt, style) {
42 if (txt.length == 0 || style == 0) {
46 if(style & 0x10000) css += 'font-weight: bold; ';
47 if(style & 0x20000) css += 'text-decoration: underline; ';
48 if(style & 0x40000) css += 'text-decoration: underline; '; // blink
49 if(style & 0x80000) css += 'text-decoration: line-through; '; // invisible
50 if(style & 0x000ff) css += color_to_css(style);
51 if(style & 0x0ff00) css += bg_color_to_css(style);
52 return $('<span style="'+css+'"></span>').text(txt);
54 socket.on('init', function (v) {
55 $body.children().remove();
61 if(v.attributes[i][j] != a) {
63 div.append(stylize(txt, a));
66 a = v.attributes[i][j]
71 div.append(stylize(txt, a));
82 font-family: monospace;