Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Include the JavaScript and CSS that work with Blackbird.py to style t…

…he embedded tweet.
  • Loading branch information...
commit ad14bbdb1824128fa25f3af2ae23ae88a7deea43 1 parent 3486898
@drdrang authored
Showing with 69 additions and 0 deletions.
  1. +19 −0 styleTweets.js
  2. +50 −0 tweet.css
View
19 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>' );
+ });
+ });
+}
View
50 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;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.