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

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

鼠标移动到主题显示最后回复内容(D2.5sp1)改良版

[复制链接]
PerfectWorks 发表于 2005-5-12 19:17:18 | 显示全部楼层 |阅读模式
转载自圆圆科技
SP1用户请先进行5楼的修改!
此插件是根据VIP园园D25sp1-4.2改写 请大家根据自己的情况更改
名称:鼠标指向主题表格时显示最后回复等内容
作者:btaoto (大部分为 cknuke、Niceweb等高手的代码)
功能:与权限挂钩,扩大鼠标反应区域至表格
修改:common.js、forumdisplay.php、forumdisplay.htm
演示:http://cdd.xicp.net

1.修改forumdisplay.php
找到
  1. $ascdesc == 'ASC' ? $forumdisplayadd .= "&ascdesc=$ascdesc" : $ascdesc = 'DESC';  
复制代码

下面添加
  1. //由于仓促 未查看$dotfolders在2.5中是否有定义但不影响使用  start
  2. $dotadd1 = $dotadd2 = '';
  3. if($dotfolders && $discuz_user) {
  4.     $dotadd1 = "DISTINCT p.author AS dotauthor, p.subject AS re_subject, p.message, ";
  5.     $dotadd2 = "LEFT JOIN $table_posts p ON (t.tid=p.tid AND p.author='$discuz_user')";
  6. }else {
  7.     $dotadd1 = "p.subject AS re_subject, p.message, ";
  8.     $dotadd2 = "LEFT JOIN $table_posts p ON (t.tid=p.tid AND t.lastpost=p.dateline)";
  9. }
  10. //end  
复制代码

找到:
  1. $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
  2.     $thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);  
复制代码

下面添加
  1. //start
  2. if((!$forum['viewperm'] && !$allowview) || ($forum['viewperm'] && !strstr($forum['viewperm'], "\t$groupid\t"))) {
  3.         $thread['message'] = "谢谢您的访问!由于权限不够,您仅可浏览本版主题标题。";
  4.     } elseif($thread['creditsrequire'] && $thread['creditsrequire'] > $credit && !$ismoderator) {
  5.         include language('messages');
  6.         eval("\$show_message = "".$language[thread_nopermission]."";");
  7.         $thread['message'] =  $show_message;
  8.     } else {
  9.               $thread['message']  = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "**** 回复后才可查看信息 *****", $thread['message'] );
  10.         $thread['message']  = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "**** 付費信息,已經隱藏 *****", $thread['message'] );
  11.         $thread['message']  = preg_replace("/\[php](.+?)\[\/php\]/is", "**** 内容为PHP代码 *****", $thread['message'] );
  12.         $thread['message']  = preg_replace("/\[code](.+?)\[\/code\]/is", "**** 内容为普通代码 *****", $thread['message'] );
  13.         $thread['message']  = preg_replace("/\[quote](.+?)\[\/quote\]/is", "**** 内容为引用信息 *****", $thread['message'] );
  14.         $thread['message']  = preg_replace("/\[url=?(.+?)\](.+?)\[\/url\]/is", "**** 此处为超级链接 *****", $thread['message'] );
  15.         $thread['message']  = preg_replace("/\[img](.+?)\[\/img\]/is", "**** 此处为图片链接 *****", $thread['message'] );
  16.         $thread['message'] = str_replace('"', '"', $thread['message']);
  17.         $thread['message'] = str_replace('<', '&lt;', $thread['message']);
  18.         $thread['message'] = str_replace('>', '&gt;', $thread['message']);
  19.         $thread['message'] = str_replace("\r\n", " ◇ ", $thread['message']);    //去掉回车,紧凑显示
  20.         $thread['message'] = cutstr($thread['message'],60);        //截断
  21.         }
  22.     if($thread[replies]) {
  23.         $thread['shortmsg'] = '<b>主题:'.$thread[subject].'</b><br><b>回复:</b>'.$thread[re_subject].'<br><font color=red>'.$thread[message].'</font>'.'<br><font class=numtxt>最后发表:'.$thread[lastposter].'<br>主题作者:'.$thread[author].'&nbsp; 发表时间:'.$thread[dateline].'</font>';
  24.     } else {
  25.         $thread['shortmsg'] = '<b>主题:'.$thread[subject].'</b><br><font color=red>'.$thread[message].'</font>'.'<br>主题作者:'.$thread[author].'&nbsp; 发表时间:'.$thread[dateline].'</font>';
  26.     }
  27.     //end  
