DZX腾讯微博一键转播,可抓取图片和来源
来源:程序员人生 发布时间:2014-03-16 21:08:06 阅读次数:2812次
Discuz!X腾讯微博一键转播,可抓取图片和来源,不需要修改任何文件!直接在后台广告处添加此代码!
<a href="javascript:void(0)" onClick="postToWb();return false;" class="tmblog"><img src=" http://v.t.qq.com/share/images/s/b32.png" border="0"></a>
<script type="text/javascript">
function postToWb(){
var _t = encodeURI(document.title);
var _url = encodeURIComponent(document.location);
var _appkey = encodeURI("你的KEY");//你从腾讯获得的appkey
var _pic = encodeURI('read_tpc');//图片动态地址
var _site = '';//你的网站地址
var _u = ' [url]http://v.t.qq.com/share/share.php?url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic+'&title='+_t[/url];
window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
}
function getAttPicUrl(tpc){
var imgdiv = getObj(tpc);
if (document.getElementById) {
imgdiv = document.getElementById(tpc);
} else if (document.all) {
imgdiv = document.all[tpc];
} else if (document.layers) {
imgdiv = document.layers[tpc];
} else {
imgdiv = null;
}
if(imgdiv != null){
var imgarr = new Array();
var imgs = imgdiv.getElementsByTagName('img');
for (i=0; i<imgs.length; i++) {
imgarr[i] = imgs[i].src;
}
var _imgs = imgarr.join('|');
if(_imgs){
return _imgs;
}else{
return'';
}
}
}
</script>