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

Untitled

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