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

 找回密码
 立即注册
搜索

[修改] 建筑资源吧教你在帖子标题后面增加[论坛转帖][微博转帖]的新功能

[复制链接]
垃圾猫 发表于 2013-11-5 16:56:26 | 显示全部楼层 |阅读模式
本帖最后由 垃圾猫 于 2013-11-5 16:59 编辑

建筑资源吧 www.jzbar.net 今天无聊了,看到某论坛在帖子后面有增加了两个新功能,研究了一下,把方法给大家分享一下。未经过严格测试,不过思路应该是正确的。
1111.png
涉及到的修改文件为:template/default/forum/viewthread.htm;static/js/forum_viewthread.js。

1、查找viewthread.htm文件中的:
  1. {/if}>[{lang share_url_copy}]</a>
复制代码
2、下面增加:
  1. <a href="forum.php?mod=viewthread&tid=$_G[tid]$fromuid" onclick="return copyThreadContentToUBB(this,'$_G[forum_firstpid]')">[论坛转帖]</a>
  2.                                         <a href="forum.php?mod=viewthread&tid=$_G[tid]$fromuid" onclick="return copyThreadContent(this,'$_G[forum_firstpid]')">[博客转帖]</a>
复制代码

3、保存上传覆盖。
4、修改static/js/forum_viewthread.js ,查找:
  1. function replyNotice() {
复制代码

5、在上面增加:
  1. function copyThreadContent(obj,id){
  2.     copyThreadSource(obj,id,false);
  3.     return false;
  4. }

  5. function copyThreadContentToUBB(obj,id){
  6.     copyThreadSource(obj,id,true);
  7.     return false;
  8. }

  9. function copyThreadSource(obj,id,isUbb){
  10.     var type = isUbb?'1':'2';
  11.     jQuery.ajax({
  12.         url:'/extend/api.php?action=getpostcontent&pid='+id+'&type='+type,
  13.         success:function(html){
  14.             html=html.replace(/\[attach\](.+?)\[\/attach\]/g,function(s,t){
  15.                 //alert(jQuery('#aimg_'+id).length);
  16.                 if(jQuery('#aimg_'+t).length==0){
  17.                     return '';
  18.                 }
  19.                 else{
  20.                     if(isUbb){
  21.                         return '[img]'+jQuery('#aimg_'+t).attr('file')+'[/img]'
  22.                     }
  23.                     else{
  24.                         return '<img src="'+jQuery('#aimg_'+t).attr('file')+'" width="'+jQuery('#aimg_'+t).attr('width')+'" />';
  25.                     }
  26.                     
  27.                 }
  28.             });
  29.             if (isUbb){
  30.                 html+='\n[url=http://www.jzbar.net]建筑资源吧[/url],原文为:[url='+obj.href+']'+obj.innerText+'[/url] '+obj.href
  31.                 html=html.replace(/\[i=s\][\s\S]+?\[\/i\]/g,'');
  32.             }
  33.             else{
  34.                 html+='\n<br/><a href="http://www.jzbar.net"/>建筑资源吧</a>,原文为:<a href="'+obj.href+'">'+$('thread_subject').innerHTML.replace(/&/g, '&')+'</a> '+obj.href;
  35.                 html=html.replace(/<i class="pstatus">[\s\S]+?<\/i>/g,'');
  36.             }
  37.             setCopy(html, '帖子内容已经复制到剪贴板');
  38.         }
  39.     });
  40. }
复制代码

6、保存上传覆盖,更新缓存。
注意:请记得修改第5步中有关的域名和网站名称为你自己的。


回复

使用道具 举报

asdsex 发表于 2013-11-6 10:13:39 | 显示全部楼层
又見猫猫!!!

支持猫猫!!!
回复

使用道具 举报

1314学习网 发表于 2013-11-7 12:02:21 | 显示全部楼层
支持下分享。。。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 17:09 , Processed in 0.119468 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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