Skip to content

Instantly share code, notes, and snippets.

@axwax
Created October 19, 2012 11:26
Show Gist options
  • Save axwax/3917707 to your computer and use it in GitHub Desktop.
Save axwax/3917707 to your computer and use it in GitHub Desktop.
xtreme-theme 1.5.2 updated twitter user timeline url
/**
* Xtreme One
*
* @copyright Copyright 2010-2012, dynamicinternet GmbH
* @license see http://xtreme-theme.com/licence/
* @link http://xtreme-theme.com
* @package xtreme-one
**/
(function(b){b.fn.extend({xtremeTweets:function(c){var d={username:"",showAvatar:false,showUsername:false,showFollower:false,numberTweets:5,avatarSize:40};this.options=b.extend(d,c);var e=this;return this.each(function(){var f=b(this);var g="";b('<ul class="xtreme-tweets"><li class="preLoader">'+xtreme_last_tweets.l10n.loading+"</li></ul>").appendTo(f);b.ajax({type:"GET",url:"https://api.twitter.com/1/statuses/user_timeline.json?screen_name="+e.options.username+"&count="+e.options.numberTweets+"",dataType:"jsonp",error:function(i,j,h){f.find("ul.xtreme-tweets").append("<li>An error occurred "+h+"</li>");},success:function(h){b("li.preLoader").remove();b.each(h,function(l,n){var p=n.created_at;var j=n.text.replace(/((https?|s?ftp|ssh)\:\/\/[^\"\s\<\>]*[^.,;'\">\:\s\<\>\)\]\!])/g,function(i){return'<a href="'+i+'">'+i+"</a>";}).replace(/\B@([_a-z0-9]+)/ig,function(i){return i.charAt(0)+'<a href="http://twitter.com/'+i.substring(1)+'">'+i.substring(1)+"</a>";});var m="";var k="";var o="";if(l==0){if(e.options.showFollower){m='<span class="follower">'+n.user.followers_count+" "+xtreme_last_tweets.l10n.followers+"</span>";}if(e.options.showAvatar){k='<span class="avatar"><img src="'+n.user.profile_image_url+'" width="'+e.options.avatarSize+'" height="'+e.options.avatarSize+'" alt="Avatar '+xtreme_last_tweets.l10n.of+" "+n.user.name+'" /></span>';}if(e.options.showUsername){o='<span class="username"><a href="http://twitter.com/'+n.user.screen_name+'" title="'+xtreme_last_tweets.l10n.follow_me+'">@'+n.user.screen_name+"</a></span>";}if(e.options.showFollower||e.options.showAvatar||e.options.showUsername){g+='<li class="tweet_header">'+k+o+m+"</li>";}}g+='<li><span class="tweet">'+j+'</span><span class="tweet-date">'+a(p)+"</span></li>";});f.find(".xtreme-tweets").append(g);}});});}});function a(g){var d=g.split(" ");time_value=d[1]+" "+d[2]+", "+d[5]+" "+d[3];var c=Date.parse(time_value);var e=(arguments.length>1)?arguments[1]:new Date();var f=parseInt((e.getTime()-c)/1000);f=f+(e.getTimezoneOffset()*60);if(f<60){return xtreme_last_tweets.l10n.less_a_min;}else{if(f<120){return xtreme_last_tweets.l10n.about_a_min;}else{if(f<(60*60)){return(parseInt(f/60)).toString()+" "+xtreme_last_tweets.l10n.mins_ago;}else{if(f<(120*60)){return xtreme_last_tweets.l10n.hour_ago;}else{if(f<(24*60*60)){return xtreme_last_tweets.l10n.about+" "+(parseInt(f/3600)).toString()+" "+xtreme_last_tweets.l10n.hours_ago;}else{if(f<(48*60*60)){return xtreme_last_tweets.l10n.one_day_ago;}else{return(parseInt(f/86400)).toString()+" "+xtreme_last_tweets.l10n.days_ago;}}}}}}}})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment