Skip to content

Instantly share code, notes, and snippets.

@first65
Created June 13, 2011 09:52
Show Gist options
  • Save first65/1022546 to your computer and use it in GitHub Desktop.
Save first65/1022546 to your computer and use it in GitHub Desktop.
$(document).ready ->
$("#fb-root").append('<script type="text/javascript" src="'+ document.location.protocol +'//connect.facebook.net/en_GB/all.js" async="true"></script>')
window.fbAsyncInit = () ->
FB.init({appId: '172659579460514', status: true, cookie: true, xfbml: true})
FB.Event.subscribe('auth.login', (response) ->
FB.api('/me', (response) ->
$authorId = response.id
$authorName = response.name
FB.Event.subscribe('auth.logout', (response) ->
$authorId = ""
$authorName = ""
FB.getLoginStatus (response) ->
if(response.session)
FB.api '/me', ->
$authorId = response.id
$authorName = response.name
else
$authorId = ""
$authorName = ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment