/*Name : TweeCool *version: 1.8 *Description: Get the latest tweets from twitter. *Website: www.tweecool.com *Licence: No licence, feel free to do whatever you want. *Author: TweeCool */ (function($) { $.fn.extend({ tweecool : function(options) { var defaults = { username : 'envato', limit : 1, profile_image : true, show_time : true, show_media : false, show_media_size: 'thumb', //values: small, large, thumb, medium show_actions: false, action_reply_icon: '↵', action_retweet_icon: '∝', action_favorite_icon: '★', profile_img_url: 'profile', //Values: profile, tweet show_retweeted_text: false //This will show the original tweet in order to avoid any truncated text, and also the "RT @tweecool:" is removed which helps with 140 character limit } var options = $.extend(defaults, options); function xTimeAgo(time) { var nd = new Date(); //var gmtDate = Date.UTC(nd.getFullYear(), nd.getMonth(), nd.getDate(), nd.getHours(), nd.getMinutes(), nd.getMilliseconds()); var gmtDate = Date.parse(nd); var tweetedTime = time * 1000; //convert seconds to milliseconds var timeDiff = (gmtDate - tweetedTime) / 1000; //convert milliseconds to seconds var second = 1, minute = 60, hour = 60 * 60, day = 60 * 60 * 24, week = 60 * 60 * 24 * 7, month = 60 * 60 * 24 * 30, year = 60 * 60 * 24 * 365; if (timeDiff > second && timeDiff < minute) { return Math.round(timeDiff / second) + " second"+(Math.round(timeDiff / second) > 1?'s':'')+" ago"; } else if (timeDiff >= minute && timeDiff < hour) { return Math.round(timeDiff / minute) + " minute"+(Math.round(timeDiff / minute) > 1?'s':'')+" ago"; } else if (timeDiff >= hour && timeDiff < day) { return Math.round(timeDiff / hour) + " hour"+(Math.round(timeDiff / hour) > 1?'s':'' )+" ago"; } else if (timeDiff >= day && timeDiff < week) { return Math.round(timeDiff / day) + " day"+(Math.round(timeDiff / day) > 1 ?'s':'')+" ago"; } else if (timeDiff >= week && timeDiff < month) { return Math.round(timeDiff / week) + " week"+(Math.round(timeDiff / week) > 1?'s':'')+" ago"; } else if (timeDiff >= month && timeDiff < year) { return Math.round(timeDiff / month) + " month"+(Math.round(timeDiff / month) > 1 ?'s':'')+" ago"; } else { return 'over a year ago'; } } return this.each(function() { var o = options; var wrapper = $(this); var wInner = $('