js sharing code (Sina Weibo, Tencent Weibo, QQ space, QQ friends)
code show as below:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Junle Technology js sharing code</title> </head> <body style="background:#e5e6e6;"> <section> <div> <div class="share-box"> <div> <p>Click the icon below to share directly</p> <ul> <!-- Sina Weibo--> <li><a href="javascript:void((function(s,d,e,r,l,p,t,z,c){var%20f='http://v.t.sina.com.cn/share/share.php?appkey=真实的appkey',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg','君乐科技','http://www.junlenet.com','page code gb2312|utf-8 default gb2312'));" class="invite-kinds2">Sina Weibo</a></li> <!-- QQ friends--> <li><a href="javascript:;" id="qq_id" target="_blank">QQ好友</a></li> <!-- QQ space--> <li><a href="javascript:;" onclick = "qqZone()">QQ空间</a></li> <!-- Tencent Weibo--> <li><a href="javascript:;" onclick = "tencentWeiBo()">腾讯微博</a></li> </ul> </div> <div class="ewm" id="qrcode"></div> <!-- Reference: jquery.qrcode.js --> </div> </div> </section> <hr> <h3>Share directly with Baidu</h3> <div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a></div> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{},"image":{"viewList":["weixin","tsina","qzone","tqq"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["weixin","tsina","qzone","tqq"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <script> var url = "http://www.junlenet.com"; var desc_ = "Junle Technology"; function tencentWeiBo(){ var _url = "http://www.junlenet.com"; var _showcount = 0; var _summary = ""; var _title = desc_; var _site = "http://www.junlenet.com"; var _width = "600px"; var _height = "800px"; var _pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg"; var _shareUrl = 'http://share.v.t.qq.com/index.php?c=share&a=index'; _shareUrl += '&title=' + encodeURIComponent(_title||document.title); //The title of the share _shareUrl += '&url=' + encodeURIComponent(_url||location.href); //Shared link _shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155'; //Create an application on Tencent Weibo platform to get Weibo AppKey //_shareUrl += '&site=' + encodeURIComponent(_site||''); //Share source _shareUrl += '&pic=' + encodeURIComponent(_pic||''); //Shared pictures, if there are multiple pictures, define var _pic='picture url1|picture url2|picture url3....' window.open(_shareUrl,'width='+_width+',height='+_height+',left='+(screen.width-_width)/2+',top='+(screen.height-_height)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0'); } var top = window.screen.height / 2 - 250; var left = window.screen.width / 2 - 300; var height = window.screen.height; var width = window.screen.width; /*title is the title, rLink link, summary content, site share source, pic share image path, share to Sina Weibo*/ function shareTSina() { var title = desc_; var rLink = "http://www.junlenet.com"; var backUrl = "http://wx.hengfu100.com/member/c_friend"; var site = desc_; var pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg"; window.open("http://service.weibo.com/share/share.php?pic=" +encodeURIComponent(pic) +"&title=" + encodeURIComponent(title.replace(/ /g, " ").replace(/<br \/>/g, " "))+ "&url=" + encodeURIComponent(rLink), "Share to Sina Weibo", "height=500,width=600,top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no"); } function qqFriend() { var p = { url : 'http://www.junlenet.com', /*Get the URL, you can add the logo from Share to QQ for easy statistics*/ desc:'', //title : 'New gameplay, if you don't come, you will be out! ', /*Share title (optional)*/ title:desc_, summary : '', /* share summary (optional)*/ pics : 'http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg', /*Share pictures (optional)*/ flash : '', /*video address (optional)*/ site : 'http://www.junlenet.com', /*share source (optional) such as: QQ share*/ style : '201', width : 32, height : 32 }; var s = []; for ( var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')); } var url = "http://connect.qq.com/widget/shareqq/index.html?"+s.join('&'); return url; //window.location.href = url; //document.write(['<a class="qcShareQQDiv" href="http://connect.qq.com/widget/shareqq/index.html?',s.join('&'), '" >分享给QQ好友</a>' ].join('')); } function qqZone(){ var _url = "http://www.junlenet.com"; var _showcount = 0; var _desc = desc_; var _summary = ""; var _title = "Junle Technology"; var _site = ""; var _width = "600px"; var _height = "800px"; var _summary = ""; var _pic = "http://www.junlenet.com/uploads/allimg/150510/1-150510104044.jpg"; var _shareUrl = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?'; _shareUrl += 'url=' + encodeURIComponent(_url||document.location); //The parameter url sets the shared content link|default current page location _shareUrl += '&showcount=' + _showcount||0; //Whether the parameter showcount displays the total number of shares, display: '1', not display: '0', not displayed by default _shareUrl += '&desc=' + encodeURIComponent(_desc||'shared description'); //The parameter desc sets the shared description, optional parameter //_shareUrl += '&summary=' + encodeURIComponent(_summary||'share summary'); //The parameter summary sets the share summary, optional parameter _shareUrl += '&title=' + encodeURIComponent(_title||document.title); //The parameter title sets the share title, optional parameter //_shareUrl += '&site=' + encodeURIComponent(_site||''); //The parameter site sets the sharing source, optional parameter _shareUrl += '&pics=' + encodeURIComponent(_pic||''); //The parameter pics sets the path of the shared picture, multiple pictures are separated by "|", optional parameter window.open(_shareUrl,'width='+_width+',height='+_height+',top='+(screen.height-_height)/2+',left='+(screen.width-_width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0'); } $(function(){ var url = qqFriend(); $("#qq_id").attr("href",url); }) </script> </body> </html>
Sina Weibo can directly use:
var href = "http://service.weibo.com/share/share.php?url=http://www.junlenet.com&title=君乐科技&pic=http://www.junlenet.com/uploads/allimg/150510/1-150510104424.jpg&appkey=&searchPic=false";
The operation effect is as follows: