tweetcast/nodejs/client/js/script.js
changeset 341 cab5c9e10f90
parent 340 a99a04556e3b
child 342 60b8281442b8
equal deleted inserted replaced
340:a99a04556e3b 341:cab5c9e10f90
    80 	if (tweet.user.profile_image_url) {
    80 	if (tweet.user.profile_image_url) {
    81 		html += a_user + '<img class="profile_image" src="' + tweet.user.profile_image_url + '" /></a>';
    81 		html += a_user + '<img class="profile_image" src="' + tweet.user.profile_image_url + '" /></a>';
    82 	}
    82 	}
    83 	html += '<h4>' + a_user + '@' + tweet.user.screen_name + '</a></h4><p class="created_at">' + new Date(tweet.created_at).toLocaleTimeString() + '</p><p class="tweet_text">';
    83 	html += '<h4>' + a_user + '@' + tweet.user.screen_name + '</a></h4><p class="created_at">' + new Date(tweet.created_at).toLocaleTimeString() + '</p><p class="tweet_text">';
    84 	lastend = 0;
    84 	lastend = 0;
    85 	txt = '';
    85 	txt = tweet.text.replace(/(https?:[0-9a-zA-Z\/\-_\.~&?=]+)/g,'<a href="$1" target="_blank">$1</a>').replace(/@([0-9a-zA-Z_]+)/g,'<a href="http://twitter.com/$1" target="_blank">@$1</a>');
       
    86 /*	txt = '';
    86 	entities = [];
    87 	entities = [];
    87 	for (var i in tweet.entities.hashtags) {
    88 	for (var i in tweet.entities.hashtags) {
    88 	    entities.push({
    89 	    entities.push({
    89 	        "start" : tweet.entities.hashtags[i].indices[0],
    90 	        "start" : tweet.entities.hashtags[i].indices[0],
    90 	        "end" : tweet.entities.hashtags[i].indices[1],
    91 	        "end" : tweet.entities.hashtags[i].indices[1],
   108  	entities.sort(function(a, b) { return a.start - b.start });
   109  	entities.sort(function(a, b) { return a.start - b.start });
   109     for (var i in entities) {
   110     for (var i in entities) {
   110  		txt += tweet.text.substring(lastend, entities[i].start) + entities[i].html;
   111  		txt += tweet.text.substring(lastend, entities[i].start) + entities[i].html;
   111         lastend = entities[i].end;
   112         lastend = entities[i].end;
   112     }
   113     }
   113 	txt += tweet.text.substring(lastend);
   114 	txt += tweet.text.substring(lastend); */
   114 	html += txt + '</p></li></div>';
   115 	html += txt + '</p></li></div>';
   115 	return html;
   116 	return html;
   116 }
   117 }
   117 
   118 
   118 
   119 
   214         tweetData.waitUpdate = true;
   215         tweetData.waitUpdate = true;
   215     } else {
   216     } else {
   216         tweetData.waitUpdate = false;
   217         tweetData.waitUpdate = false;
   217         getUpdate();
   218         getUpdate();
   218         tweetData.blockUpdate = true;
   219         tweetData.blockUpdate = true;
   219         setTimeout(delayedUpdate, 300);
   220         setTimeout(delayedUpdate, 100);
   220     }
   221     }
   221 }
   222 }
   222 
   223 
   223 function setTimeZoom(level) {
   224 function setTimeZoom(level) {
   224     if (level >= 0 && level <= 4) {
   225     if (level >= 0 && level <= 4) {