Create a gist now

Instantly share code, notes, and snippets.

@singalen /my.js Secret
Created Jul 6, 2012

What would you like to do?
Facebook connect code
window.fbAsyncInit = function () {
// Attach event handlers for Facebook operations:
$('[data-facebook="login"]').click($.proxy(Foobar.Social.Facebook.toggleConnection, Foobar.Social.Facebook));
$('[data-facebook="logout"]').click($.proxy(Foobar.Social.Facebook.toggleConnection, Foobar.Social.Facebook));
// Trigger FB loaded state:
appId : window.fbAppId, // App ID
// channelUrl : 'http://localhost:8080/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
// Subscribe to Facebook events:
FB.Event.subscribe('auth.statusChange', Foobar.Social.Facebook.onStatusChange);
// Load the SDK asynchronously:
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); = id;
js.src = "//";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
<div id="social">
<div class="fb-like" data-href="{{ url('fd') }}" data-send="false"
data-layout="button_count" data-show-faces="false"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment