Skip to content

Instantly share code, notes, and snippets.

@dancsiqueira
Last active December 21, 2015 19:19
Show Gist options
  • Select an option

  • Save dancsiqueira/6353271 to your computer and use it in GitHub Desktop.

Select an option

Save dancsiqueira/6353271 to your computer and use it in GitHub Desktop.
Facebook Script
class window.Facebook
_self = this
@shareCount: (url) ->
if url != ''
query = "http://api.facebook.com/method/fql.query?format=json&query=SELECT share_count from link_stat WHERE url ='#{ url }'"
$.ajax
url: query
dataType: 'jsonp'
success: (data) ->
$(_self).trigger('shareCountResponse', data[0].share_count)
error: (xhr, textStatus, errorThrown) ->
$(_self).trigger('shareCountResponse', false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment