updated twitter style, added metadata

This commit is contained in:
B Mathis 2009-11-07 22:51:36 -06:00
parent ec09295459
commit c27f5f8e5a
4 changed files with 23 additions and 13 deletions

View File

@ -2,7 +2,7 @@
blog_title: My Octopress Blog blog_title: My Octopress Blog
twitter_user: imathis twitter_user: imathis
tweet_count: 4 tweet_count: 3
show_replies: false show_replies: false
full_url: full_url:

View File

@ -15,6 +15,7 @@
var tweet_container = 'li'; var tweet_container = 'li';
var twitter_container = 'twitter_status'; var twitter_container = 'twitter_status';
var key = '-!-!-';
window.addEvent('domready',function() { window.addEvent('domready',function() {
getTwitterStatus(twitter_user); getTwitterStatus(twitter_user);
@ -22,11 +23,11 @@ window.addEvent('domready',function() {
function showTweets(the_tweets, from_cookie){ function showTweets(the_tweets, from_cookie){
if(from_cookie){ if(from_cookie){
the_tweets = the_tweets.split('^!^!^!^!^'); the_tweets = the_tweets.split('^!^!^');
} }
$(twitter_container).set('html', ''); $(twitter_container).set('html', '');
the_tweets.each(function(tweet){ the_tweets.each(function(tweet){
tweet = parseTweetDate(tweet) tweet = parseTweetMeta(tweet)
tweet = '<p>' + tweet.replace(/\n\n/gi,'</p><p>') + '</p>'; tweet = '<p>' + tweet.replace(/\n\n/gi,'</p><p>') + '</p>';
new Element(tweet_container,{ new Element(tweet_container,{
html: tweet html: tweet
@ -34,10 +35,15 @@ function showTweets(the_tweets, from_cookie){
}); });
} }
function parseTweetDate(tweet){ function parseTweetMeta(tweet_data){
tweet = tweet.split('-!-!-!-'); var tweet_data = tweet_data.split(key);
date = prettyDate(new Date().parse(tweet[1])); var tweet = tweet_data[0];
return tweet[0] + '<span class="pubdate">' + date + '</span>'; var date = tweet_data[1];
var tweet_id = tweet_data[2];
var source = tweet_data[3];
date = prettyDate(new Date().parse(date));
return tweet + '<span class="meta"><a href="http://twitter.com/'+twitter_user+'/'+tweet_id+'">' + date + '</a> from ' + source + '</span>';
} }
function prettyDate(time){ function prettyDate(time){
@ -70,10 +76,10 @@ function getTwitterStatus(twitter_name){
tweets.each(function(tweet,i) { tweets.each(function(tweet,i) {
if((tweet.in_reply_to_status_id && show_replies) || !tweet.in_reply_to_status_id){ if((tweet.in_reply_to_status_id && show_replies) || !tweet.in_reply_to_status_id){
if(the_tweets.length == tweet_count) return; if(the_tweets.length == tweet_count) return;
the_tweets.push(tweet.text + '-!-!-!-' + tweet.created_at); the_tweets.push(tweet.text + key + tweet.created_at + key + tweet.id + key + tweet.source);
} }
}); });
Cookie.write(tweet_cookie,the_tweets.join('^!^!^!^!^'), { duration: 1 }); Cookie.write(tweet_cookie,the_tweets.join('^!^!^'), { duration: 1 });
showTweets(the_tweets); showTweets(the_tweets);
} }
}).retrieve(); }).retrieve();

View File

@ -4,5 +4,4 @@ h4
margin: 0 margin: 0
.small .small
+sans-font +sans-font
font-size: 50% font-size: 50%
//font-weight: normal

View File

@ -16,8 +16,13 @@
border-bottom: 0 border-bottom: 0
p p
padding-bottom: 10px padding-bottom: 10px
.pubdate .meta
color= !light_text color= !light_text
font-size: 80% font-size: 80%
display: block display: block
padding: 8px 0 0 padding: 8px 0 0
a
color: inherit
text-decoration: none
&:hover
text-decoration: underline