diff -r 526d3e411736 -r 13702105c5ee tweetcast/gevent/client/js/script.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tweetcast/gevent/client/js/script.js Wed Oct 12 18:11:19 2011 +0200 @@ -0,0 +1,91 @@ +gtto = null; +tweets = []; + +function tweetToHtml(tweet) { + html = '
' + tweet.created_at + '
'; + lastend = 0; + txt = ''; + tweet.entities.sort(function(a, b) { return a.indice_start - b.indice_start }); + for (var i in tweet.entities) { + txt += tweet.text.substring(lastend, tweet.entities[i].indice_start); + lastend = tweet.entities[i].indice_end; + switch(tweet.entities[i].type) { + case "entity_hashtag": + txt += '#' + tweet.entities[i].entity.text + ''; + break; + case "entity_user": + txt += '@' + tweet.entities[i].entity.screen_name + ''; + break; + case "entity_url": + case "entity_media": + txt += '' + tweet.entities[i].entity.expanded_url + ''; + break; + } + } + txt += tweet.text.substring(lastend); + html += txt + '