Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[修改] 仿官方最新帖子底部评分、分享按钮样式(加入朋友社区、QQ空间、腾讯、新浪微博按钮)

  [复制链接]
湖中沉 发表于 2010-11-20 12:19:41 | 显示全部楼层 |阅读模式
插件发布
插件名称: 仿官方最新帖子底部评分、分享按钮样式
插件来源: 原创插件
适用版本: Discuz! X1.5
语言编码: GBK简体 
最后更新时间: 2010-11-20
插件作者: 湖中沉
插件简介: 仿官方最新帖子底部评分、分享按钮样式(加入朋友社区、QQ空间、腾讯、新浪微博按钮)
本帖最后由 湖中沉 于 2011-3-21 21:00 编辑

【最新发现未开启伪静态的时候,新浪微博和朋友社区可能存在问题,没有开启或者不能开启伪静态的朋友建议去除这两部分】

仿官方最新帖子底部评分、分享按钮样式,加入了朋友社区、QQ空间、腾讯、新浪微博等按钮,并且上面的评分和顶踩居中显示,上图:




修改方式:

第一步:
打开根目录/template/default/forum/viewthread_node.htm文件

找到:
  1. <div class="uo{if $_G['group']['allowrecommend'] && $_G['setting']['recommendthread'][status]} nrate{/if}">
复制代码

替换为:
  1. <div class="nrate_temp">
复制代码

第二步:

找到:
  1. <!--{if $_G['group']['raterange'] && $post['authorid']}-->
  2. <a id="k_rate" href="javascript:;" onclick="showWindow('rate', 'forum.php?mod=misc&action=rate&tid=$_G[tid]&pid=$post[pid]', 'get', -1);return false;" title="{echo count($postlist[$post[pid]][totalrate]);} {lang people_score}">{lang rate} </a>
  3. <!--{/if}-->
  4. <a href="home.php?mod=spacecp&ac=favorite&type=thread&id=$_G[tid]" id="k_favorite" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('favoritenumber').innerHTML + ' {lang activity_member_unit}{lang thread_favorite}'">{lang thread_favorite}<span id="favoritenumber">{$_G['forum_thread']['favtimes']}</span></a>
  5. <a href="home.php?mod=spacecp&ac=share&type=thread&id=$_G[tid]" id="k_share" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('sharenumber').innerHTML + ' {lang activity_member_unit}{lang thread_share}'">{lang thread_share}<span id="sharenumber">{$_G['forum_thread']['sharetimes']}</span></a>
  6. <!--{if $_G['perm']['allowrecommend'] && $_G['setting']['recommendthread']['status']}-->
  7. <a id="recommend_add" href="forum.php?mod=misc&action=recommend&do=add&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate({$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_add').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][addtext]'">$_G['setting']['recommendthread'][addtext]<span id="recommendv_add">$_G[forum_thread][recommend_add]</span></a>
  8. <a id="recommend_subtract" href="forum.php?mod=misc&action=recommend&do=subtract&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate(-{$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_subtract').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][subtracttext]'">$_G['setting']['recommendthread'][subtracttext]<span id="recommendv_subtract">$_G[forum_thread][recommend_sub]</span></a>
  9. <!--{/if}-->
复制代码

替换为:

  1. <style type="text/css">
  2. .qc_rate { width: 100%; text-align: center; }
  3. .qc_rate table { margin: 0 auto; width: auto; }
  4. .qc_rate td { background: url({IMGDIR}/rate_btn.png) no-repeat 0 0; text-align: left; }
  5. .td_rate { padding-right: 10px; width: 86px; }
  6. .td_rate a { padding-left: 32px; }
  7. .td_recommend_add { width: 70px; background-position: 0 -42px !important; }
  8. .td_recommend_add a { padding-left: 32px; }
  9. .td_recommend_subtract { width: 70px; background-position: 0 -84px !important; text-align: right !important; }
  10. .td_recommend_subtract a { padding-right: 32px; }
  11. .qc_rate a { display: block; line-height: 39px; color: {HIGHLIGHTLINK}; }
  12. #k_rate, #recommend_add, #recommend_subtract { background: none; }
  13. .qc_rate i { float: left; width: 0; height: 0; overflow: hidden; }
  14. .qc_share { }
  15. .qc_share a { float: left; margin-right: 6px; padding-left: 21px; }
  16. #k_favorite, #k_share, #k_qqshare, #k_weibo { background: url({IMGDIR}/share_btn.png) no-repeat 0 -24px; }
  17. #k_pengyou { background: url({IMGDIR}/share_pengyou.png) no-repeat}
  18. #k_sinaweibo { background: url({IMGDIR}/share_sinaweibo.png) no-repeat}
  19. #k_favorite { background-position: 0 -48px; }
  20. #k_share { background-position: 0 -72px; }
  21. #k_weibo { background-position: 0 0; }
  22. #k_pengyou { background-position: 0 0; }
  23. #k_sinaweibo { background-position: 0 0; }
  24. .qc_share i { float: left; padding: 0 5px; height: 24px; background: url({IMGDIR}/share_btn.png) no-repeat 100% 100%; line-height: 24px; font-style: normal; cursor: pointer; }
  25. .qc_share span { padding-left: 3px; color: {LIGHTTEXT}; }
  26. </style>
  27. <div class="qc_rate mtw">
  28. <table cellspacing="0" cellpadding="0">
  29. <tr>
  30. <!--{if $_G['group']['raterange'] && $post['authorid']}-->
  31. <td class="td_rate">
  32. <a id="k_rate" href="javascript:;" onclick="showWindow('rate', 'forum.php?mod=misc&action=rate&tid=$_G[tid]&pid=$post[pid]', 'get', -1);return false;" title="{echo count($postlist[$post[pid]][totalrate]);} {lang people_score}">{lang rate}</a>
  33. </td>
  34. <!--{/if}-->
  35. <!--{if ($_G['group']['allowrecommend'] || !$_G['uid']) && $_G['setting']['recommendthread']['status']}-->
  36. <td class="td_recommend_add">
  37. <a id="recommend_add" href="forum.php?mod=misc&action=recommend&do=add&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate({$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_add').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][addtext]'"><i>$_G['setting']['recommendthread'][addtext]</i><span id="recommendv_add">$_G[forum_thread][recommend_add]</span></a>
  38. </td>
  39. <td class="td_recommend_subtract">
  40. <a id="recommend_subtract" href="forum.php?mod=misc&action=recommend&do=subtract&tid=$_G[tid]" {if $_G['uid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate(-{$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if} onmouseover="this.title = $('recommendv_subtract').innerHTML + ' {lang activity_member_unit}$_G[setting][recommendthread][subtracttext]'"><i>$_G['setting']['recommendthread'][subtracttext]</i><span id="recommendv_subtract">$_G[forum_thread][recommend_sub]</span></a>
  41. </td>
  42. <!--{/if}-->
  43. </tr>
  44. </table>
  45. </div>
  46. <div class="qc_share mtw mbm cl">
  47. <a href="home.php?mod=spacecp&ac=favorite&type=thread&id=$_G[tid]" id="k_favorite" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('favoritenumber').innerHTML + ' {lang activity_member_unit}{lang thread_favorite}'"><i>{lang thread_favorite}<span id="favoritenumber">{$_G['forum_thread']['favtimes']}</span></i></a>
  48. <a href="home.php?mod=spacecp&ac=share&type=thread&id=$_G[tid]" id="k_share" onclick="showWindow(this.id, this.href, 'get', 0);" onmouseover="this.title = $('sharenumber').innerHTML + ' {lang activity_member_unit}{lang thread_share}'"><i>{lang thread_share}<span id="sharenumber">{$_G['forum_thread']['sharetimes']}</span></i></a>
  49. <a href="javascript:void(0);" id="k_qqshare" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href));return false;" target="_blank" title="分享到QQ空间"><i>分享到QQ空间</i></a>
  50. <a href="javascript:void(0);" id="k_pengyou" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&url='+encodeURIComponent(document.location.href));return false;" target="_blank" title="分享到朋友社区"><i>分享到朋友社区</i></a>
  51. <a id="k_weibo" href="javascript:void(0)" onclick="postToWb();" title="转播到腾讯微博"><i>转播到腾讯微博</i></a>
  52. <script type="text/javascript">
  53. function postToWb(){
  54. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  55. var _url = encodeURIComponent(document.location);
  56. var _appkey = encodeURI("0deb5dd8e4034ee182a147d0c5d53c52");//你从腾讯获得的appkey
  57. var _pic = encodeURI('');//(例如:var _pic='图片url1|图片url2|图片url3....)
  58. var _site = 'htttp://www.foxanddogs.com';//你的网站地址
  59. var _u = 'http://v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;
  60. window.open( _u,'转播到腾讯微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
  61. }
  62. </script>
  63. <a id="k_sinaweibo" href="javascript:void(0)" onclick="postToSinaWb();" title="转播到新浪微博"><i>转播到新浪微博</i></a>
  64. <script type="text/javascript">
  65. function postToSinaWb(){
  66. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  67. var _url = encodeURIComponent(document.location);
  68. var _appkey = encodeURI("746253572");//你从新浪获得的appkey
  69. var _u = 'http://service.t.sina.com.cn/share/share.php?url='+_url+'&title='+_t+'&appkey='+_appkey;
  70. window.open( _u,'转播到新浪微博', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' );
  71. }
  72. </script>
  73. </div>
复制代码

第三步:

并且记得,最后那段代码中,部分API和网址、网站名需要换成你自己的,比如:
  1. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  2. var _url = encodeURIComponent(document.location);
  3. var _appkey = encodeURI("0deb5dd8e4034ee182a147d0c5d53c52");//你从腾讯获得的appkey
  4. var _pic = encodeURI('');//(例如:var _pic='图片url1|图片url2|图片url3....)
  5. var _site = 'htttp://www.foxanddogs.com';//你的网站地址
复制代码

中的
【狐朋狗友网推荐】
0deb5dd8e4034ee182a147d0c5d53c52
htttp://www.foxanddogs.com

应该换成你自己的网站名、腾讯微博API、网址,

同理,下面的新浪微博代码也是:
  1. var _t = encodeURI('{$_G['forum_thread']['subject']}【狐朋狗友网推荐】');
  2. var _url = encodeURIComponent(document.location);
  3. var _appkey = encodeURI("746253572");//你从新浪获得的appkey
复制代码

其中的:
【狐朋狗友网推荐】
746253572

换成你自己的网站名和新浪微博应用API

第四步:

1、上传viewthread_node.htm到对应位置(提醒备份原文件,以免造成损失)。
2、上传附件包中的图片到根目录/static/image/common/中,无覆盖操作,放心。

第五步:

完成,后台更新缓存


免费下载地址:http://www.kuozhan.net/thread-700-1-1.html








本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

评分

2

查看全部评分

cokes1 发表于 2010-11-20 12:21:56 | 显示全部楼层
呵呵 试点了一下,不小心点了个踩,抱歉了兄弟~
回复

使用道具 举报

 楼主| 湖中沉 发表于 2010-11-20 12:22:04 | 显示全部楼层
占位回答问题
回复

使用道具 举报

PANPANLUO 发表于 2010-11-20 12:22:07 | 显示全部楼层
回复

使用道具 举报

ysy49271743 发表于 2010-11-20 12:22:21 | 显示全部楼层
此贴必火,一定要顶贴。。
回复

使用道具 举报

 楼主| 湖中沉 发表于 2010-11-20 12:22:27 | 显示全部楼层
cokes1 发表于 2010-11-20 12:21
呵呵 试点了一下,不小心点了个踩,抱歉了兄弟~

晕,呵呵,问题不大
回复

使用道具 举报

 楼主| 湖中沉 发表于 2010-11-20 12:22:51 | 显示全部楼层
ysy49271743 发表于 2010-11-20 12:22
此贴必火,一定要顶贴。。

多谢多谢
回复

使用道具 举报

流水不腐 发表于 2010-11-20 12:24:55 | 显示全部楼层
好贴!!!!!
回复

使用道具 举报

 楼主| 湖中沉 发表于 2010-11-20 12:26:20 | 显示全部楼层
流水不腐 发表于 2010-11-20 12:24
好贴!!!!!

多谢支持,免费下载地址http://www.kuozhan.net/thread-700-1-1.html
回复

使用道具 举报

sxg505 发表于 2010-11-20 12:26:57 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-9 23:26 , Processed in 0.120191 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表