/* * TweetScroll jQuery Plugin * Author: Pixel Industry * Author URL : http://pixel-industry.com * Version: 1.2 * * jQuery plugin to load latest Twitter tweets. * */ (function ($) { //define the tweetable plugin $.fn.tweetscroll = function (options) { //specify the plugins defauls var defaults = { visible_tweets: 10, //number of tweets to be visible username: 'thinkupthemes', //@username tweets to display. can be multiple usernames e.g. [philipbeel, vmrkela] time: false, //display date replies: false, //filter out @replys date_format: 'style1', color: 'blue', }; //overwrite the defaults var tweetscrollOptions = $.extend({}, defaults, options); // Wordpress widget change tweetscrollOptions['instance_id'] = $(this).attr('data-instance-id'); if(!tweetscrollOptions['instance_id']) tweetscrollOptions['instance_id'] = ""; tweetscrollOptions['action'] = 'thinkup_widget_tweetscroll_ajax'; //loop through each instance return this.each(function (options) { //assign our initial vars var act = $(this); var $allTweets; // Wordpress widget change var requestURL = PiTweetScroll.ajaxrequests; //do a JSON request to twitters API if(jQuery.isArray(tweetscrollOptions.username)){ var numOfUsers = tweetscrollOptions.username.length; var tweetsCount, $tweetList; var restTweets = (tweetscrollOptions.visible_tweets - (Math.floor(tweetscrollOptions.visible_tweets / numOfUsers) * numOfUsers)); var tweetsPerUser = Math.floor(tweetscrollOptions.visible_tweets / numOfUsers); $allTweets = $('