📄 dhtmlxmenubar.js
字号:
thatM.realWinModeStart=1;
return;
}
else
thatM.realWinModeStart=0;
}
thatM.realWinModeStart=0;
thatM.ieWinModeState=0;
thatM.dropTimers(that.parentPanel);
thatM._closePanel(that.parentPanel);
thatM.lastSelectedItem=0;
thatM.probablyCloseMe=0;
thatM.lastOpenedPanel="";
if(that.parentPanel.topMenu.ieWinMode){
if(that.parentPanel.topMenu.olddoc)
document.body.onclick=that.parentPanel.topMenu.olddoc;
else
document.body.onclick=null;
}
if((that.parentPanel.topMenu.ieWinMode)&&(!that.parentPanel.parentPanel)&&(that.subMenu))
{
return;
}
that.parentPanel.topMenu._unMarkItem(that,"down");
setTimeout(new that.parentPanel.topMenu._delayedTimerCall(that,"_onclickY",0,0),100);
return;
};
dhtmlXMenuBarObject.prototype._onclickclose=function(e){
var that=this.currentActiveMenu;
if(that.olddoc)
document.body.onmouseup=that.olddoc;
else
document.body.onmouseup=null;
that.realWinModeStart=0;
that.lastOpenedPanel="";
that.ieWinModeState=0;
that.dropTimers(that);
that._closePanel(that);
that.lastSelectedItem=0;
}
dhtmlXMenuItemObject.prototype._onclickY=function(){
if((!this.persAction)||(this.persAction()))
if((!this.action)||(this.action(this.id)))
if(this.href){
if(this.target){
var form=this.parentPanel.topMenu.hiddenForm;
form.action=this.href;
form.target=this.target;
form.method="POST";
form.submit();
}
else document.location.href=this.href;
return false;
}
return false;
};
dhtmlXMenuItemObject.prototype._onmouseoverY=function(e){
var that=this.parentPanel.topMenu;
if((!that.ieWinMode)||(that.ieWinModeState))
this.parentPanel.topMenu._onItemOver(this,this.subMenu);
else
{
if((that.lastSelectedItem)&&(that.lastSelectedItem!=item))
this.parentPanel.topMenu._unMarkItem(that.lastSelectedItem);
this.parentPanel.topMenu._markItem(this);
}
};
dhtmlXMenuItemObject.prototype._onmouseoutY=function(e){
this.parentPanel.topMenu._onItemOut(this,this.subMenu);
};
dhtmlXMenuBarObject.prototype.dropTimers=function(panel){
if(!panel)return;
z=panel.topNod.timeoutop;
if(z)clearTimeout(z);
if(!panel.parentPanel)return;
var z=panel.parentPanel.topNod.timeoutop;
if(z)clearTimeout(z);
var z=panel.parentItem.topNod.timeoutop;
if(z)clearTimeout(z);
};
dhtmlXMenuBarObject.prototype._onmouseoverZ=function(e){
if(!e)e=event;e.cancelBubble=true;
that=this.panel.topMenu;
if(this.timeoutop)clearTimeout(this.timeoutop);
that.dropTimers(this.panel);
that._onItemOver(0,this.panel);
};
dhtmlXMenuBarObject.prototype._onmouseoutZ=function(e){
if(!e)e=event;e.cancelBubble=true;
that=this.panel.topMenu;
if(this.timeoutop)clearTimeout(this.timeoutop);
if((!that.ieWinMode))
{
this.timeoutop=setTimeout(new that._delayedTimerCall(this.panel.topMenu,"_onItemOut",0,this.panel),200);
}
};
dhtmlXMenuBarObject.prototype._delayedTimerCall=function(object,functionName,a,b,time){
this.callFunc=function(){
var ax=a;
var bx=b;
object[functionName](ax,bx);
}
return this.callFunc;
}
dhtmlXMenuBarObject.prototype._onItemOut=function(item,panel){
if(!panel){
if((item)&&(!item.subMenu))
this._unMarkItem(item);
return;
}
if(this.ieWinMode)
if((panel.topMenu==panel)||((item)&&(this.ieWinModeState==1)))return;
if(item)this._unMarkItem(item);
this._closePanel();
}
dhtmlXMenuBarObject.prototype._onItemOver=function(item,panel){
if(item){
if((this.lastSelectedItem)&&(this.lastSelectedItem!=item))
{
if((!this.lastSelectedItem.subMenu)||(this.lastSelectedItem.subMenu!=item.parentPanel))
this._unMarkItem(this.lastSelectedItem);
}
this.lastSelectedItem=item;
if(this.ieWinMode)
{
this._markItem(item,"down");
}
else
{
this._markItem(item);
}
var zp=item.parentPanel;
if((zp._lastSelectedItem)&&(zp._lastSelectedItem!=item))
if(zp._lastSelectedItem.subMenu)
this._closePanel(zp._lastSelectedItem.subMenu);
item.parentPanel._lastSelectedItem=item;
}
if(panel)this._openPanel(panel);
}
dhtmlXMenuBarObject.prototype._openPanel=function(panel){
if((this.lastOpenedPanel)&&(this.lastOpenedPanel!=panel)&&(this.lastOpenedPanel.parentPanel!=panel)&&(this.lastOpenedPanel!=panel.parentPanel))
{
this._closePanel(this.lastOpenedPanel);
}
var z=panel.topNod.timeoutop;
if(z)clearTimeout(z);
if(panel.topNod.style.display=="")return;
if(this.lastOpenedPanel!=panel)
{
this.lastOpenedPanel=panel;
switch(this.modeValue){
case "classic":
if(panel.topMenu!=panel.parentPanel){
panel.topNod.style.left=getAbsoluteLeft(panel.parentItem.topNod)*1+panel.parentItem.topNod.offsetWidth*1;
panel.topNod.style.top=getAbsoluteTop(panel.parentItem.topNod);}
else{
panel.topNod.style.left=getAbsoluteLeft(panel.parentItem.topNod);
panel.topNod.style.top=getAbsoluteTop(panel.parentItem.topNod)*1+panel.parentItem.topNod.offsetHeight*1-1;}
break;
case "popup":
panel.topNod.style.left=getAbsoluteLeft(panel.parentItem.topNod)*1+panel.parentItem.topNod.offsetWidth*1;
panel.topNod.style.top=getAbsoluteTop(panel.parentItem.topNod);
break;
case "betta":
if(panel.topMenu!=panel.parentPanel){
panel.topNod.style.left=getAbsoluteLeft(panel.parentItem.topNod)*1;
panel.topNod.style.top=getAbsoluteTop(panel.parentItem.topNod)+panel.parentItem.topNod.offsetHeight*1-1;}
else{
panel.topNod.style.left=getAbsoluteLeft(panel.parentItem.topNod)*1+panel.parentItem.topNod.offsetWidth*1;
panel.topNod.style.top=getAbsoluteTop(panel.parentItem.topNod);}
break;
case "alfa":
panel.topNod.style.top=getAbsoluteTop(panel.parentItem.topNod)*1+panel.parentItem.topNod.offsetHeight*1-1;
panel.topNod.style.left=getAbsoluteLeft(panel.parentItem.topNod);
break;
}
panel.topNod.style.display="";
if(panel.topNod.ieFix)
{
panel.topNod.ieFix.style.top=panel.topNod.style.top;
panel.topNod.ieFix.style.left=panel.topNod.style.left;
panel.topNod.ieFix.style.width=panel.topNod.offsetWidth;
panel.topNod.ieFix.style.height=panel.topNod.offsetHeight;
panel.topNod.ieFix.style.display="";
}
}
if(!this._skipAPP)this._fixPanelPosition(panel);
}
dhtmlXMenuBarObject.prototype._fixPanelPosition=function(panel,mode){
var uf=0;
if(panel.parentPanel){
var xs=document.body.offsetWidth-15+document.body.scrollLeft;
var ys=document.body.offsetHeight-15+document.body.scrollTop;
if((panel.topNod.offsetWidth+parseInt(panel.topNod.style.left))>xs)
{
if(!panel.parentPanel.extraMode){
var z=xs-panel.topNod.offsetWidth;
if(z<0)z=0;
panel.topNod.style.left=z;
if(panel.topNod.ieFix)panel.topNod.ieFix.style.left=z;
}
else{
var z=parseInt(panel.topNod.style.left)-panel.topNod.offsetWidth-panel.parentItem.topNod.offsetWidth;
if(z<0){
var z2=parseInt(panel.topNod.style.top)+panel.parentItem.topNod.offsetHeight;
panel.topNod.style.top=z2;
if(panel.topNod.ieFix)panel.topNod.ieFix.style.top=z2;
z=xs-panel.topNod.offsetWidth;if(z<0)z=0;}
panel.topNod.style.left=z;
if(panel.topNod.ieFix)panel.topNod.ieFix.style.left=z;
}
}
if((panel.topNod.offsetHeight+parseInt(panel.topNod.style.top))>ys)
{
if(panel.parentPanel.extraMode){
var z=ys-panel.topNod.offsetHeight;
if(z<0)z=0;
panel.topNod.style.top=z;
if(panel.topNod.ieFix)panel.topNod.ieFix.style.top=z;
}
else{
var z=parseInt(panel.topNod.style.top)-panel.topNod.offsetHeight-panel.parentItem.topNod.offsetHeight;
if(z<0){
var z2=parseInt(panel.topNod.style.left)+panel.parentItem.topNod.offsetWidth;
panel.topNod.style.left=z2;
if(panel.topNod.ieFix)panel.topNod.ieFix.style.left=z2;
uf=1;
z=ys-panel.topNod.offsetHeight;if(z<0)z=0;}
panel.topNod.style.top=z;
if(panel.topNod.ieFix)panel.topNod.ieFix.style.top=z;
}
}
}
if((uf)&&(!mode))this._fixPanelPosition(panel,1);
}
dhtmlXMenuBarObject.prototype._closePanel=function(panel){
if(!panel)return;
if((this.lastSelectedItem)&&(this.lastSelectedItem.parentPanel==panel))this._unMarkItem(this.lastSelectedItem);
this._closeBottomPanels(panel);
this._closeTopPanels(panel);
this.lastOpenedPanel="";
}
dhtmlXMenuBarObject.prototype._closeTopPanels=function(panel){
if((this.lastSelectedItem)&&(this.lastSelectedItem.parentPanel==panel))this._unMarkItem(this.lastSelectedItem);
for(var i=0;i<panel.itemsCount;i++)
{
var zi=panel.items[i];
if((zi.subMenu)&&(zi.subMenu.topNod.style.display!="none"))
{
zi.subMenu.topNod.style.display="none";
this._unMarkItem(zi.subMenu.parentItem);
if(zi.subMenu.topNod.ieFix)zi.subMenu.topNod.ieFix.style.display="none"
this._closeTopPanels(zi.subMenu);
return;
}
}
}
dhtmlXMenuBarObject.prototype._closeBottomPanels=function(panel,ieWinMode){
if(panel.parentPanel)
{
if((!this.lastSelectedItem)||(this.lastSelectedItem.parentPanel!=panel.parentPanel))
{
this._closeBottomPanels(panel.parentPanel);
}
else this.lastOpenedPanel=panel;
panel.topNod.style.display="none";
this._unMarkItem(panel.parentItem);
if(panel.topNod.ieFix)panel.topNod.ieFix.style.display="none"
}
}
dhtmlXMenuBarObject.prototype._unMarkItem=function(item){
item.CSSTag.className=item.className;
if(item.CSSImageTag)item.CSSImageTag.className="";
if((item.childMenuTag.src!="")&&(this.topMenu.echsw)&&(this.topMenu.echsw2))
item.childMenuTag.src=this.sysGfxPath+"btn_rt1.gif";
}
dhtmlXMenuBarObject.prototype._markItem=function(item,over){
over=over||"over";
item.CSSTag.className=item.className+over;
if(item.CSSImageTag)item.CSSImageTag.className=item.className+over+"img";
if((item.childMenuTag.src!="")&&(this.topMenu.echsw)&&(this.topMenu.echsw2))
item.childMenuTag.src=this.sysGfxPath+"btn_rt2.gif";
}
dhtmlXMenuBarObject.prototype.setMenuMode=function(modeValue){
this.modeValue=modeValue;
switch(modeValue){
case "classic":
this.addFirstLevel=this._addItem;
this.addSecondLevel=this.addItem_vertical;
break;
case "alfa":
this.addFirstLevel=this._addItem;
this.addSecondLevel=this._addItem;
break;
case "popup":
this.addFirstLevel=this.addItem_vertical;
this.addSecondLevel=this.addItem_vertical;
break;
case "betta":
this.addFirstLevel=this.addItem_vertical;
this.addSecondLevel=this._addItem;
break;
};
}
function dhtmlXMenuDividerYObject(id){
this.topNod=0;
if(id)this.id=id;else this.id=0;
td=document.createElement("td");
this.topNod=td;td.align="center";td.style.padding="2 2 1 2";
td.innerHTML="<div class='menuDividerY'> </div>";
if(!document.all)td.childNodes[0].style.height="0px";
return this;
};
dhtmlXMenuDividerYObject.prototype = new dhtmlXButtonPrototypeObject;
function dhtmlXMenuDividerXObject(id){
this.topNod=0;
if(id)this.id=id;else this.id=0;
td=document.createElement("td");
this.topNod=td;td.align="center";td.style.paddingRight="2";td.style.paddingLeft="2";td.width="4px";
td.innerHTML="<div class='menuDivider'></div >";
if(!document.all){td.childNodes[0].style.width="0px";td.style.padding="0 0 0 0";td.style.margin="0 0 0 0";}
return this;
};
dhtmlXMenuDividerXObject.prototype = new dhtmlXButtonPrototypeObject;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -