diff -r cab5c9e10f90 -r 60b8281442b8 tweetcast/nodejs/client/js/script.js --- a/tweetcast/nodejs/client/js/script.js Fri Oct 28 18:48:14 2011 +0200 +++ b/tweetcast/nodejs/client/js/script.js Wed Nov 02 17:13:23 2011 +0100 @@ -63,7 +63,7 @@ if (!tweet) { return placeHolder(className); } - html = '
  • '; + a_user = ''; if (tweet.user.profile_image_url) { html += a_user + ''; } html += '

    ' + a_user + '@' + tweet.user.screen_name + '

    ' + new Date(tweet.created_at).toLocaleTimeString() + '

    '; lastend = 0; - txt = tweet.text.replace(/(https?:[0-9a-zA-Z\/\-_\.~&?=]+)/g,'$1').replace(/@([0-9a-zA-Z_]+)/g,'@$1'); -/* txt = ''; - entities = []; + var tab = tweet.text.split(/\&\#|\;/); + var txta = ''; + for (i = 0; i < tab.length; i++) { + txta += (i % 2 && parseInt(tab[i]) != NaN) ? String.fromCharCode(tab[i]) : tab[i]; + } + var txt = '', + entities = []; for (var i in tweet.entities.hashtags) { entities.push({ "start" : tweet.entities.hashtags[i].indices[0], @@ -96,7 +100,7 @@ entities.push({ "start" : tweet.entities.urls[i].indices[0], "end" : tweet.entities.urls[i].indices[1], - "html" : '' + tweet.entities.urls[i].display_url + '' + "html" : '' + tweet.entities.urls[i].expanded_url + '' }); } for (var i in tweet.entities.user_mentions) { @@ -108,10 +112,10 @@ } entities.sort(function(a, b) { return a.start - b.start }); for (var i in entities) { - txt += tweet.text.substring(lastend, entities[i].start) + entities[i].html; + txt += txta.substring(lastend, entities[i].start) + entities[i].html; lastend = entities[i].end; } - txt += tweet.text.substring(lastend); */ + txt += txta.substring(lastend); html += txt + '

  • '; return html; }