恋雾迷尘论坛's Archiver

爱雨冷雪 发表于 2005-7-30 04:55

[小F半原创]把插件、风格、单插件、控制面板、统计加入下拉菜单

=============================================

美化HACK名称:把插件、风格、单插件、控制面板、统计加入下拉菜单[超级最终版]

适用版本: 2.5F & 2.5F SP1

作者: 童虎/园园科技

修改整理半原创:freddy

修改文件: common.js,cache.php,common.php

修改模板: header.htm,css.htm

最后发表日期:2005-06.21

技术支持与演示:http://www.51happy365.com/bbs/index.php

功能:作用:凡在后台加的正规的插件(如:银行,监狱,日记本,俱乐部,猜拳,乐透,结婚等插件),凡用plug导入的,在插件管理中心有显示的插件,均会在下拉菜单显示!!!还有,比如说,你论坛装了今日到访,天气预报,万年历,在线翻译,在线电视,在线算命,安全期测试等等,这些插件都是用| <a herf=..........>***</a>插入在header.htm的某个位置的!还有重要的风格下拉,统计下拉等等!!!这样,插件装多了,起到美观,方便的作用!建议大家都安装一下!

=============================================

以下内容跟帖回复才能看到
==============================

修改 include/common.js

于文件尾加入 ( 若之前已安装菜单 , 请将之前菜单的代码删掉 )

[code]<!--

var menuOffX=0        //菜单距连接文字最左端距离
var menuOffY=18        //菜单距连接文字顶端距离

var fo_shadows=new Array()
var linkset=new Array()


var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
function openScript(url, width, height){
        var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no' );
}

function showmenu(e,vmenu,mod){
        if (!document.all&&!document.getElementById&&!document.layers)
                return
        which=vmenu
        clearhidemenu()
        ie_clearshadow()
        menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
        menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
        
        if (ie4||ns6)
                menuobj.innerHTML=which
        else{
                menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
                menuobj.document.close()
        }
        menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
        menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
        
        eventX=ie4? event.clientX : ns6? e.clientX : e.x
        eventY=ie4? event.clientY : ns6? e.clientY : e.y
        
        var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
        var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
                if (rightedge<menuobj.contentwidth)
                        menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
                else
                        menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
               
                if (bottomedge<menuobj.contentheight&&mod!=0)
                        menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
                else
                        menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
        menuobj.thestyle.visibility="visible"
        ie_dropshadow(menuobj,"#999999",3)
        return false
}

function ie_y(e){  
        var t=e.offsetTop;  
        while(e=e.offsetParent){  
                t+=e.offsetTop;  
        }  
        return t;  
}  
function ie_x(e){  
        var l=e.offsetLeft;  
        while(e=e.offsetParent){  
                l+=e.offsetLeft;  
        }  
        return l;  
}  
function ie_dropshadow(el, color, size)
{
        var i;
        for (i=size; i>0; i--)
        {
                var rect = document.createElement('div');
                var rs = rect.style
                rs.position = 'absolute';
                rs.left = (el.style.posLeft + i) + 'px';
                rs.top = (el.style.posTop + i) + 'px';
                rs.width = el.offsetWidth + 'px';
                rs.height = el.offsetHeight + 'px';
                rs.zIndex = el.style.zIndex - i;
                rs.backgroundColor = color;
                var opacity = 1 - i / (i + 1);
                rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
                //el.insertAdjacentElement('afterEnd', rect);
                fo_shadows[fo_shadows.length] = rect;
        }
}
function ie_clearshadow()
{
        for(var i=0;i<fo_shadows.length;i++)
        {
                if (fo_shadows[i])
                        fo_shadows[i].style.display="none"
        }
        fo_shadows=new Array();
}


function contains_ns6(a, b) {
        while (b.parentNode)
                if ((b = b.parentNode) == a)
                        return true;
        return false;
}

function hidemenu(){
        if (window.menuobj)
                menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
        ie_clearshadow()
}

function dynamichide(e){
        if (ie4&&!menuobj.contains(e.toElement))
                hidemenu()
        else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
                hidemenu()
}

function delayhidemenu(){
        if (ie4||ns6||ns4)
                delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
        if (window.delayhide)
                clearTimeout(delayhide)
}

function highlightmenu(e,state){
        if (document.all)
                source_el=event.srcElement
        else if (document.getElementById)
                source_el=e.target
        if (source_el.className=="menuitems"){
                source_el.id=(state=="on")? "mouseoverstyle" : ""
        }
        else{
                while(source_el.id!="popmenu"){
                        source_el=document.getElementById? source_el.parentNode : source_el.parentElement
                        if (source_el.className=="menuitems"){
                                source_el.id=(state=="on")? "mouseoverstyle" : ""
                        }
                }
        }
}





//-->[/code]

修改 css.htm

于 </style> 前加入

[code].menuskin {
        filter: Alpha(Opacity=80);
        BORDER: #666666 1px solid; VISIBILITY: hidden; FONT: 12px Verdana;
        POSITION: absolute;
        BACKGROUND-COLOR:#FFFFFF;
        background-repeat : repeat-y;
        }
.menuskin A {
        PADDING-RIGHT: 9px; PADDING-LEFT: 7px; COLOR: black; TEXT-DECORATION: none; behavior:url(inc/noline.htc);
        }
#mouseoverstyle {
        BACKGROUND-COLOR: #F2F5FB; margin:2px; padding:0px; border:#8396C3 1px solid;
        }
#mouseoverstyle A {
        COLOR: black
}
.menuitems{
        margin:2px;padding:1px;word-break:keep-all;
}[/code]

打开include/cache.php

找到

[code]$data["pluglink"] .= '| <a href="plugins.php?p='.$plugs[plug_key].'"><font class="navtd">'.$plugs['plug_title'].'</font></a> ';[/code]

改成

[code]$data["pluglink"] .= '<div class=menuitems><a style=font-size:9pt;line-height:14pt; href=plugins.php?p='.$plugs[plug_key].'>'.$plugs['plug_title'].'</a></div>';[/code]

打开header.htm模板

找到<body标签位于这个之后一行加入:

[code]<div class=menuskin id=popmenu
      onmouseover="clearhidemenu();highlightmenu(event,'on')"
      onmouseout="highlightmenu(event,'off');dynamichide(event)" style="Z-index:100"></div>[/code]

找到

[code]$pluglink[/code]

改成

[code]| <a href="index.php " onMouseOver="showmenu(event,'$pluglink')" style="CURSOR:hand" ><b>社区设施</a>[/code]

=============================================

以上是后台插件自动加入下拉菜单!!!

=============================================



下载模板header.htm进行编辑!

(比如说,我现在装了天气预报和万年历插件,都是单独在首页一个一个显示的!)

可以看到:

[code]              | <a href="weather.php">天气预报</a>
              | <a href="wnl.php">万年历</a>[/code]

第一步

查找:

[code]| <a href="faq.php">{lang faq}</a>[/code]

在它的上行,加入以下:

[code]| <a href="index.php" onMouseOver="showmenu(event,'<div class=menuitems><a href=wnl.php >万年历</a></div> <div class=menuitems><a href=weather.php >天气预报</a></div> ')">社区工具</a>[/code]

然后把上面的我刚刚提到的


[code]              | <a href="weather.php">天气预报</a>
              | <a href="wnl.php">万年历</a>
[/code]

这个删除即可!!!

上传,更新缓存,刷新首页!就可以看到,社区工具里面有两个插件了!同样,虚拟形象,在线翻译,在线电视等等插件都可以依次类推!

[quote]
| <a href="index.php" onMouseOver="showmenu(event,'<div class=menuitems><a href=连接一地址>连接一</a></div> <div class=menuitems><a href=连接二地址>连接二地址</a></div> <div class=menuitems><a href=连接三地址>连接三</a></div> <div class=menuitems><a href=连接四地址>连接四</a></div> <div class=menuitems><a href=连接五地址>连接五</a></div> <div class=menuitems><a href=连接六地址>连接六</a></div> ')"><b><font color=red>社区百宝箱</font></b></a>
[/quote]

好了,会了吗?你自己添加!注意,不要有引号,不然不会成功的!简单吧!

=============================================

下面,风格的下拉:


打开cache.php

找:

