js:微薄分享

来源:互联网 发布:图片文字抓取软件 编辑:程序博客网 时间:2024/04/28 03:19
  1. var top = window.screen.height / 2 - 250;  
  2. var left = window.screen.width / 2 - 300;  
  3.   
  4. /*title是标题,rLink链接,summary内容,site分享来源,pic分享图片路径,分享到新浪微博*/  
  5. function shareTSina(title,rLink,site,pic) {  
  6.     title = "标题。";  
  7.   // pic = $(".p-img img").attr("src");  
  8.    rLink = "http://www.abc.com/heeh.html";  
  9.      
  10.     window.open("http://service.weibo.com/share/share.php?title=" +   
  11.     encodeURIComponent(title.replace(/&nbsp;/g, " ").replace(/<br \/>/g, " "))+ "&url=" + encodeURIComponent(rLink),  
  12.     "分享至新浪微博",  
  13.     "height=500,width=600,top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no");  
  14.       
  15. }  
  16.   
  17. /*,分享到qq空间*/  
  18. function shareQzone(title,rLink,summary,site,pic) {  
  19.      title = "标题。";  
  20.      rLink = "http://www.abc.com/heeh.html";  
  21.      site = "http://www.abc.com/heeh.html";  
  22.       window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title='+  
  23.                        encodeURIComponent(title)+'&url='+encodeURIComponent(rLink)+'&summary='+  
  24.                        encodeURIComponent(summary)+ '&site='+encodeURIComponent(site)  
  25.                        ,'_blank','scrollbars=no,width=600,height=450,left=' + left + ',top=' + top + ',status=no,resizable=yes');  
  26.     
  27.      }  
  28.   
  29. /*,分享到人人*/  
  30. function shareRR(title,rLink,summary){     
  31.      title = "标题。";  
  32.      summary = "内容。";  
  33.      rLink = "http://www.abc.com/heeh.html";  
  34.     window.open('http://share.renren.com/share/buttonshare/post/1004?title='+encodeURIComponent(title)+'&url='+  
  35.      encodeURIComponent(rLink)+'&content='+encodeURIComponent(summary),'_blank',  
  36.      'scrollbars=no,width=600,height=450,left=' + left + ',top=' + top + ',status=no,resizable=yes');   
  37. }  
  38.   
  39.   
  40.   
  41.   
  42.   
  43. //开心网   
  44. function shareKX(title,rLink,summary){      
  45.      title = "标题。";  
  46.      rLink = "http://www.abc.com/heeh.html";  
  47.         window.open('http://www.kaixin001.com/repaste/bshare.php?rtitle='+encodeURIComponent(title)+  
  48.         '&rurl='+encodeURIComponent(rLink)+  
  49. '&rcontent='+encodeURIComponent(summary),'_blank',  
  50.         'scrollbars=no,width=600,height=450,left=' + left + ',top=' + top + ',status=no,resizable=yes');     
  51. }   
  52.   
  53. //腾讯微博  
  54. function shareToWb(title,rLink,site,pic){     
  55.       title = "标题。";  
  56.       rLink = "http://www.abc.com/heeh.html";  
  57.          window.open('http://v.t.qq.com/share/share.php?url='+encodeURIComponent(rLink)+  
  58.           '&title='+encodeURI(title)+'&appkey='+encodeURI(site),'_blank',  
  59.            'scrollbars=no,width=600,height=450,left=' + left + ',top=' + top + ',status=no,resizable=yes');       
  60. }  
  61.   
  62.   
  63.      
  64.   /*分享到msn*/  
  65.   function shareToMSN(imgUrl){    
  66.       var title = "标题。";  
  67.       var content = "内容";       
  68.       var productUrl ="http://www.abc.com/heeh.html";  
  69.        
  70.       window.open("http://profile.live.com/badge/?url=" + productUrl + "&title=" + encodeURI(title) +"&screenshot="+encodeURIComponent(imgUrl));  
  71.            
  72.  }   
2.说明:新浪微博和qq空间会自动获取网站的图片,msn和其他没有此功能,所以想要在msn分享图片,则需手动传图片的url,目前发现msn只能传一张图片,不能手动调节大小。