diff options
-rw-r--r-- | source/_layouts/default.haml | 2 | ||||
-rw-r--r-- | source/javascripts/twitter.js | 22 | ||||
-rw-r--r-- | stylesheets/partials/_sidebar.sass | 3 | ||||
-rw-r--r-- | stylesheets/partials/_twitter.sass | 9 |
4 files changed, 23 insertions, 13 deletions
diff --git a/source/_layouts/default.haml b/source/_layouts/default.haml index 2ad53318..1dc52ffa 100644 --- a/source/_layouts/default.haml +++ b/source/_layouts/default.haml @@ -2,7 +2,7 @@ blog_title: My Octopress Blog twitter_user: imathis -tweet_count: 4 +tweet_count: 3 show_replies: false full_url: diff --git a/source/javascripts/twitter.js b/source/javascripts/twitter.js index b6f60de2..b1949913 100644 --- a/source/javascripts/twitter.js +++ b/source/javascripts/twitter.js @@ -15,6 +15,7 @@ var tweet_container = 'li'; var twitter_container = 'twitter_status'; +var key = '-!-!-'; window.addEvent('domready',function() { getTwitterStatus(twitter_user); @@ -22,11 +23,11 @@ window.addEvent('domready',function() { function showTweets(the_tweets, from_cookie){ if(from_cookie){ - the_tweets = the_tweets.split('^!^!^!^!^'); + the_tweets = the_tweets.split('^!^!^'); } $(twitter_container).set('html', ''); the_tweets.each(function(tweet){ - tweet = parseTweetDate(tweet) + tweet = parseTweetMeta(tweet) tweet = '<p>' + tweet.replace(/\n\n/gi,'</p><p>') + '</p>'; new Element(tweet_container,{ html: tweet @@ -34,10 +35,15 @@ function showTweets(the_tweets, from_cookie){ }); } -function parseTweetDate(tweet){ - tweet = tweet.split('-!-!-!-'); - date = prettyDate(new Date().parse(tweet[1])); - return tweet[0] + '<span class="pubdate">' + date + '</span>'; +function parseTweetMeta(tweet_data){ + var tweet_data = tweet_data.split(key); + var tweet = tweet_data[0]; + 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){ @@ -70,10 +76,10 @@ function getTwitterStatus(twitter_name){ tweets.each(function(tweet,i) { if((tweet.in_reply_to_status_id && show_replies) || !tweet.in_reply_to_status_id){ 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); } }).retrieve(); diff --git a/stylesheets/partials/_sidebar.sass b/stylesheets/partials/_sidebar.sass index 84da93e3..b9513e26 100644 --- a/stylesheets/partials/_sidebar.sass +++ b/stylesheets/partials/_sidebar.sass @@ -4,5 +4,4 @@ h4 margin: 0 .small +sans-font - font-size: 50% - //font-weight: normal
\ No newline at end of file + font-size: 50%
\ No newline at end of file diff --git a/stylesheets/partials/_twitter.sass b/stylesheets/partials/_twitter.sass index 8752656c..d8f9249e 100644 --- a/stylesheets/partials/_twitter.sass +++ b/stylesheets/partials/_twitter.sass @@ -16,8 +16,13 @@ border-bottom: 0 p padding-bottom: 10px - .pubdate + .meta color= !light_text font-size: 80% display: block - padding: 8px 0 0
\ No newline at end of file + padding: 8px 0 0 + a + color: inherit + text-decoration: none + &:hover + text-decoration: underline
\ No newline at end of file |