diff -r f7ceddf99d6d -r bf5cf5a9e737 tweetcast/twisted/client/js/script.js --- a/tweetcast/twisted/client/js/script.js Wed Dec 07 19:28:46 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -// Web Socket definitions - -WEB_SOCKET_SWF_LOCATION = "lib/websocket-js/WebSocketMain.swf"; -WEB_SOCKET_DEBUG = true; -var ws, tweets = []; - -$(document).ready(function() { - ws = new WebSocket("ws://" + document.location.hostname + ":9000/"); - ws.onopen = function() { - console.log("open"); - } - ws.onmessage = function(e) { - d = $.parseJSON(e.data); - console.log(d); - if (d.tweets) { - tweets = tweets.concat(d.tweets); - html = ''; - for (var i = d.tweets.length - 1; i >= 0; i--) { - html += Mustache.to_html('
  • @{{screen_name}}:

    {{created_at}}

    {{text}}

  • ',d.tweets[i]); - } - console.log(html); - $("#tweetlist").prepend(html); - } - }; - ws.onclose = function() { - console.log("close"); - }; - ws.onerror = function() { - console.log("error"); - }; - - -}) \ No newline at end of file