Sha256: f73e02fc24467c7381ac94050c2e017b532ec7e2dc276d56577d54e114618459

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
  FB.init({ appId: '151745734845074', 
	    status: true, 
	    cookie: true,
	    xfbml: true,
	    oauth: true});


  function manageStatus(response) {
	if (response.status === 'connected') {
	    // the user is logged in and connected to your
	    // app, and response.authResponse supplies
	    // the user's ID, a valid access token, a signed
	    // request, and the time the access token 
	    // and signed request each expire
	    var accessToken = response.authResponse.accessToken;
		var expiration = response.authResponse.expiresIn;
		window.location="<%=FB_CALLBACK_URL%>" + "?token=" + accessToken + "&expiration=" + expiration;
	  } else if (response.status === 'not_authorized') {
	    // the user is logged in to Facebook, 
	    //but not connected to the app
	  } else {
	    // the user isn't even logged in to Facebook.
	  }	
  };

  // run once with current status and whenever the status changes
  FB.getLoginStatus(manageStatus);
  FB.Event.subscribe('auth.statusChange', manageStatus);	
  FB.Event.subscribe('auth.logout', function(response){	window.location="<%=FB_CLOSED_URL%>"; });	
};

//Load the FB JS SDK	
(function() {
  var e = document.createElement('script'); e.async = true;
  e.src = document.location.protocol 
    + '//connect.facebook.net/en_US/all.js';
  document.getElementById('fb-root').appendChild(e);
}());

</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fbdoorman-0.8.0.95 app/views/facebook/_fbjs.html.erb