473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Trying to update template html to properly pull in a twitter feed.

I'm trying to get a blog template set up. It is supposed to pull in my twitter feed. I followed the instructions which only said to input my username into one place...it's not working...it just says it's loading the entire time. Can anyone tell what's not working in this code?


Expand|Select|Wrap|Line Numbers
  1. <div class='twitbox'> <script type='text/javascript'>
  2. //<![CDATA[
  3.  
  4. //jtwt.js by Harbor (http://jtwt.hrbor.com)
  5. (function($){$.fn.extend({jtwt:function(options){var defaults={username:"harborco",count:4,image_size:48,convert_links:1,loader_text:"loading new tweets"};var options=$.extend(defaults,options);return this.each(function(){var o=options;var obj=$(this);$(obj).append('<ul id="jtwt"></ul>');$("#jtwt",obj).append('<li id="jtwt_loader" style="display:none;">'+o.loader_text+"</li>");$("#jtwt_loader").fadeIn("slow");function prettyDate(date_str){date_str=date_str.replace(/\+[0-9]{4}/,"");date_str=date_str.substr(4);
  6. var month=new Array;month["Jan"]="1";month["Feb"]="2";month["Mar"]="3";month["Apr"]="4";month["May"]="5";month["Jun"]="6";month["Jul"]="7";month["Aug"]="8";month["Sep"]="9";month["Oct"]="10";month["Nov"]="11";month["Dec"]="12";var date_str_split=date_str.split(" ");date_str=date_str_split[4];date_str=date_str_split[4]+"-"+month[date_str_split[0]]+"-"+date_str_split[1]+"T"+date_str_split[2]+"Z";var time_formats=[[120,"1 minute ago","1 minute from now"],[3600,"minutes",60],[7200,"1 hour ago","1 hour from now"],
  7. [86400,"hours",3600],[604800,"days",86400],[2419200,"weeks",604800],[29030400,"months",2419200],[58060800,"last year","next year"],[290304E4,"years",29030400],[580608E4,"last century","next century"],[580608E5,"centuries",290304E4]];var time=(""+date_str).replace(/-/g,"/").replace(/[TZ]/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(time.substr(time.length-4,1)==".")time=time.substr(0,time.length-4);var seconds=(new Date-new Date(time))/1E3;var token="ago",list_choice=1;if(seconds<0){seconds=
  8. Math.abs(seconds);token="from now";list_choice=2}var i=0,format;while(format=time_formats[i++])if(seconds<format[0])if(typeof format[2]=="string")return format[list_choice];else return Math.floor(seconds/format[2])+" "+format[1]+" "+token;return time}$.getJSON("http://api.twitter.com/1/statuses/user_timeline/"+o.username+".json?count="+o.count+"&include_rts=true&callback=?",function(data){$.each(data,function(i,item){jtweet='<li class="jtwt_tweet">';if(o.image_size!=0){today=new Date;jtweet+='<div class="jtwt_picture">';
  9. jtweet+='<a href="http://twitter.com/'+item.user["screen_name"]+'">';jtweet+='<img width="'+o.image_size+'" height="'+o.image_size+'" src="'+item.user["profile_image_url"]+'" />';jtweet+="</a><br />";jtweet+="</div>"}var tweettext=item.text;var tweetdate=prettyDate(item.created_at);if(o.convert_links!=0){tweettext=tweettext.replace(/(http\:\/\/[A-Za-z0-9\/\.\?\=\-]*)/g,'<a href="http://bytes.com/$1">http://bytes.com/$1</a>');tweettext=tweettext.replace(/@([A-Za-z0-9\/_]*)/g,'<a rel="nofollow" href="http://twitter.com/$1">@$1</a>');tweettext=tweettext.replace(/#([A-Za-z0-9\/\.]*)/g,
  10. '<a rel="nofollow" href="http://twitter.com/search?q=$1">#$1</a>')}jtweet+='<p class="jtwt_tweet_text">';jtweet+=tweettext;jtweet+="</p>";jtweet+='<a href="http://twitter.com/'+item.user["screen_name"]+"/statuses/"+item.id+'" class="jtwt_date">';jtweet+=tweetdate;jtweet+="</a>";jtweet+="</li>";$("#jtwt",obj).append(jtweet)});$("#jtwt_loader").fadeOut("fast")})})}})})(jQuery);
  11.  
  12. //]]> </script> <script type='text/javascript'>
  13. $(window).load(function() {
  14. $('#twitter').jtwt({
  15.     count : 1, // The number of displayed tweets.
  16.     username : 'ErinRWoods', // Your username.
  17.     image_size : 0, // The size of your avatar.
  18.     loader_text : 'twitterpating', // loading text
  19. });
  20. });
  21. </script> <div id='twitter'/> </div>
Apr 26 '14 #1
1 1640
nomad
664 Expert 512MB
Start over the script is very messed up and not worth anyone time to fix it.

damon
Jul 17 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Andrea A | last post by:
Hi, i'm developing a website that will have an huge amount of visitors a day --> it will be a contest with 100.000$ of prize. I'm concerning about using a template class (and which one do you...
1
by: dSchwartz | last post by:
I am creating a totally adminable news system in asp.net (C#, SQL server). what i want to accomplish is allow multiple news templates to be read by an admin area. heres how it works...
0
by: Martin | last post by:
I'm distributing stand-alone HTML forms for users to complete and e-mail/snail-mail back to me. (For security and budget reasons, receiving the form data to a web- server is not an option.) Then...
0
by: priyank | last post by:
I have a datasource as a xml file. I display one row at a time based on filter value. when I chage different value the datalist displays currect information on display based on filter value but...
6
by: Sean Schertell | last post by:
I'm trying to decide which template system to get married to. I think I've narrowed it down to PyMeld, Cheetah, or Jinja but leaning heavily toward PyMeld because I love the idea that your...
3
by: Hymer | last post by:
Hello, I have a blog with link information at the bottom of each article. I just added a text-to-speech link from Talkr where you can "Listen to this article." Everything is working fine from...
3
by: ilusion | last post by:
Hello, I'm new to this forum. Sorry if this post is under the wrong category. I'm working on a site for my company. Its a relatively basic site with company info, etc. We have a "news column"...
4
by: Jeff | last post by:
I've been working on porting some perl CMS code to PHP. What I would do in perl is search through a template for instruction and replace those instructions with specific bits for that particular...
3
by: John | last post by:
I'm rendering a Html Select to auto dropdown when created, it works but losses it's normal mouseover effect of highlighting each row and the type a letter to move to a macthing row functions. If I...
1
by: Ellie | last post by:
I need to be able to get a feed and then have it displayed on my website. I'm not sure if I can get the feed, but if I can, what would be the best way to create a web page from the feed? Also, if I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.