Skip to content

Instantly share code, notes, and snippets.

@mach3
Created May 7, 2011 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mach3/960347 to your computer and use it in GitHub Desktop.
Save mach3/960347 to your computer and use it in GitHub Desktop.
@anywhereでフォローまわりを。
twttr.anywhere( function(tw){
var id_str, followMe;
id_str = "XXXXXXXXX";
followMe = function(){
if( !tw.isConnected() ){
tw.bind( "authComplete", followMe );
tw.signIn();
return;
}
tw.currentUser.isFollowing( id_str, function( f ){
if( f ){
alert( "もう既にフォローしています" );
} else {
if( confirm( "本当にフォローしちゃっていいですか?" ) ){
( new tw.User({ id:id_str }) ).follow(function(){
alert( "フォローしました" );
});
}
}
});
};
$("#followme").click( followMe );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment