//分享  function(cateShare,title,contentText,picRegion) {   

  var thisURL = document.URL;  var contentArrya = contentText.split("。");//将contentText以。为分割点,分成字符串数组

 var content = "";

 var pic = "";  

if(contentArrya.length > 0)   

content = contentArrya[0] + "。";

 else   content = contentText;

 var picArray = new Array();

 $("."+ picRegion).each(function() {   picArray.push($(this).find("img").attr("src") + "|");  });

if (cateShare == "renren") {        window.open('http://share.renren.com/share/buttonshare.do?link=' + thisURL + '&title=' + title +'&content=' + content);         return;     }    

if (cateShare == "baidu") {         window.open('http://apps.hi.baidu.com/share/?title=' + title+'&content=' + content + '&url='+thisURL);         return;     }  

if (cateShare == "kaixin") {         window.open('http://www.kaixin001.com/repaste/share.php?rtitle=' + title + '&rcontent=' + content + '&rurl=' + thisURL);         return;     }   

if (cateShare == "sina") {         window.open('http://v.t.sina.com.cn/share/share.php?type=redir&vendor=bshare_sina&url=' + thisURL + '&title=' + title + '&content=' + content + '&pic='   + picArray.toString().split("|")[0] + '&content=utf-8');         return;     }    

if (cateShare == "douban") {         void (function() { var d = document, e = encodeURIComponent, s1 = window.getSelection, s2 = d.getSelection, s3 = d.selection, s = s1 ? s1() : s2 ? s2() : s3 ? s3.createRange().text : '', r = 'http://www.douban.com/recommend/?url=' + e(d.location.href) + '&title=' + e(d.title) + '&content=' + e(d.content) + '&sel=' + e(s) + '&v=1', x = function() { if (!window.open(r, 'douban', 'toolbar=0,resizable=1,scrollbars=yes,status=1,width=450,height=330')) location.href = r + '&r=1' }; if (/Firefox/.test(navigator.userAgent)) { setTimeout(x, 0) } else { x() } })();         return;     }    

if(cateShare=="tqq"){        

var _t = encodeURI(document.title);   

var _c = encodeURI(content);        

var _url = encodeURI(document.location);        

var _appkey = encodeURI("appkey");//你从腾讯获得的appkey        

var _pic = encodeURI(picArray.toString());//(列如:var _pic='图片url1|图片url2|图片url3....)        

var _site = 'http://www.qingfanqie.com';//你的网站地址        

var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&content=' + _c + '&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;        

window.open( _u,'转播到腾讯微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );        return;     }     }

posted on 2014-03-21 14:40  banyan.rong  阅读(312)  评论(0编辑  收藏  举报