Last active
December 21, 2015 19:19
-
-
Save dancsiqueira/6353271 to your computer and use it in GitHub Desktop.
Facebook Script
This file contains hidden or 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
| 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