Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. window.fbAsyncInit = function () {
  2. FB.init({
  3. appId : "xxxx",
  4. status : true,
  5. cookie : true,
  6. xfbml : true,
  7. oauth : true
  8. });
  9. FB.Canvas.setSize({width:$("#mainbody").outerWidth(),height:$("#mainbody").outerHeight()});
  10. FB.getLoginStatus(function (response) {
  11. if(response.authResponse){
  12. if(response.authResponse.userID){
  13. fbId = response.authResponse.userID;
  14. $("#hiddenFbId").val(fbId);
  15. setSession();
  16. }
  17. }
  18. if (response.status === 'connected') {
  19. FB.api(
  20. "/me?locale=et_EE",
  21. function (response) {
  22. if (response && !response.error) {
  23. fbName = response['name'];
  24. fbId = response['id'];
  25. $("#hiddenFbId").val(fbId);
  26. fbEmail = response['email'];
  27. setSession();
  28. }
  29. });
  30. } else {
  31. FB.login(function (response) {
  32. if (response.authResponse) {
  33. if(response.authResponse.userID){
  34. fbId = response.authResponse.userID;
  35. $("#hiddenFbId").val(fbId);
  36. setSession();
  37. }
  38. FB.api(
  39. "/me?locale=et_EE",
  40. function (response) {
  41. if (response && !response.error) {
  42. fbName = response['name'];
  43. fbId = response['id'];
  44. $("#hiddenFbId").val(fbId);
  45. fbEmail = response['email'];
  46. setSession();
  47. }
  48. });
  49. } else {
  50. fbDenied = true;
  51. }
  52. }, {
  53. scope : 'public_profile,email,user_likes'
  54. });
  55. }
  56. });
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement