Answer the question
In order to leave comments, you need to log in
Get links to Share-messages in social networks?
Wrote a simple script for share in social networks.
var Share = {
vkontakte: function() {
url = 'http://vkontakte.ru/share.php?';
url += 'url=' + encodeURIComponent(seo.purl);
url += '&title=' + encodeURIComponent(seo.ptitle);
url += '&description=' + encodeURIComponent(seo.text);
url +=(seo.pimg!=''? '&image=' + encodeURIComponent(seo.pimg):'');
url += '&noparse=true';
Share.popup(url);
},
odnoklassniki: function() {
url = 'http://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
url += '&st.comments=' + encodeURIComponent(seo.text);
url += '&st._surl=' + encodeURIComponent(seo.purl);
Share.popup(url);
},
facebook: function() {
url = 'http://www.facebook.com/sharer.php?m2w&s=100';
// url += '&p[title]=' + encodeURIComponent(seo.ptitle);
//url += '&p[summary]=' + encodeURIComponent(seo.text);
url += '&p[url]=' + encodeURIComponent(seo.purl);
url +=(seo.pimg!=''?'&p[images][0]=' + encodeURIComponent(seo.pimg):'');
console.log(url);
Share.popup(url);
},
twitter: function() {
url = 'http://twitter.com/share?';
url += 'text=' + encodeURIComponent(seo.ptitle);
url += '&url=' + encodeURIComponent( seo.purl);
url += '&counturl=' + encodeURIComponent( seo.purl);
Share.popup(url);
},
mailru: function() {
url = 'http://connect.mail.ru/share?';
url += 'url=' + encodeURIComponent(seo.purl);
url += '&title=' + encodeURIComponent(seo.ptitle);
url += '&description=' + encodeURIComponent(seo.text);
url +=(seo.pimg!=''? '&imageurl=' + encodeURIComponent(seo.pimg):'');
Share.popup(url)
},
popup: function(url) {
var pop = window.open(url,'','toolbar=0,status=0,width=626,height=436');
pop.onunload = function(e) {
alert('Please press the Logout button to logout.') ;
};
var oauthInterval = window.setInterval(function(){
if (pop.closed) {
window.clearInterval(oauthInterval);
console.log('window closed');
}
}, 1000);
}
};
$(document).ready(function(){
$('.share-fb').click(function(){ Share.facebook();return false;});
$('.share-vk').click(function(){Share.vkontakte();return false;});
$('.share-tw').click(function(){Share.twitter();return false; });
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question