aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB Mathis <brandon@imathis.com>2009-11-06 11:04:12 -0600
committerB Mathis <brandon@imathis.com>2009-11-06 11:04:12 -0600
commitd2a23f60e98966335ba1939c570a7e020084607d (patch)
treee25d9939ff82d2bc402576863d5f7b734856a9a6
parente062eaa7a4d550a8cba1f772cd2a20f561c411b4 (diff)
downloadmy_new_personal_website-d2a23f60e98966335ba1939c570a7e020084607d.tar.xz
my_new_personal_website-d2a23f60e98966335ba1939c570a7e020084607d.zip
now twitter handles linking better, and replaces endlines with <br> tags
Diffstat (limited to '')
-rw-r--r--source/javascripts/twitter.js17
-rw-r--r--source/javascripts/twitter_gitter.js6
-rw-r--r--stylesheets/partials/_twitter.sass16
3 files changed, 19 insertions, 20 deletions
diff --git a/source/javascripts/twitter.js b/source/javascripts/twitter.js
index b78b8de1..d698cf90 100644
--- a/source/javascripts/twitter.js
+++ b/source/javascripts/twitter.js
@@ -10,6 +10,7 @@ var filter_mentions = true;
var tweet_count = 5;
var tweet_tag = 'p';
var twitter_div = 'twitter_status';
+var tweet_cookie = 'the_tweets_' + username;
window.addEvent('domready',function() {
getTwitterStatus();
@@ -29,7 +30,7 @@ function showTweets(the_tweets, from_cookie){
function getTwitterStatus(){
$(twitter_div).set('html', 'Fetching tweets...');
- if(!Cookie.read('the_tweets')) {
+ if(!Cookie.read(tweet_cookie)) {
var myTwitterGitter = new TwitterGitter(username,{
count: ((!filter_mentions) ? tweet_count : 15 + tweet_count),
onComplete: function(tweets,user) {
@@ -37,21 +38,15 @@ function getTwitterStatus(){
tweets.each(function(tweet,i) {
if((tweet.in_reply_to_status_id && !filter_mentions) || !tweet.in_reply_to_status_id){
if(the_tweets.length == tweet_count) return;
+ tweet.text = tweet.text.replace(/\n/gi, '<br/>');
the_tweets.push(tweet.text);
}
});
- Cookie.write('the_tweets',the_tweets.join('^!^!^!^!^'), { duration: 1 });
+ Cookie.write(tweet_cookie,the_tweets.join('^!^!^!^!^'), { duration: 1 });
showTweets(the_tweets);
}
}).retrieve();
} else {
- showTweets(Cookie.read('the_tweets'),true);
+ showTweets(Cookie.read(tweet_cookie),true);
}
-}
-
-//implement string.tweetify();
-String.implement({
- tweetify: function() {
- return this.replace(/(https?:\/\/\S+)/gi,'<a href="$1">$1</a>').replace(/(^|\s)@(\w+)/g,'$1<a href="http://twitter.com/$2">@$2</a>').replace(/(^|\s)#(\w+)/g,'$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
- }
-}); \ No newline at end of file
+} \ No newline at end of file
diff --git a/source/javascripts/twitter_gitter.js b/source/javascripts/twitter_gitter.js
index 788883f2..fea8e6ba 100644
--- a/source/javascripts/twitter_gitter.js
+++ b/source/javascripts/twitter_gitter.js
@@ -50,8 +50,8 @@ var TwitterGitter = new Class({
//format
linkify: function(text) {
//courtesy of Jeremy Parrish (rrish.org)
- return text.replace(/(https?:\/\/\S+)/gi,'<a href="$1">$1</a>').replace(/(^|\s)@(\w+)/g,'$1<a href="http://twitter.com/$2">@$2</a>').replace(/(^|\s)#(\w+)/g,'$1#<a href="http://search.twitter.com/search?q=%23$2">$2</a>');
+ return text.replace(/(https?:\/\/\S+)/gi,'<a href="$1">$1</a>').replace(/(^|\s)@(\w+)/g,'$1<a href="http://twitter.com/$2">@$2</a>').replace(/(^|\s)#(\w+)/g,'$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
}
});
-
-
+
+
diff --git a/stylesheets/partials/_twitter.sass b/stylesheets/partials/_twitter.sass
index 7cac8b3c..341c7535 100644
--- a/stylesheets/partials/_twitter.sass
+++ b/stylesheets/partials/_twitter.sass
@@ -1,8 +1,12 @@
#twitter
- font-size: 85%
+ font-size: 80%
+ +border-radius
+ background: #f3f3f3
+ padding: 5px 0
p
- +border-radius
- padding: 10px 15px
- margin-bottom: 15px
- background: #eee
- line-height: 1.625em \ No newline at end of file
+ margin: 0 15px
+ padding: 12px 0
+ border-bottom: #ddd 1px dotted
+ line-height: 1.625em
+ &:last-child
+ border-bottom: 0 \ No newline at end of file