X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.coffee;h=b69dad11f248c9eb325b376009a8b64bbff2c9ec;hb=5ea471be49d98517725f2017d274c030ac482111;hp=3cc8c8748fc493f9697eb63416647aec95eb38df;hpb=f864b5a4731e5ab5148b5fe20533e71691cf6955;p=watch-my-terminal.git diff --git a/client.coffee b/client.coffee index 3cc8c87..b69dad1 100644 --- a/client.coffee +++ b/client.coffee @@ -58,7 +58,7 @@ $ -> $body = $('body') $body.css backgroundColor: "##{palette[0]}", color: "##{palette[7]}" - socket = io.connect('http://localhost') + socket = io.connect('/') color_to_css = (i) -> # handle inverse bit @@ -77,8 +77,8 @@ $ -> return 'background-' + color_to_css(i ^ 0x080000) stylize = (txt, style) -> - if (txt.length == 0 or style == 0x000007) - return txt + return '' if txt.length is 0 + return $('').text txt if style is 0x000007 css = '' css += 'font-weight: bold; ' if style & 0x010000 css += 'text-decoration: underline; ' if style & 0x020000 @@ -101,7 +101,7 @@ $ -> if term.cursor_visible term.attributes[term.y][cursor_x] ^= 0x080000 for i in [0...term.text.length] - div = $('
') + div = $('') txt = '' a = 0x000007 for j in [0...term.text[i].length] @@ -141,12 +141,4 @@ $ -> socket.on 'init', (v) -> term = terminal.new(v.width, v.height) - term.x = v.x - term.y = v.y - term.a = v.a - term.text = v.text - term.attributes = v.attributes - term.cursor_visible = v.cursor_visible - term.scroll_top = v.scroll_top - term.scroll_bottom = v.scroll_bottom - redraw() + update v.text