Browse code

updated twitter style, added metadata

B Mathis authored on 08/11/2009 at 04:51:36
Showing 4 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 blog_title: My Octopress Blog
3 3
 
4 4
 twitter_user: imathis
5
-tweet_count: 4
5
+tweet_count: 3
6 6
 show_replies: false
7 7
 
8 8
 full_url: 
... ...
@@ -15,6 +15,7 @@
15 15
 
16 16
 var tweet_container = 'li';
17 17
 var twitter_container = 'twitter_status';
18
+var key = '-!-!-';
18 19
 
19 20
 window.addEvent('domready',function() {
20 21
 	getTwitterStatus(twitter_user);
... ...
@@ -22,11 +23,11 @@ window.addEvent('domready',function() {
22 22
 
23 23
 function showTweets(the_tweets, from_cookie){
24 24
   if(from_cookie){
25
-    the_tweets = the_tweets.split('^!^!^!^!^');
25
+    the_tweets = the_tweets.split('^!^!^');
26 26
   }
27 27
   $(twitter_container).set('html', '');
28 28
   the_tweets.each(function(tweet){
29
-    tweet = parseTweetDate(tweet)
29
+    tweet = parseTweetMeta(tweet)
30 30
     tweet = '<p>' + tweet.replace(/\n\n/gi,'</p><p>') + '</p>';
31 31
     new Element(tweet_container,{
32 32
   		html: tweet
... ...
@@ -34,10 +35,15 @@ function showTweets(the_tweets, from_cookie){
34 34
   });
35 35
 }
36 36
 
37
-function parseTweetDate(tweet){
38
-  tweet = tweet.split('-!-!-!-');
39
-  date = prettyDate(new Date().parse(tweet[1]));
40
-  return tweet[0] + '<span class="pubdate">' + date + '</span>';
37
+function parseTweetMeta(tweet_data){
38
+  var tweet_data = tweet_data.split(key);
39
+  var tweet = tweet_data[0];
40
+  var date = tweet_data[1];
41
+  var tweet_id = tweet_data[2];
42
+  var source = tweet_data[3];
43
+  
44
+  date = prettyDate(new Date().parse(date));
45
+  return tweet + '<span class="meta"><a href="http://twitter.com/'+twitter_user+'/'+tweet_id+'">' + date + '</a> from ' + source + '</span>';
41 46
 }
42 47
 
43 48
 function prettyDate(time){
... ...
@@ -70,10 +76,10 @@ function getTwitterStatus(twitter_name){
70 70
   			tweets.each(function(tweet,i) {
71 71
   			  if((tweet.in_reply_to_status_id && show_replies) || !tweet.in_reply_to_status_id){
72 72
   			    if(the_tweets.length == tweet_count) return;
73
-    			  the_tweets.push(tweet.text + '-!-!-!-' + tweet.created_at);
73
+    			  the_tweets.push(tweet.text + key + tweet.created_at + key + tweet.id + key + tweet.source);
74 74
   				}
75 75
   			});
76
-  			Cookie.write(tweet_cookie,the_tweets.join('^!^!^!^!^'), { duration: 1 });
76
+  			Cookie.write(tweet_cookie,the_tweets.join('^!^!^'), { duration: 1 });
77 77
   			showTweets(the_tweets);
78 78
   		}
79 79
   	}).retrieve();
... ...
@@ -4,5 +4,4 @@ h4
4 4
   margin: 0
5 5
   .small
6 6
     +sans-font
7
-    font-size: 50%
8
-    //font-weight: normal
9 7
\ No newline at end of file
8
+    font-size: 50%
10 9
\ No newline at end of file
... ...
@@ -16,8 +16,13 @@
16 16
       border-bottom: 0
17 17
     p
18 18
       padding-bottom: 10px
19
-    .pubdate
19
+    .meta
20 20
       color= !light_text
21 21
       font-size: 80%
22 22
       display: block
23
-      padding: 8px 0 0
24 23
\ No newline at end of file
24
+      padding: 8px 0 0
25
+      a
26
+        color: inherit
27
+        text-decoration: none
28
+        &:hover
29
+          text-decoration: underline
25 30
\ No newline at end of file