Skip to content

Instantly share code, notes, and snippets.

@kevin-shu
Last active December 18, 2015 20:29
Show Gist options
  • Save kevin-shu/5840775 to your computer and use it in GitHub Desktop.
Save kevin-shu/5840775 to your computer and use it in GitHub Desktop.
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '313930528750470', // App ID from the app dashboard
channelUrl : 'http://runway.tw/luckdraw/index.html', // Channel file for x-domain comms
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
FB.login(function(response) {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
});
} else {
console.log('User cancelled login or did not fully authorize.');
}
});
FB.api( '/me', function(user) {
alert(user.name);
});
FB.api('/me/likes/583599621680278',function(response) {
if( response.data ) {
if( !isEmpty(response.data) )
alert('You are a fan!');
else
alert('Not a fan!');
} else {
alert('ERROR!');
}
});
// Additional initialization code such as adding Event Listeners goes here
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment