zono

Untitled

Sep 20th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.19 KB | None | 0 0
  1. <html>
  2.  <head>
  3.  <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
  4.  <script>
  5.  //alert(check_permisssions());
  6.  </script>
  7.  </head>
  8.  
  9.  <body>
  10.  <script type="text/javascript">
  11.  var publish;
  12.  var dfd = $.Deferred();
  13.  
  14.  
  15.  window.fbAsyncInit = function() {
  16.     FB.init({
  17.        appId      : 'xxxxxxxxxxxx',
  18.        xfbml      : true,
  19.        version    : 'v2.1'
  20.     });
  21.  
  22.     FB.getLoginStatus(function(response) {
  23.        FB.api(
  24.           "/me/permissions",
  25.           function (response) {
  26.              if(response && !response.error) {
  27.                var publish = '1';
  28.                 dfd.resolve(publish);
  29.              }
  30.              else {
  31.                 var publish = '0';
  32.                 dfd.reject(publish);
  33.              }
  34.           }
  35.       );
  36.     });
  37.  };
  38.  
  39.  (function(d, s, id){
  40.     var js, fjs = d.getElementsByTagName(s)[0];
  41.     if (d.getElementById(id)) {return;}
  42.     js = d.createElement(s); js.id = id;
  43.     js.src = "//connect.facebook.net/en_US/sdk.js";
  44.     fjs.parentNode.insertBefore(js, fjs);
  45.  }(document, 'script', 'facebook-jssdk'));
  46.  
  47.  dfd.always(function(result) {
  48.      alert(publish);
  49.  })
  50.  </script>
  51.  
  52.  </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment