• 关于网站内容分享到新浪微博等的代码


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

  • 相关阅读:
    多种方式实现数组的扁平化处理
    利用node中的内置模块fs实现对简单文件的读取 拷贝 创建等功能
    浅谈es5和es6中的继承
    js之冒泡排序与快速排序
    IE5,IE6,IE7,IE8的css兼容性列表[转自MSDN]
    css3 动画
    各种浏览器css hack
    解决li在ie,firefox中行高不一致问题
    Css:背景色透明,内容不透明之终极方法!兼容所有浏览器
    png-24在ie6中的几种透明方法
  • 原文地址:https://www.cnblogs.com/banyan-rong/p/3615833.html
Copyright © 2020-2023  润新知