[code]'settings'        => array('settings'[/code]

在句后加:

[code], 'stylelist'[/code]

继续找:

[code]                case onlinelist:
                        $table = $GLOBALS['table_onlinelist'];
                        $cols = "groupid,url,title";
                        $conditions = "WHERE 1 ORDER BY displayorder";
                        break;[/code]

在它的上方加入:

[code]                case stylelist:
                        $table = " $GLOBALS[table_styles] s LEFT JOIN $GLOBALS[table_members] m ";
                        $conditions = " ON m.styleid = s.styleid GROUP BY s.styleid ";
                        $cols = " s.styleid, s.name, COUNT(m.styleid) AS styleusers ";
                        break;[/code]

继续找:

[code]                case 'forums':
                        while($forum = $db->fetch_array($query)) {
                                $forum['name'] = strip_tags($forum['name']);
                                $data[$forum['fid']] = $forum;
                                unset($forum['fid']);
                        }
                        break;[/code]

在它的下面加入:

[code]                case 'stylelist':
                        while($stylelist = $db->fetch_array($query)) {
                                $data[] = $stylelist;
                        }
                        break;[/code]

打开common.php

查找:

[code]function daddslashes(&$string, $force = 0) {
        if(!$GLOBALS['magic_quotes_gpc'] || $force) {
                if(is_array($string) && count($string)) {
                        foreach($string as $key => $val) {
                                $string[$key] = daddslashes($val, $force);
                        }
                }elseif($string) {
                        $string = addslashes($string);
                }else{
                        $string = False;
                }
        }
        return $string;
}[/code]

在它的上面插入:

[code]if(is_array($_DCACHE['stylelist'])) {
    $stylemenu = '';
    $selected = 0;
    $currenturl = preg_replace("/(?:&?(sid\=[a-z0-9]{8}&?))/i", '', $HTTP_SERVER_VARS['QUERY_STRING']);
    $currenturl = preg_replace("/(?:&?(styleid\=\d+?&?))/i", '', $currenturl);
    $currenturl = $currenturl ? '?'.$currenturl.'&' : '?';
    foreach($_DCACHE['stylelist'] as $stylearray) {
        $stylemenu .= "<div class=menuitems><a href=$currenturl"."styleid=$stylearray[styleid]&sid=$sid >$stylearray[name]</a></div><span style=\'font-family:Georgia; color:gray\'>"."</span>";
        $selected += $stylearray['styleusers'];
    }
    $selected = $totalmembers - $selected;
    $stylemenu = "<span style=\'font-family:Georgia; color:gray\'>"."</span>".$stylemenu;
}[/code]

[code]| <a href="faq.php">{lang faq}</a>[/code]

[code]| <a href="###" onMouseOver="showmenu(event,'$stylemenu')" >风格习惯</a>[/code]

=============================================


下面是控制面板的下拉:

(要装过用户权限查询哦~嘿嘿~否则删除相应字段)

[code]<a href="memcp.php " onMouseOver="showmenu(event,'<div class=menuitems><a style=font-size:9pt;line-height:14pt; href=memcp.php?action=profile> 编辑资料</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=memcp.php?action=subscriptions> 订阅列表</a></div><div class=menuitems><a href=memcp.php?action=favorites> 收藏夹</a></div><div class=menuitems><a href=memcp.php?action=permission> 用户权限查询</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=pm.php>&nbsp短消息</a></div>')" style="CURSOR:hand" > 控制面板</a>[/code]

=============================================

统计的下拉:(要装过九命的在线时间4.4的!否则删除相应字段)

[code]| <a href="stats.php" OnMouseOut="delayhidemenu()"; onMouseOver="showmenu(event,'<div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php >基本概况</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=views >流量统计</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=agent >客户软件</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=forums >论坛统计</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=threads >主题排行</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=member >会员排行</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=online >在线时间</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=stats.php?type=team >管理团队</a></div>')"><font class="blod">{lang statistics}</font></a>[/code]

=============================================

播放器的下拉:(前提安装播放器)

[code]| <a href="../music/index.php" OnMouseOut="delayhidemenu()"; onMouseOver="showmenu(event,'<div class=menuitems><a style=font-size:9pt;line-height:14pt; href=../music/index.php target=_parent>播放</a></div><div class=menuitems><a style=font-size:9pt;line-height:14pt; href=index.php target=_parent>关闭</a></div>')"><font class="blod">音乐</font></a>[/code]

最后上传,后台缓存一定要更新!刷新首页!
哈哈!
这下强多了!

文件改完后上传,不要急于刷新首页!!先去后台更新缓存!!这步少了,等于白弄!!!

kikileo 发表于 2005-7-31 21:20

试一下

cqwu 发表于 2005-8-15 19:16

[Ylei_Au10]

qingqingbohe 发表于 2005-8-16 11:00

恩恩,看看

qingqingbohe 发表于 2005-8-16 11:04

不对啊CSS哪个文件在那里找了半天找不到

qingqingbohe 发表于 2005-8-16 11:11

修改 css.htm文件找不到啊

ice_季 发表于 2005-8-20 01:47

看看!!!

cuqk 发表于 2005-8-20 22:25

COMMON.PHP这个文件会出错!不知道是哪做错了!

cecill 发表于 2005-8-24 15:00

这个好~~~~~

lala 发表于 2005-8-25 04:01

CODE:  [复制]
--------------------------------------------------------------------------------

| <a href="faq.php">{lang faq}</a>
CODE:  [复制]
--------------------------------------------------------------------------------

| <a href="###" onMouseOver="showmenu(event,'$stylemenu')" >风格习惯</a>



这段是什么意思

sunnyboy81 发表于 2005-8-25 16:32

好东东,我要呀

森森爱春春 发表于 2005-9-1 14:08

天啊         楼主天才啊       我怎么就不会啊   55555555555

CanDy 发表于 2005-9-5 02:59

謝啦.....超有用..!

zerodream 发表于 2005-9-15 22:26

晕死了,我怎么不行啊,说的修改我都不行

乌头 发表于 2005-9-17 15:05

[Ylei_Au10]

elva1009 发表于 2005-9-21 11:50

静下心来仔细研究研究

L-Y 发表于 2005-9-21 17:15

怎么找那些文件啊

kazuki 发表于 2005-11-29 00:43

風格那個改了, 可是沒反應

hina 发表于 2006-1-3 17:41

每个论坛的管理后台都可以安装这些插件吗?

hina 发表于 2006-1-3 17:46

好象我的论坛不适用啊`哭```````````````

页: [1] 2

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.