Created
October 16, 2013 14:29
-
-
Save onesup/7008639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.fbAsyncInit = function() { | |
// init the FB JS SDK | |
FB.init({ | |
appId : '<%= FACEBOOK_CONFIG[:app_id] %>', // App ID from the app dashboard | |
channelUrl : '//<%= FACEBOOK_CONFIG[:domain] %>/channel.html', // Channel file for x-domain comms | |
status : true, // check login status | |
cookie : true, // enable cookies to allow the server to access the session | |
xfbml : true // parse XFBML | |
}); | |
FB.getLoginStatus(function(response) { | |
if (response.status === 'connected') { | |
var uid = response.authResponse.userID; | |
var accessToken = response.authResponse.accessToken; | |
} else if (response.status === 'not_authorized') { | |
FB.login(function(response){},{scope: 'email, publish_stream, user_relationship_details'}); | |
} else { | |
} | |
}); | |
FB.Canvas.setSize(); | |
FB.Canvas.setAutoGrow(); | |
FB.Event.subscribe('edge.create', | |
function(href, widget) { | |
location.reload(); | |
} | |
); | |
FB.Event.subscribe('edge.remove', | |
function(href, widget) { | |
location.reload(); | |
} | |
); | |
}; | |
(function(d){ | |
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; | |
if (d.getElementById(id)) {return;} | |
js = d.createElement('script'); js.id = id; js.async = true; | |
js.src = "//connect.facebook.net/en_US/all.js"; | |
ref.parentNode.insertBefore(js, ref); | |
}(document)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment