腾讯新浪分享功能代码

//html
<div>
<a title="推荐到新浪微博" id="site-sina" href="javascript:void(0)">sina</a>
<a title="推荐到腾讯微博" id="site-qzone" href="javascript:void(0)">qzone</a>
<a title="推荐到人人" id="site-renren" href="javascript:void(0)">renren</a>
<a title="推荐到开心网" id="site-kaixin" href="javascript:void(0)">kaixin</a>
<a title="推荐到豆瓣" id="site-douban" href="javascript:void(0)">douban</a>
<a title="推荐到MSN" id="site-msn" href="javascript:void(0)">msn</a>
<!-- <a title="通过QQ发送链接给好友" id="site-qq" οnclick="send();" href="javascript:void(0)">qq</a> -->
</div>

//js
PCDS.ShareMgr = (function(){
var pub = {

init:function(){
//绑定事件


var dataBag = PCDS.Utils.ReadDataBagByElm($('#dbProduct'));
var promotionPrice = dataBag.promotionPrice;
var title = dataBag.productName;
var content = "我在@赛特春天 发现了一个非常不错的商品:"+title+",赛特春天价:¥"+promotionPrice+"。感觉不错,分享一下";
var img = $('#productPhotoCurrent').attr("src");
var productUrl =window.location.href;

$("#site-sina").click(function(){
var url = 'http://v.t.sina.com.cn/share/share.php?appkey=2445336821';
url = url + "&title=" + encodeURIComponent(content) + "&pic=" + encodeURIComponent(img) + "&url=" + encodeURIComponent(productUrl);
//PostSinaDate();
window.showModalDialog(url, "", "dialogHeight:490px; dialogWidth:610px;pxcenter=yes");
});
$("#site-qzone").click(function(){
var url = 'http://v.t.qq.com/share/share.php?appkey=801137289';
url = url + "&title=" + encodeURIComponent(content) + "&pic=" + encodeURIComponent(img) + "&url=" + encodeURIComponent(productUrl);
//PostSinaDate();
window.showModalDialog(url, "", "dialogHeight:680px; dialogWidth:620px;pxcenter=yes");
});
$("#site-renren").click(function(){
var url = 'http://share.renren.com/share/buttonshare/post/1004?';
url = url + "title=" + encodeURIComponent(content) + "&pic=" + encodeURIComponent(img) + "&url=" + encodeURIComponent(productUrl);
//PostSinaDate();
window.showModalDialog(url, "", "dialogHeight:460px; dialogWidth:980px;pxcenter=yes");
});
$("#site-kaixin").click(function(){
var url = 'http://www.kaixin001.com/repaste/share.php?';
url = url + "rtitle=" + encodeURIComponent(title) + "&rcontent=" + encodeURIComponent(content) + "&rurl=" + encodeURIComponent(productUrl);
window.showModalDialog(url, "", "dialogHeight:400px; dialogWidth:600px;pxcenter=yes");
});
$("#site-douban").click(function(){
var url = 'http://www.douban.com/recommend/?';
url = url + "title=" + encodeURIComponent(content) + "&comment=" +encodeURIComponent(content) + "&url="+ encodeURIComponent(productUrl);
window.showModalDialog(url, "", "dialogHeight:280px; dialogWidth:500px;pxcenter=yes");
});
$("#site-msn").click(function(){
var url = 'http://profile.live.com/badge/?';
url = url + "url=" + encodeURIComponent(productUrl) +"&title=" + title +"&description=" + encodeURIComponent(content) + "&screenshot=" + encodeURIComponent(img) ;
window.showModalDialog(url, "", "dialogHeight:400px; dialogWidth:600px;pxcenter=yes");
});
$("#site-qq").click(function(){
window.open(encodeURI(url), "", "height=500, width=600");
});
$("#site-email").click(function(){
var url = 'http://share.renren.com/share/buttonshare/post/1004?';
url = url + "title=" + encodeURIComponent(content) + "&pic=" + encodeURIComponent(img) + "&url=" + encodeURIComponent(productUrl);
//PostSinaDate();
window.open(url, "", "height=500, width=600");
shareRecommend('http://v.t.sina.com.cn/share/share.php?appkey=2445336821','sina');
});


},

shareRecommend :function(url,stype){
shareRecommend(url,stype);
}
}
return pub;


//新浪分享POST数据
function PostSinaDate() {
var id = $("#name").attr("PshowSkuid");
var getCommentUrl = "http://club.360buy.com/ProductPageService.aspx?method=GetCommentSummaryBySkuId&referenceId={0}&callback=CallBackGetCommentCount".format(id);
$.getJSONP(getCommentUrl, CallBackGetCommentCount);
}
function CallBackGetCommentCount(result) {
var grade = 5, rev_amount = 0;
if (result) {
grade = result.AverageScore;
rev_amount = result.CommentCount
}
var id = $("#name").attr("PshowSkuid");
var sinarecommendurl = "http://www.360buy.com/SOAService/SinaRecommend.ashx?skuid={0}&grade={1}&rev_amount={2}&callback=?"
$.getJSON(sinarecommendurl.format(id, grade, rev_amount), function(data) { if (!data) return; });
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值