Permalink
Browse files

Merge pull request #8 from Snakiej/master

Use the options.tweets
  • Loading branch information...
spacecowb0y committed Jan 7, 2013
2 parents 73d92d5 + f440d8d commit da48b12dbec4e5a8888dab429105fef93aae0530
Showing with 21 additions and 21 deletions.
  1. +21 −21 js/jquery.tweets.0.1.js
View
@@ -25,25 +25,25 @@
*
*/
(function($){
- $.fn.tweets = function(options) {
- $.ajaxSetup({ cache: true });
- var defaults = {
- tweets: 5,
- before: "<li>",
- after: "</li>"
- };
- var options = $.extend(defaults, options);
- return this.each(function() {
- var obj = $(this);
- $.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?callback=?&screen_name='+options.username,
- function(data) {
- $.each(data, function(i, tweet) {
- if(tweet.text !== undefined) {
- $(obj).append(options.before+tweet.text+options.after);
- }
- });
- }
- );
- });
- };
+ $.fn.tweets = function(options) {
+ $.ajaxSetup({ cache: true });
+ var defaults = {
+ tweets: 5,
+ before: "<li>",
+ after: "</li>"
+ };
+ var optionsWithDefaults = $.extend(defaults, options);
+ return this.each(function() {
+ var obj = $(this);
+ $.getJSON('http://api.twitter.com/1/statuses/user_timeline.json?callback=?&screen_name='+optionsWithDefaults.username+'&count=' + optionsWithDefaults.tweets,
+ function(data) {
+ $.each(data, function(i, tweet) {
+ if(tweet.text !== undefined) {
+ $(obj).append(optionsWithDefaults.before+tweet.text+optionsWithDefaults.after);
+ }
+ });
+ }
+ );
+ });
+ };
})(jQuery);

0 comments on commit da48b12

Please sign in to comment.