Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Share = {
- vkontakte: function (purl, ptitle, pimg, text) {
- url = 'http://vkontakte.ru/share.php?';
- url += 'url=' + encodeURIComponent(purl);
- url += '&title=' + encodeURIComponent(ptitle);
- url += '&description=' + encodeURIComponent(text);
- url += '&image=' + encodeURIComponent(pimg);
- url += '&noparse=true';
- Share.popup(url);
- },
- facebook: function (purl, ptitle, pimg, text) {
- url = 'http://www.facebook.com/sharer/sharer.php?s=100';
- url += '&p[title]=' + encodeURIComponent(ptitle);
- url += '&p[summary]=' + encodeURIComponent(text);
- url += '&p[url]=' + encodeURIComponent(purl);
- url += '&p[images][0]=' + encodeURIComponent(pimg);
- Share.popup(url);
- },
- twitter: function (purl, ptitle) {
- url = 'http://twitter.com/share?';
- url += 'text=' + encodeURIComponent(ptitle);
- url += '&url=' + encodeURIComponent(purl);
- url += '&counturl=' + encodeURIComponent(purl);
- Share.popup(url);
- },
- gplus: function (purl, ptitle) {
- url = 'http://plus.google.com/share?';
- url += 'text=' + encodeURIComponent(ptitle);
- url += '&url=' + encodeURIComponent(purl);
- url += '&counturl=' + encodeURIComponent(purl);
- Share.popup(url);
- },
- popup: function (url) {
- var leftvar = (screen.width - 800) / 2;
- var topvar = (screen.height - 600) / 2;
- window.open(url, '', 'toolbar=0,status=0,width=626,height=436,left=' + leftvar + ',top=' + topvar + '');
- }
- };
- //example
- var img = document.getElementsByTagName("img")[0];
- Share.vkontakte(document.location.href, document.title, img.src, document.description);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement