Skip to content

Commit f3323b7

Browse files
committed
Dynamic twitter feed
1 parent 6162883 commit f3323b7

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

css/style.css

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,24 +375,18 @@ td img { margin: 0; display: block; }
375375
float: left;
376376
margin-bottom: 14px;
377377
}
378-
.latest-tweets .perma {
379-
display: block;
380-
width: 20px;
381-
float: left;
382-
}
383-
.github-avatar,
384-
.twitter-avatar {
378+
.github-avatar {
385379
display: block;
386380
float: left;
387381
width: 20px;
388382
height: 20px;
389383
}
390-
.github-commits-list li div,
391-
.latest-tweets li div {
384+
.github-commits-list li div {
392385
width: 370px;
393386
float: left;
394387
margin-left: 10px;
395388
}
389+
.latest-tweets li div { margin: 0; }
396390

397391

398392
/**************************************************************** Exhibition ***/

javascript/site.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ function extract_relative_time(date) {
3333
};
3434
}
3535
function format_relative_time(time_ago) {
36-
if ( time_ago.days > 2 ) return 'about ' + time_ago.days + ' days ago';
37-
if ( time_ago.hours > 24 ) return 'about a day ago';
38-
if ( time_ago.hours > 2 ) return 'about ' + time_ago.hours + ' hours ago';
39-
if ( time_ago.minutes > 45 ) return 'about an hour ago';
40-
if ( time_ago.minutes > 2 ) return 'about ' + time_ago.minutes + ' minutes ago';
41-
if ( time_ago.seconds > 1 ) return 'about ' + time_ago.seconds + ' seconds ago';
36+
if ( time_ago.days > 2 ) return ' ' + time_ago.days + ' days ago';
37+
if ( time_ago.hours > 24 ) return ' a day ago';
38+
if ( time_ago.hours > 2 ) return ' ' + time_ago.hours + ' hours ago';
39+
if ( time_ago.minutes > 45 ) return ' an hour ago';
40+
if ( time_ago.minutes > 2 ) return ' ' + time_ago.minutes + ' minutes ago';
41+
if ( time_ago.seconds > 1 ) return ' ' + time_ago.seconds + ' seconds ago';
4242
return 'just now';
4343
}
4444

@@ -186,10 +186,9 @@ $(function(){
186186
var time = parse_date(tweet.created_at);
187187
var timeText = format_relative_time(extract_relative_time(time));
188188

189-
var tweet_html = '<li><a class="perma" href="https://www.twitter.com/processingOrg/status/' + tweet.id_str + '">&infin;<\/a>';
190-
tweet_html += '<div>'+tweet.text.parseURL().parseUsername().parseHashtag();
191-
tweet_html += ' ';
192-
tweet_html += timeText;
189+
var tweet_html = '<li><div>'+tweet.text.parseURL().parseUsername().parseHashtag();
190+
tweet_html += ' about';
191+
tweet_html += '<a href="https://www.twitter.com/processingOrg/status/' + tweet.id_str + '">' + timeText + '<\/a>';
193192
tweet_html += '<\/div><\/li>';
194193

195194
$('.latest-tweets').append(tweet_html)

0 commit comments

Comments
 (0)