Skip to content

Instantly share code, notes, and snippets.

@koolay
Created May 12, 2014 09:16
Show Gist options
  • Save koolay/1f2161006ec0af81da1d to your computer and use it in GitHub Desktop.
Save koolay/1f2161006ec0af81da1d to your computer and use it in GitHub Desktop.
facebook share
var Share = {};
Share.fb = function (link, title, sumary, image, winWidth, winHeight) {
var shareUrl = 'https://www.facebook.com/dialog/feed?';
shareUrl += 'app_id=141676832590601';
shareUrl += '&link=' + encodeURIComponent(link);
shareUrl += '&picture=' + encodeURIComponent(image);
shareUrl += '&name=' + title;
shareUrl += '&caption=' + "";
shareUrl += '&description=' + sumary;
shareUrl += '&display=popup';
shareUrl += '&redirect_uri=' + encodeURIComponent('http://www.facebook.com/dealextremefans');
if (!winWidth)
winWidth = 400;
if (!winHeight)
winHeight = 300;
var winTop = (screen.height / 2) - (winHeight / 2);
var winLeft = (screen.width / 2) - (winWidth / 2);
window.open(shareUrl, '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