Skip to content

Instantly share code, notes, and snippets.

@Bloodb0ne
Created June 20, 2016 10:44
Show Gist options
  • Save Bloodb0ne/99f59c5d165fd12d3db676416422d77a to your computer and use it in GitHub Desktop.
Save Bloodb0ne/99f59c5d165fd12d3db676416422d77a to your computer and use it in GitHub Desktop.
Share buttons
function fbShare(url, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
// window.open('http://www.facebook.com/sharer.php?u=100&p[title]=' + name + '&p[summary]=' + desc + '&p[url]=' + url + '&p[images][0]=' + img, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
window.open('http://www.facebook.com/share.php?u='+url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
function twitterShare(url, desc, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('https://twitter.com/intent/tweet?url='+ url + '&text=' + desc , 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
function ggShare(url, winWidth, winHeight) {
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('https://plus.google.com/share?url='+ url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
function pinShare(url, desc, img, winWidth, winHeight){
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open('http://www.pinterest.com/pin/create/button/?url='+ url + '&media=' + img + '&description=' + desc , 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment