Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created April 12, 2012 20:07
Show Gist options
  • Select an option

  • Save thinkphp/2370626 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/2370626 to your computer and use it in GitHub Desktop.
my-mentors-twitter-domready
window.addEvent('domready', function(){
var url = "select * from twitter.user.status where screen_name=#{username} and count=@count",
linkify = function( str ) {
return str.replace(/(https?:\/\/[\w\-:;?&=+.%#\/]+)/gi, '<a href="$1">$1</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1#<a href="http://search.twitter.com/search?q=%23$2">$2</a>')
}
Object.each(mentors, function(realname, username){
new Request.YQL(url, {
onSuccess: function( data ){
var tweets = data.query.results.status;
new Element('h2',{text: realname}).inject( username )
tweets.each(function( object ){
new Element('div',{
html: '<img src="' + object.user.profile_image_url + '" align="left" alt="photo_profile" /> <strong>'+ object.user.name +'</strong><br/>'+
linkify(object.text) + '<br/><span>' + object.created_at + ' via ' + object.source.replace('\\','') + '</span>',
'class': 'tweet clear'
}).inject(username);
})
}},
{username: username, count: '7'}
).send()
})
$('control').getElement('a').addEvent('click', function( e ){
e.stop();
new MooDialog.Request('commands.php', null, {
size: {
width: 500,
height: 300
},
title: 'Add/Update/Delete a User Twitter from List'
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment