Sha256: d5d6fd85687fea0dfe304f54aeffe2baa249acd5060e42a808085322a18f5d55

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 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
		<%= if !signed_in? then
	    "var accessToken = response.authResponse.accessToken;
		var expiration = response.authResponse.expiresIn;
		window.location='/facebook' + '?token=' + accessToken + '&expiration=' + expiration;"
		end %>
	  }
  };

  // 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

2 entries across 2 versions & 1 rubygems

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