文章页小改版,添加一键分享到微博按钮

由于之前用的百度的“内容对我有帮助”点赞按钮,加载速度特慢,每次加载文章页时候都是这按钮拉后腿。

于是选择摒弃掉,替换为分享到微博按钮。


新建一个js,内容为:

//********************************************************************************
//** 一键转载文章到新浪微博和腾讯微博
//** 
//** 西门的后花园
//** http://ons.me/
//********************************************************************************
document.writeln("<a href=\"javascript:void((function(s,d,e){try{}catch(e){}var f='http:\/\/v.t.sina.com.cn\/share\/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(d.title),'&appkey='].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)\/2,',top=',(s.height-450)\/2].join('')))u.href=[f,p].join('');};if(\/Firefox\/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));\" style=\"background:url(http:\/\/www.techweb.com.cn\/img\/images\/sina_w.gif) no-repeat; padding:0 0 0 20px; text-decoration:none; \">转发至新浪微博<\/a>");

document.writeln("<a href=\"javascript:void(0);\" onclick=\"qqWb();\" style=\"background:url(http:\/\/www.techweb.com.cn\/img\/images\/QQ_w.gif) no-repeat; padding:0 0 0 20px;  text-decoration:none; \">转发至腾讯微博<\/a>");

function qqWb(){
	var _t = encodeURI(document.title);
	var _url = encodeURI(window.location);
	var _source = 1000000;
	var _site = encodeURI('http://ons.me/');
	var _pic = '';
	var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&source='+_source+'&site='+_site+'&pic='+_pic;
	window.open(_u,'转播到腾讯微博', 'width=700, height=480, top=320, left=180, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
}
前面是原作者信息,还望保留。

然后在需要调用的地方直接调用这个js,比如我:

<script type="text/javascript" src='{$host}zb_users/theme/{$theme}/js/tMark.js'></script>
这样就行了。



版权属于:做one笔记

原文地址:https://www.zuoone.com/post/89.html

转载时必须以链接形式注明原始出处及本声明。

相关文章

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

不再显示