public
Last active

Social: Custom sharing links

  • Download Gist
facebook.share.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<a id="fb-share-popup" href="http://www.facebook.com/sharer.php?s=100&amp;p[title]=____&amp;p[url]=____&amp;p[summary]=____&amp;p[images][0]=____" target="_blank">share on Facebook</a>
 
<script>
// This will open our link in a new, small window in the middle of the browser
var p = {};
p.w = 700;
p.h = 400;
p.l = (screen.width/2)-(p.w/2);
p.t = (screen.height/2)-(p.h/2);
 
$('#fb-share-popup').on('click', function (evt) {
evt.preventDefault();
newwindow = window.open(this.href, this.title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+p.w+', height='+p.h+', top='+ p.t +', left='+p.l);
if (window.focus) newwindow.focus();
});
 
</script>
googleplus.share.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<a id="gp-share-popup" href="https://plus.google.com/share?url=____" target="_blank">Share on Google Plus</a>
 
<script>
// This will open our link in a new, small window in the middle of the browser
var p = {};
p.w = 700;
p.h = 400;
p.l = (screen.width/2)-(p.w/2);
p.t = (screen.height/2)-(p.h/2);
 
$('#gp-share-popup').on('click', function (evt) {
evt.preventDefault();
newwindow = window.open(this.href, this.title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+p.w+', height='+p.h+', top='+ p.t +', left='+p.l);
if (window.focus) newwindow.focus();
});
 
</script>
twitter.share.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<a id="tw-share-popup" href="http://twitter.com/intent/tweet?url=____&text=____&hashtags=____,____,____" target="_blank">Share on Twitter</a>
 
<script>
// This will open our link in a new, small window in the middle of the browser
var p = {};
p.w = 700;
p.h = 400;
p.l = (screen.width/2)-(p.w/2);
p.t = (screen.height/2)-(p.h/2);
 
$('#tw-share-popup').on('click', function (evt) {
evt.preventDefault();
newwindow = window.open(this.href, this.title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+p.w+', height='+p.h+', top='+ p.t +', left='+p.l);
if (window.focus) newwindow.focus();
});
 
</script>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.