Created
February 13, 2014 09:20
-
-
Save ademilter/8972161 to your computer and use it in GitHub Desktop.
share & share count
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
// SHARE COUNT | |
$.getJSON("https://graph.facebook.com/fql?q=SELECT like_count FROM link_stat WHERE url=" + encodeURIComponent('"' + Screenshot.Meta.full_url + '"') + " &callback=?", function(t) { | |
t.data[0] && $("#share-button-fb .shot-social-count").html(shorterTotal(t.data[0].like_count)) | |
}) | |
$.getJSON("http://cdn.api.twitter.com/1/urls/count.json?url=" + encodeURIComponent(Screenshot.Meta.full_url) + "&callback=?", function(t) { | |
t.count && $("#share-button-twitter .shot-social-count").html(shorterTotal(t.count)) | |
}) | |
$.getJSON("http://api.pinterest.com/v1/urls/count.json?url=" + encodeURIComponent(Screenshot.Meta.full_url) + "&callback=?", function(t) { | |
t.count && $("#share-button-pin .shot-social-count").html(shorterTotal(t.count)) | |
}) | |
// SHARE POPUP | |
$("#share-button-fb").on("click", function() { | |
window.open("https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(Screenshot.Meta.full_url), "", "height=350,width=600") | |
}) | |
$("#share-button-pin").on("click", function() { | |
var t = Screenshot.Meta.team_name, | |
e = Screenshot.Meta.title + " by " + Screenshot.Meta.user_name; | |
t && (e += " for " + t), window.open("//pinterest.com/pin/create/button/?url=" + encodeURIComponent(Screenshot.Meta.full_url) + "&media=" + encodeURIComponent(Screenshot.Meta.img) + "&description=" + encodeURIComponent(e), "", "height=260,width=600") | |
}) | |
$("#share-button-twitter").on("click", function() { | |
var t = Screenshot.Meta.team_twitter, | |
e = Screenshot.Meta.title + " by " + Screenshot.Meta.user_twitter(); | |
t && (e += " for " + t), e += " on @dribbble", window.open("https://twitter.com/intent/tweet?url=" + encodeURIComponent(Screenshot.Meta.full_url) + "&text=" + encodeURIComponent(e), "", "status=0,toolbar=0,height=250,width=600") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment