added sidebar partial, updated twitter style, handling linebreaks with paragraphs

This commit is contained in:
B Mathis 2009-11-07 19:24:09 -06:00
parent fcc761c7bf
commit f702f2fc2f
4 changed files with 27 additions and 14 deletions

View File

@ -73,9 +73,9 @@ google_analytics: true
= content = content
#sidebar #sidebar
- if page.respond_to? :twitter_user - if page.respond_to? :twitter_user
%h4 @#{page.twitter_user} %h4 Twitter <a class="small" href="http://twitter.com/#{page.twitter_user}">@#{page.twitter_user}</a>
#twitter #twitter
#twitter_status %ul#twitter_status
Status updating... Status updating...
#footer #footer
.page_width .page_width

View File

@ -6,8 +6,15 @@
// PrettyDate by John Resig at http://ejohn.org/files/pretty.js // PrettyDate by John Resig at http://ejohn.org/files/pretty.js
// //
var tweet_tag = 'p'; /*
var twitter_div = 'twitter_status'; Plugin: Octopress Twitter Feed
Author: Brandon Mathis
Website: http://brandonmathis.com
Date: 11/07/2009
*/
var tweet_container = 'li';
var twitter_container = 'twitter_status';
window.addEvent('domready',function() { window.addEvent('domready',function() {
getTwitterStatus(twitter_user); getTwitterStatus(twitter_user);
@ -17,11 +24,13 @@ function showTweets(the_tweets, from_cookie){
if(from_cookie){ if(from_cookie){
the_tweets = the_tweets.split('^!^!^!^!^'); the_tweets = the_tweets.split('^!^!^!^!^');
} }
$(twitter_div).set('html', ''); $(twitter_container).set('html', '');
the_tweets.each(function(tweet){ the_tweets.each(function(tweet){
new Element(tweet_tag,{ tweet = parseTweetDate(tweet)
html: parseTweetDate(tweet) tweet = '<p>' + tweet.replace(/\n\n/gi,'</p><p>') + '</p>';
}).inject(twitter_div); new Element(tweet_container,{
html: tweet
}).inject(twitter_container);
}); });
} }
@ -52,7 +61,7 @@ function prettyDate(time){
function getTwitterStatus(twitter_name){ function getTwitterStatus(twitter_name){
var tweet_cookie = 'tweets_by_' + twitter_name + tweet_count; var tweet_cookie = 'tweets_by_' + twitter_name + tweet_count;
$(twitter_div).set('html', 'Fetching tweets...'); $(twitter_container).set('html', 'Fetching tweets...');
if(!Cookie.read(tweet_cookie)) { if(!Cookie.read(tweet_cookie)) {
var myTwitterGitter = new TwitterGitter(twitter_name,{ var myTwitterGitter = new TwitterGitter(twitter_name,{
count: ((show_replies) ? tweet_count : 15 + tweet_count), count: ((show_replies) ? tweet_count : 15 + tweet_count),
@ -61,8 +70,6 @@ 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;
tweet.text = tweet.text.replace(/\n/gi, '<br/>');
console.log(tweet);
the_tweets.push(tweet.text + '-!-!-!-' + tweet.created_at); the_tweets.push(tweet.text + '-!-!-!-' + tweet.created_at);
} }
}); });

View File

@ -1,2 +1,3 @@
@import partials/twitter.sass @import partials/twitter.sass
@import partials/search.sass @import partials/search.sass
@import partials/sidebar.sass

View File

@ -4,13 +4,18 @@
background: #f8f8f8 background: #f8f8f8
border: 1px solid #eee border: 1px solid #eee
padding: 5px 0 padding: 5px 0
p ul
list-style-type: none
margin: 0
li
margin: 0 15px margin: 0 15px
padding: 12px 0 padding: 10px 0 0
border-bottom: #ddd 1px dashed border-bottom: #ddd 1px dashed
line-height: 1.625em line-height: 1.625em
&:last-child &:last-child
border-bottom: 0 border-bottom: 0
p
padding-bottom: 10px
.pubdate .pubdate
color= !light_text color= !light_text
font-size: 80% font-size: 80%