鼠标移动到主题显示最后回复内容 for dz5.x、dz6.0[更新适合 foxfire]
请大家根据自己的情况更改
名称:鼠标指向主题表格时显示最后回复等内容
功能:与权限挂钩,扩大鼠标反应区域至表格
修改:forumdisplay.php、forumdisplay.htm
演示:
http://www.rosesky.name/bbs/(5.0)
5.5、6.0演示效果与5.0一样!!!!
请大家多多支持,送个IP!!!
说明一点:下面没有标明5.0、5.5与6.0的三个版本都要修改
1.修改forumdisplay.php
5.0查找(此步查找不到请按5.5的方法)
$dotadd1 = $dotadd2 = '';
if($dotfolders && $discuz_uid) {
$dotadd1 = 'DISTINCT p.authorid AS dotauthor, ';
$dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND p.authorid='$discuz_uid')";
}复制代码
改为:
//e_zailai----鼠标指向主题表格时显示最后回复等内容--------开始
$dotadd1 = $dotadd2 = '';
if($dotfolders && $discuz_uid) {
$dotadd1 = "DISTINCT p.authorid AS dotauthor, p.subject AS re_subject, p.message, ";
$dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND p.authorid='$discuz_uid')";
}else {
$dotadd1 = "p.subject AS re_subject, p.message, ";
$dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND t.lastpost=p.dateline)";
}
//e_zailai----鼠标指向主题表格时显示最后回复等内容--------结束 复制代码
5.5 与 6.0查找:
if($whosonlinestatus == 2 || $whosonlinestatus == 3) {复制代码
上面添加:
//e_zailai----鼠标指向主题表格时显示最后回复等内容--------开始
$dotadd1 = $dotadd2 = '';
if($dotfolders && $discuz_uid) {
$dotadd1 = "DISTINCT p.authorid AS dotauthor, p.subject AS re_subject, p.message, ";
$dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND p.authorid='$discuz_uid')";
}else {
$dotadd1 = "p.subject AS re_subject, p.message, ";
$dotadd2 = "LEFT JOIN {$tablepre}posts p ON (t.tid=p.tid AND t.lastpost=p.dateline)";
}
//e_zailai----鼠标指向主题表格时显示最后回复等内容--------结束 复制代码
查找:
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);复制代码
添加:
//e_zailai----鼠标指向主题表格时显示最后回复等内容--------开始
if($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) {
$thread['message'] = "谢谢您的访问!由于权限不够,您仅可浏览本版主题标题。";
} elseif($thread['creditsrequire'] && $thread['creditsrequire'] > $credit && !$ismoderator) {
include language('messages');
eval("\$show_message = \"".$language[thread_nopermission]."\";");
$thread['message'] = $show_message;
} else {
$thread['message'] = preg_replace("/\[hide=?\d*\](.+?)\[\/hide\]/is", "**** 回复后才可查看信息 *****", $thread['message'] );
$thread['message'] = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "**** 付費信息,已經隱藏 *****", $thread['message'] );
$thread['message'] = preg_replace("/\[php](.+?)\[\/php\]/is", "**** 内容为PHP代码 *****", $thread['message'] );
$thread['message'] = preg_replace("/\[code](.+?)\[\/code\]/is", "**** 内容为普通代码 *****", $thread['message'] );
$thread['message'] = preg_replace("/\[quote](.+?)\[\/quote\]/is", "**** 内容为引用信息 *****", $thread['message'] );
$thread['message'] = preg_replace("/\[url=?(.+?)\](.+?)\[\/url\]/is", "**** 此处为超级链接 *****", $thread['message'] );
$thread['message'] = preg_replace("/\[img](.+?)\[\/img\]/is", "**** 此处为图片链接 *****", $thread['message'] );
$thread['message'] = str_replace('"', '"', $thread['message']);
$thread['message'] = str_replace('<', '<', $thread['message']);
$thread['message'] = str_replace('>', '>', $thread['message']);
$thread['message'] = str_replace("\r\n", " ◇ ", $thread['message']); //去掉回车,紧凑显示
$thread['message'] = cutstr($thread['message'],60); //内容截断
}
if($thread[replies]) {
$thread['shortmsg'] = '<b>主题:'.$thread[subject].'</b>
<b>回复:</b>'.$thread[re_subject].'
<font color=red>'.$thread[message].'</font>'.'
<font class=numtxt>最后发表:'.$thread[lastposter].'
主题作者:'.$thread[author].' 发表时间:'.$thread[dateline].'</font>';
} else {
$thread['shortmsg'] = '<b>主题:'.$thread[subject].'</b>
<font color=red>'.$thread[message].'</font>'.'
主题作者:'.$thread[author].' 发表时间:'.$thread[dateline].'</font>';
}
//e_zailai----鼠标指向主题表格时显示最后回复等内容--------结束 复制代码
[
如果您安装过全论坛置顶HACK直接进行第二步]
5.x与6.0都查找
$query = $db->query("SELECT t.* FROM {$tablepre}threads t 复制代码
修改为
/*$query = $db->query("SELECT t.* FROM {$tablepre}threads t*/
$query = $db->query("SELECT $dotadd1 t.* FROM {$tablepre}threads t $dotadd2 复制代码
2.修改forumdisplay.htm
5.x查找:
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"复制代码
6.0查找:
<a href="viewthread.php?tid=$thread[tid]&extra=$extra"复制代码
添加:
title="$thread[shortmsg]" 复制代码
3.修改common.js
5.0找到[
更新]
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>");
function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";
showIt();
}
}
}
function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/<(.*)>/g,"<$1>").replace(/\n/g,"
");
var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > document.body.clientWidth ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > document.body.clientHeight ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + document.body.scrollLeft + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + document.body.scrollTop + popTopAdjust) + 'px';
}复制代码
用下面代码替换
document.write("<style type='text/css'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color: #FFFFFF; border: 1px #666666 dotted; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80); opacity: 0.8;}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>")
function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";
showIt();
}
}
}
function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"
");
var bodySL, bodyST;
if(window.pageXOffset){
bodySL=window.pageXOffset;
}else if(document.documentElement&&document.documentElement.scrollLeft){
bodySL=document.documentElement.scrollLeft;
}else if(document.body){
bodySL=document.body.scrollLeft; //author: meizz
}
if(window.pageYOffset){
bodyST=window.pageYOffset;
}else if(document.documentElement&&document.documentElement.scrollTop){
bodyST=document.documentElement.scrollTop;
}else if(document.body){
bodyST=document.body.scrollTop;
}
var bodyCW, bodyCH;
if(window.innerWidth){
bodyCW=window.innerWidth;
}else if(document.documentElement&&document.documentElement.clientWidth){
bodyCW=document.documentElement.clientWidth;
}else if(document.body){
bodyCW=document.body.clientWidth; //author: meizz
}
if(window.innerHeight){
bodyCH=window.innerHeight;
}else if(document.documentElement&&document.documentElement.clientHeight){
bodyCH=document.documentElement.clientHeight;
}else if(document.body){
bodyCH=document.body.clientHeight;
}
if($('popLayer').clientWidth>300){
var popWidth = 300;
}else{
var popWidth = $('popLayer').clientWidth;
}
var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > bodyCW ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > bodyCH ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + bodySL + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + bodyST + popTopAdjust) + 'px';
}
if(!document.onmouseover) {
document.onmouseover = function(e) {
var event = e ? e : window.event;
showPopupText(event);
};
}复制代码
5.5、6.0在最底加入(5.0如果没有也需加上)[
修正 for foxfire]
document.write("<style type='text/css'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color: #DDEEFF; border: 1px #8899AA dashed; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80); opacity: 0.8;}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>")
function showPopupText(event) {
if(event.srcElement) o = event.srcElement; else o = event.target;
if(!o) {
return;
}
MouseX = event.clientX;
MouseY = event.clientY;
if(o.alt != null && o.alt != '') {
o.pop = o.alt;
o.alt = '';
}
if(o.title != null && o.title != '') {
o.pop = o.title;
o.title = '';
}
if(o.pop != sPop) {
sPop = o.pop;
if(sPop == null || sPop == '') {
$('popLayer').style.visibility = "hidden";
} else {
popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
$('popLayer').style.visibility = "visible";
showIt();
}
}
}
function showIt() {
$('popLayer').className = popStyle;
$('popLayer').innerHTML = sPop.replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"
");
var bodySL, bodyST;
if(window.pageXOffset){
bodySL=window.pageXOffset;
}else if(document.documentElement&&document.documentElement.scrollLeft){
bodySL=document.documentElement.scrollLeft;
}else if(document.body){
bodySL=document.body.scrollLeft; //author: meizz
}
if(window.pageYOffset){
bodyST=window.pageYOffset;
}else if(document.documentElement&&document.documentElement.scrollTop){
bodyST=document.documentElement.scrollTop;
}else if(document.body){
bodyST=document.body.scrollTop;
}
var bodyCW, bodyCH;
if(window.innerWidth){
bodyCW=window.innerWidth;
}else if(document.documentElement&&document.documentElement.clientWidth){
bodyCW=document.documentElement.clientWidth;
}else if(document.body){
bodyCW=document.body.clientWidth; //author: meizz
}
if(window.innerHeight){
bodyCH=window.innerHeight;
}else if(document.documentElement&&document.documentElement.clientHeight){
bodyCH=document.documentElement.clientHeight;
}else if(document.body){
bodyCH=document.body.clientHeight;
}
if($('popLayer').clientWidth>300){
var popWidth = 300;
}else{
var popWidth = $('popLayer').clientWidth;
}
var popWidth = $('popLayer').clientWidth;
var popHeight = $('popLayer').clientHeight;
var popLeftAdjust = MouseX + 12 + popWidth > bodyCW ? -popWidth - 24 : 0;
var popTopAdjust = MouseY + 12 + popHeight > bodyCH ? -popHeight - 24 : 0;
$('popLayer').style.left = (MouseX + 12 + bodySL + popLeftAdjust) + 'px';
$('popLayer').style.top = (MouseY + 12 + bodyST + popTopAdjust) + 'px';
}
if(!document.onmouseover) {
document.onmouseover = function(e) {
var event = e ? e : window.event;
showPopupText(event);
};
}复制代码
以下内容看情况再修改(扩大鼠标反应区域至表格)
1、修改forumdisplay.htm
5.0查找:<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="row" onMouseOver="this.className='row1'" onMouseOut="this.className='row'"复制代码
5.5查找:<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'"复制代码
6.0查找:<table summary="forum_$fid" id="forum_$fid" cellspacing="0" cellpadding="0"复制代码
添加: title="$thread[shortmsg]"复制代码
[
本帖最后由 e_zailai 于 2007-11-27 22:07 编辑 ]