Skip to content

Instantly share code, notes, and snippets.

@guicheffer guicheffer/socialmedia.js
Last active Jun 7, 2016

Embed
What would you like to do?
social media (share) functions
function shareFacebook(title, summary, url, image) {
url = ['https://www.facebook.com/sharer/sharer.php?s=100&p[summary]=', encodeURI(summary), '&p[title]=', encodeURI(title), '&p[url]=', encodeURI(url), '&p[images][0]=', encodeURI(image)];
window.open(url.join(''), 'facebook', 'height=300,width=600');
}
function shareFacebookFBui(options, callbackShare) {
// http://developers.facebook.com/docs/reference/dialogs/feed/
var defaults = {
method: 'feed',
link: 'https://developers.facebook.com/docs/reference/dialogs/',
picture: 'http://fbrell.com/f8.jpg',
name: 'Facebook Dialogs'
};
/* merge defaults and options, without modifying defaults */
var obj = $.extend({}, defaults, options);
FB.ui(obj, callbackShare);
}
function shareTwitter (text, url) {
url = ['http://twitter.com/share?text=', encodeURI(text), '&url=', encodeURI(url)];
window.open(url.join(''), 'twitter', 'height=300,width=600');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.