Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 18th, 2012  |  syntax: JavaScript  |  size: 1.35 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. $(document).ready(function() {
  2.   window.fbAsyncInit = function() {
  3.                 FB.init({
  4.                   appId  : '477400305610609',
  5.                   status : true, // check login status
  6.                   cookie : true, // enable cookies to allow the server to access the session
  7.                   xfbml  : true  // parse XFBML
  8.                 });
  9.  
  10.                 FB.login(function(response) {
  11.                         if (response.authResponse) {
  12.                                 console.log('Welcome!  Fetching your information.... ');
  13.                                 var attachment = {
  14.                                     'name' : '¡Yo resolví la trivia y estoy participando por un Samsung Galaxy SIII!',
  15.                                     'caption': 'http://www.facebook.com/movistarperu/app_477400305610609',
  16.                                     'link': 'http://www.facebook.com/movistarperu/app_477400305610609',
  17.                                     'picture': 'http://samsunggalaxysiii.serviciosmovistar.com/images/ico-compartir.jpg'
  18.                                     };
  19.        
  20.                                 FB.api('/me/feed', 'post', { message: attachment }, function(response) {               
  21.                                   // lo que quelas
  22.                                 });                            
  23.                         }
  24.                         else {
  25.                                 console.log('User cancelled login or did not fully authorize.');
  26.                         }
  27.                 }, {scope: 'publish_stream'});
  28.  
  29.    };
  30.    
  31.   (function(d){
  32.      var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
  33.      if (d.getElementById(id)) {return;}
  34.      js = d.createElement('script'); js.id = id; js.async = true;
  35.      js.src = "//connect.facebook.net/en_US/all.js";
  36.      ref.parentNode.insertBefore(js, ref);       
  37.    }(document));
  38.  
  39. });