zoukankan      html  css  js  c++  java
  • 关于网站内容分享到新浪微博等的代码

    //分享  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;     }     }

  • 相关阅读:
    实例
    LR接口测试---webservices
    LR常用函数整理
    Codeforces Round #639 (Div. 2) A. Puzzle Pieces
    Codeforces Round #640 (Div. 4)全部七题
    POJ3177 Redundant Paths(e-DCC+缩点)
    洛谷P3469 [POI2008]BLO-Blockade(割点)
    洛谷P3275 [SCOI2011]糖果(缩点+拓扑序DP)
    POJ1236 Network of Schools(强连通分量)
    P3387 【模板】缩点(Tarjan求强连通分量)
  • 原文地址:https://www.cnblogs.com/banyan-rong/p/3615833.html
Copyright © 2011-2022 走看看