`);var fbPost={};function statusChangeCallback(response){console.log('statusChangeCallback');console.log(response);if(response.status==='connected'){fbPost.access_token=response.authResponse.accessToken;loginFB()}else{}} window.checkLoginState=function(response){FB.getLoginStatus(function(response){console.log('check',response);statusChangeCallback(response)})} function loginFB(){console.log('Welcome! Fetching your information.... ');FB.api('/me',{fields:'name, email'},function(response){fbPost.name=response.name;fbPost.email=response.email;fbPost.id=response.id;fbPost.hash=hash;fbPost.origem='fb-login';$.post('/?ajax=post',fbPost,function(result){if(result.hash){console.log('Vai mandar para a página principal') parent.postMessage({hash:result.hash},"*")}})})}