复制代码

如果您安装过全论坛置顶HACK直接进行第二步
查找
  1. $query = $db->query("SELECT  t.* FROM $table_threads t USE INDEX(displayorder)
  2.             WHERE t.fid='$fid' $filteradd
  3.             ORDER BY t.displayorder DESC, t.lastpost $ascdesc
  4.             LIMIT $start_limit, $tpp ");  
复制代码

修改为

  1. /*$query = $db->query("SELECT  t.* FROM $table_threads t USE INDEX(displayorder)
  2.             WHERE t.fid='$fid' $filteradd
  3.             ORDER BY t.displayorder DESC, t.lastpost $ascdesc
  4.             LIMIT $start_limit, $tpp ");*/
  5. $query = $db->query("SELECT $dotadd1  t.* FROM $table_threads t  USE INDEX(displayorder) $dotadd2
  6.             WHERE t.fid='$fid' $filteradd
  7.             ORDER BY t.displayorder DESC, t.lastpost $ascdesc
  8.             LIMIT $start_limit, $tpp ");  
复制代码

2.修改forumdisplay.htm
找到:
  1. $thread[attachment]<a href="viewthread.php?tid=$thread[tid]&fpage=$page" $thread[highlight]
复制代码

后面添加
  1. title="$thread[shortmsg]"  
复制代码

3.修改common.js
找到
  1. popLayer.innerHTML=sPop.replace(/<(.*)>/g,"&lt;$1&gt;").replace(/n/g,"<br>");;  
复制代码

修改为
  1. popLayer.innerHTML=sPop;
  2.         //popLayer.innerHTML=sPop.replace(/<(.*)>/g,"&lt;$1&gt;").replace(/\n/g,"<br>");;  
复制代码

///////////////////////////////////////////////////////////////////////////////////////////
以下内容是对于有些人的需要所补充
修改:forumdisplay.htm
查找
  1. <td width="47%" bgcolor="{ALTBG2}" onMouseOver ="this.style.backgroundColor='{ALTBG1}'" onMouseOut ="this.style.backgroundColor='{ALTBG2}'">
  2.               <table cellpadding="0" cellspacing="0" border="0" width="100%" style="table-layout: fixed; word-wrap: break-word">
  3.                 <tr>
  4.                   </td>  
复制代码

修改如下
  1. <td width="47%" bgcolor="{ALTBG2}" onMouseOver ="this.style.backgroundColor='{ALTBG1}'" onMouseOut ="this.style.backgroundColor='{ALTBG2}'"  title="$thread[shortmsg]">
  2.               <table cellpadding="0" cellspacing="0" border="0" width="100%" style="table-layout: fixed; word-wrap: break-word">
  3.                 <tr>
  4.                   </td>  
复制代码

[ Last edited by 文文の封印 on 2005-5-12 at 21:37 ]
 楼主| PerfectWorks 发表于 2005-5-12 19:17:39 | 显示全部楼层
自己来沙发,顺便庆祝俺终于能发附件了
回复

使用道具 举报

 楼主| PerfectWorks 发表于 2005-5-12 19:18:19 | 显示全部楼层
补上效果图
回复

使用道具 举报

CAPCOM 发表于 2005-5-12 19:23:23 | 显示全部楼层
THANKS可是請問disczu!2.5sp1如何把menu做到好像你段透明?
回复

使用道具 举报

 楼主| PerfectWorks 发表于 2005-5-12 19:25:01 | 显示全部楼层
This
include/common.js

最底加入
  1. document.write("<style type='text/css'id='defaultPopStyle'>");
  2. document.write(".cPopText { font-family: Verdana, Tahoma; background-color: #DDEEFF; border: 1px #8899AA dashed; font-size: 12px; padding-right: 4px; padding-left: 4px; height: 20px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}");

  3. document.write("</style>");
  4. document.write("<div id='popLayer' style='position:absolute;z-index:1000;' class='cPopText'></div>");


  5. function showPopupText() {
  6.         var o=event.srcElement;
  7.         MouseX=event.x;
  8.         MouseY=event.y;
  9.         if(o.alt!=null && o.alt!="") { o.pop=o.alt;o.alt="" }
  10.         if(o.title!=null && o.title!=""){ o.pop=o.title;o.title="" }
  11.         if(o.pop!=sPop) {
  12.                 sPop=o.pop;
  13.                 if(sPop==null || sPop=="") {
  14.                         popLayer.style.visibility="hidden";        
  15.                 } else {
  16.                         if(o.dyclass!=null) popStyle=o.dyclass
  17.                         else popStyle="cPopText";
  18.                         popLayer.style.visibility="visible";
  19.                         showIt();
  20.                 }
  21.         }
  22. }

  23. function showIt() {
  24.         popLayer.className=popStyle;
  25.         popLayer.innerHTML=sPop.replace(/<(.*)>/g,"&lt;$1&gt;").replace(/\n/g,"<br>");;
  26.         popWidth=popLayer.clientWidth;
  27.         popHeight=popLayer.clientHeight;
  28.         if(MouseX+12+popWidth>document.body.clientWidth) popLeftAdjust=-popWidth-24
  29.                 else popLeftAdjust=0;
  30.         if(MouseY+12+popHeight>document.body.clientHeight) popTopAdjust=-popHeight-24
  31.                 else popTopAdjust=0;
  32.         popLayer.style.left=MouseX+12+document.body.scrollLeft+popLeftAdjust;
  33.         popLayer.style.top=MouseY+12+document.body.scrollTop+popTopAdjust;
  34. }
  35. document.onmouseover=showPopupText;
复制代码

[ Last edited by 文文の封印 on 2005-5-12 at 19:26 ]
回复

使用道具 举报

CAPCOM 发表于 2005-5-12 19:29:55 | 显示全部楼层
非謝感謝﹗已ok
回复

使用道具 举报

freddy 发表于 2005-5-12 20:02:47 | 显示全部楼层
我没语言了!
没话讲!立即加入精华!
回复

使用道具 举报

xjbl 发表于 2005-5-12 20:08:04 | 显示全部楼层
支持....偶也终于可以发附件了哈...

安逸哦...
回复

使用道具 举报

hszl 发表于 2005-5-12 21:31:34 | 显示全部楼层
common.js
中的:popLayer.innerHTML=sPop.replace(/<(.*)>/g,"&lt;$1&gt;").replace(/n/g,"<br>");;  
我怎么找不到啊?就include文件夹中有一个啊!怎么没有那句话!
我是2.5SP1

common.js 文件的内容:
/******************************************************************************
  Crossday Discuz! Board - Common Modules for Discuz!
  Modified by: Crossday Studio (http://crossday.com)
  Based upon:  http://www.cnzzz.com
*******************************************************************************/

var sPop = null;
var postSubmited = false;

function ctlent(obj) {
        if(postSubmited == false && (event.ctrlKey && window.event.keyCode == 13) || (event.altKey && window.event.keyCode == 83)) {
                if(this.document.input.pmsubmit) {
                        postSubmited = true;
                        this.document.input.pmsubmit.disabled = true;
                        this.document.input.submit();
                } else if(validate(this.document.input)) {
                        postSubmited = true;
                        if(this.document.input.topicsubmit) this.document.input.topicsubmit.disabled = true;
                        if(this.document.input.replysubmit) this.document.input.replysubmit.disabled = true;
                        if(this.document.input.editsubmit) this.document.input.editsubmit.disabled = true;
                        this.document.input.submit();
                }
        }
}
function checkall(form, prefix) {
        for(var i = 0; i < form.elements.length; i++) {
                var e = form.elements;
                if(e.name != 'chkall' && (!prefix || (prefix && e.name.match(prefix)))) {
                        e.checked = form.chkall.checked;
                }
        }
}

function findobj(n, d) {
        var p,i,x; if(!d) d=document;
        if((p=n.indexOf("?"))>0 && parent.frames.length) {
                d=parent.frames[n.substring(p+1)].document;
                n=n.substring(0,p);
        }
        if(!(x=d[n])&&d.all) x=d.all[n];
        for(i=0;!x && i<d.forms.length;i++) x=d.forms[n];
        for(i=0;!x && d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers.document);
        return x;
}

function copycode(obj) {
        var rng = document.body.createTextRange();
        rng.moveToElementText(obj);
        rng.scrollIntoView();
        rng.select();
        rng.execCommand("Copy");
        rng.collapse(false);
}

function dzconfirm(theURL, ConfirmMsg) {
        if (confirm( ConfirmMsg ))        {
                window.location.href=theURL;
        } else {
                return;
        }
}

[ Last edited by hszl on 2005-5-12 at 21:34 ]
回复

使用道具 举报

 楼主| PerfectWorks 发表于 2005-5-12 21:36:45 | 显示全部楼层
先进行5楼的修改
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-3-29 05:08 , Processed in 0.106343 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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