var share_more_element = null; var share_postid = -1; var postArray = []; function getPos(obj){ var pos = []; pos[0] = obj.offsetLeft;//X pos[1] = obj.offsetTop;//Y while (obj = obj.offsetParent){ pos[0] += obj.offsetLeft; pos[1] += obj.offsetTop; } return pos; } //显示隐藏层 function share_more(postid, obj){ share_postid = postid; var objPos = getPos(obj); objPos[0]-=7;objPos[1]-=5; if(share_more_element == null)share_more_element=document.getElementById("share_more"); share_more_element.style.left=objPos[0]+"px"; share_more_element.style.top=objPos[1]+"px"; share_more_element.style.display="block"; } //添加收藏夹 function doShare(stype){ stitle = postArray[share_postid][0]; surl = postArray[share_postid][1]; sdire = postArray[share_postid][2]; sbanner = postArray[share_postid][3]; blogtitle = '张存超技术博客'; bloghome = 'https://www.521php.com'; stitle = blogtitle + ' - ' + stitle; switch(stype){ case "fav": if (document.all){ window.external.addFavorite(surl,stitle); } else if (window.sidebar){ window.sidebar.addPanel(stitle,surl, ""); } else{ alert("抱歉,您的浏览器不支持添加到收藏夹,换个浏览器试试?"); } break; //腾讯微博 case "qqt": u=encodeURIComponent(surl); t=encodeURIComponent('#博客#:' + stitle); b=encodeURIComponent(sbanner); su=encodeURIComponent(bloghome); window.open('http://v.t.qq.com/share/share.php?title='+t+'&url='+u+'&site='+su+'&pic='+b,'_blank'); break; //新浪微博 case "sinat": u=encodeURIComponent(surl); t=encodeURIComponent('#博客#:' + stitle); b=encodeURIComponent(sbanner); su=encodeURIComponent(bloghome); window.open('http://v.t.sina.com.cn/share/share.php?title='+t+'&url='+u+'&site='+su+'&pic='+b,'_blank'); break; //QQ朋友 case "qqpeng": u=encodeURIComponent(surl); t=encodeURIComponent(stitle); b=encodeURIComponent(sbanner); su=encodeURIComponent(bloghome); window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&title='+t+'&url='+u+'&site='+su+'&pic='+b,'_blank'); break; //谷歌 case "googlereader": u=encodeURIComponent(surl); t=encodeURIComponent(stitle); su=encodeURIComponent(bloghome); st=encodeURIComponent(blogtitle); window.open('http://www.google.com/reader/link?url='+u+'&title='+t+'&snippet=&srcTitle='+st+'&srcUrl='+su,'_blank'); break; //人人网 case "renren": u=encodeURIComponent(surl); t=encodeURIComponent(stitle); window.open('http://share.renren.com/share/buttonshare.do?link='+u+'&title='+t+'source=&sourceUrl=','_blank'); break; //豆瓣 case "douban": u=encodeURIComponent(surl); t=encodeURIComponent(stitle); window.open('http://www.douban.com/recommend/?url='+u+'&title='+t,'_blank'); break; } }