Created
April 12, 2012 20:07
-
-
Save thinkphp/2370626 to your computer and use it in GitHub Desktop.
my-mentors-twitter-domready
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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