Skip to content

Commit

Permalink
Include the JavaScript and CSS that work with Blackbird.py to style t…
Browse files Browse the repository at this point in the history
…he embedded tweet.
  • Loading branch information
drdrang committed Jan 13, 2012
1 parent 3486898 commit ad14bbd
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
19 changes: 19 additions & 0 deletions styleTweets.js
@@ -0,0 +1,19 @@
// This script requires jQuery.
$(document).ready(function() {
styleTweets();
});

function styleTweets() {
$(".bbpBox").each( function(i) {
var divID = $(this).attr("id");
var tweetID = divID.slice(1);
var tweetURL = 'http://api.twitter.com/1/statuses/show/' + tweetID + '.json?callback=?';
$.getJSON(tweetURL, function(data){
var twDate = new Date(data.created_at);
var shortdate = twDate.toDateString();
$("#" + divID).css('background', 'url(' + data.user.profile_background_image_url + ') #' + data.user.profile_background_color);
$("#" + divID + " .twMeta").css('display', 'none');
content = $("#" + divID + " .twContent").append('<p class="twDate"><a href="http://twitter.com/' + data.user.screen_name + '/' + tweetID + '">' + shortdate + '</a></p><p class="twAuthor"><a href="http://twitter.com/' + data.user.screen_name + '"><img src="' + data.user.profile_image_url + '" /></a><a href="http://twitter.com/' + data.user.screen_name + '"><strong>@' + data.user.screen_name + '</strong></a><br /><span class="realName">' + data.user.name + '</span></span></p>' );
});
});
}
50 changes: 50 additions & 0 deletions tweet.css
@@ -0,0 +1,50 @@
#content .bbpBox {
width: 75%;
background: #F3FEF3;
margin-left: auto;
margin-right: auto;
padding: 1em;
}

#content .bbpBox blockquote {
font-size: 110%;
background-color: white;
margin: 0em !important;
padding: .5em 1em .5em 1em;
-moz-border-radius: 5px;
-webkit-border-radius: 5px
}

#content .bbpBox blockquote a {
color: blue;
text-decoration: none;
}

#content .bbpBox blockquote a:hover {
text-decoration: underline;
}

#content .bbpBox blockquote .twMeta {
font-size: 80%;
}

#content .bbpBox blockquote .twAuthor {
font-family: Sans-serif;
font-size: 80%;
color: #aaa;
margin-top: 0em;
padding-top: .75em;
border-top: solid 1px #aaa;
}

#content .bbpBox blockquote .twDate {
font-family: Sans-serif;
font-size: 60%;
text-align: right;
}

#content .bbpBox blockquote .twAuthor img {
float: left;
margin-right: .5em;
height: 2.5em;
}

0 comments on commit ad14bbd

Please sign in to comment.