Created
April 4, 2016 13:05
-
-
Save dmacompton/3d5d9a430ad853efc0a4444b2b3e6c9f to your computer and use it in GitHub Desktop.
Social (fv,tw,g+,in,pocket)
This file contains 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
<script> | |
var Share = { | |
facebook: function (purl, ptitle, pimg, text) { | |
var url = 'http://www.facebook.com/sharer.php?s=100' | |
+ '&p[title]=' + encodeURIComponent(ptitle) | |
+ '&p[summary]=' + encodeURIComponent(text) | |
+ '&p[url]=' + encodeURIComponent(purl) | |
+ '&p[images][0]=' + encodeURIComponent(pimg); | |
Share.popup(url); | |
}, | |
twitter: function (purl, ptitle) { | |
var url = 'http://twitter.com/share?' | |
+ 'text=' + encodeURIComponent(ptitle) | |
+ '&url=' + encodeURIComponent(purl) | |
+ '&counturl=' + encodeURIComponent(purl); | |
Share.popup(url); | |
}, | |
googleplus: function (purl) { | |
var url = 'https://plus.google.com/share?url=' + encodeURIComponent(purl); | |
Share.popup(url); | |
}, | |
linkedin: function (purl, title, text) { | |
var url = 'http://www.linkedin.com/shareArticle?mini=true' | |
+ '&url=' + encodeURIComponent(purl) | |
+ '&title=' + encodeURIComponent(title) | |
+ '&summary=' + encodeURIComponent(text); | |
Share.popup(url); | |
}, | |
pocket: function (purl) { | |
var url = 'https://getpocket.com/save?url=' + purl; | |
Share.popup(url); | |
}, | |
popup: function(url) { | |
window.open(url,'','toolbar=0,status=0,width=626,height=436'); | |
} | |
}; | |
</script> | |
<a onclick="Share.twitter('URL', document.title)">twitter</a> | |
<a onclick="Share.facebook('URL', document.title, 'IMG_PATH', 'DESC')">facebook</a> | |
<a onclick="Share.googleplus('URL', document.title)">googleplus</a> | |
<a onclick="Share.linkedin('URL', document.title)">linkedin</a> | |
<a onclick="Share.pocket('URL')">pocket</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment