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;     }     }

  • 相关阅读:
    作为一个 .NET 开发者 应该了解哪些知识?
    服务器扩容,新加一上硬盘,是否要重做raid
    DB2常见错误
    Eclipse快捷键与Notepad++ 快捷建冲突的问题
    Java+MySql图片数据保存
    也谈设计模式Facade
    MyBatis入门级Demo
    Python中的字符串与字符编码
    Python流程控制语句
    Python中的运算符
  • 原文地址:https://www.cnblogs.com/banyan-rong/p/3615833.html
Copyright © 2011-2022 走看看