Tweet2


$(document).ready(function () { var displaylimit = 3; var twitterprofile = "tomwebdev"; var screenname = "Tom Elliott"; var showdirecttweets = false; var showretweets = true; var showtweetlinks = true; var showprofilepic = true; var headerHTML = ''; var loadingHTML = ''; headerHTML += 'twitter bird'; headerHTML += '

'+screenname+' @'+twitterprofile+'

'; loadingHTML += '
tweet loader
'; $('#twitter-feed').html(headerHTML + loadingHTML); $.getJSON('http://www.webdevdoor.com/demos/jquery-twitter-feed/get-tweets1.1.php', function(feeds) { //alert(feeds); var feedHTML = ''; var displayCounter = 1; for (var i=0; i 1) && (displayCounter <= displaylimit)) { if (showtweetlinks == true) { status = addlinks(status); } if (displayCounter == 1) { feedHTML += headerHTML; } feedHTML += ''; displayCounter++; } } } $('#twitter-feed').html(feedHTML); }); //Function modified from Stack Overflow function addlinks(data) { //Add link to all http:// links within tweets data = data.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) { return ''+url+''; }); //Add link to @usernames used within tweets data = data.replace(/\B@([_a-z0-9]+)/ig, function(reply) { return ''+reply.charAt(0)+reply.substring(1)+''; }); return data; } function relative_time(time_value) { var values = time_value.split(" "); time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3]; var parsed_date = Date.parse(time_value); var relative_to = (arguments.length > 1) ? arguments[1] : new Date(); var delta = parseInt((relative_to.getTime() - parsed_date) / 1000); var shortdate = time_value.substr(4,2) + " " + time_value.substr(0,3); delta = delta + (relative_to.getTimezoneOffset() * 60); if (delta < 60) { return '1m'; } else if(delta < 120) { return '1m'; } else if(delta < (60*60)) { return (parseInt(delta / 60)).toString() + 'm'; } else if(delta < (120*60)) { return '1h'; } else if(delta < (24*60*60)) { return (parseInt(delta / 3600)).toString() + 'h'; } else if(delta < (48*60*60)) { //return '1 day'; return shortdate; } else { return shortdate; } } });

http://skins.ow2.org/skins/skinOW2/images/Featuredvideo.png
  • Pierre Levy, City of Paris
http://skins.ow2.org/skins/skinOW2/images/watchallvideos.png

 


This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4.4 - Documentation
Powered by XWiki Hosted by Xsalto Free PageRank Checker Creative Commons 2.0 license Legal Notice