Skip to content

Instantly share code, notes, and snippets.

@danhigham
Forked from first65/gist:1022546
Created June 13, 2011 10:00
Show Gist options
  • Save danhigham/1022554 to your computer and use it in GitHub Desktop.
Save danhigham/1022554 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