📄 menu.ie.js
字号:
window.open(this.action,this.target);else document.location.href=this.action;}};MenuItem.prototype.setSelected=function(bSelected){if(this._selected==bSelected)return;this._selected=Boolean(bSelected);var tr=this._htmlElement;if(tr)
tr.className=this.getCssClass();if(!this._selected)
this.closeSubMenu(true);var pm=this.parentMenu;if(bSelected){pm.setSelectedIndex(this.itemIndex);this.scrollIntoView();if(pm.parentMenuItem)
pm.parentMenuItem.setSelected(true);}
else pm.setSelectedIndex(-1);if(this._selected){window.clearTimeout(pm._closeTimer);}};MenuItem.prototype.getSelected=function(){return this.itemIndex==this.parentMenu.selectedIndex;};MenuItem.prototype.showSubMenu=function(bDelayed){var sm=this.subMenu;var pm=this.parentMenu;if(sm&&!this.disabled){pm._aboutToShowSubMenu=true;window.clearTimeout(sm._showTimer);window.clearTimeout(sm._closeTimer);var showTimeout=bDelayed?sm.showTimeout:0;var oThis=this;sm._showTimer=window.setTimeout("eventListeners.menuItem.onshowtimer(\""+this.id+"\")",showTimeout);}};MenuItem.prototype.closeSubMenu=function(bDelay){var sm=this.subMenu;if(sm){window.clearTimeout(sm._showTimer);window.clearTimeout(sm._closeTimer);if(sm.popup){if(!bDelay)
sm.close();else{var oThis=this;sm._closeTimer=window.setTimeout("eventListeners.menuItem.onclosetimer(\""+this.id+"\")",sm.closeTimeout);}}}};MenuItem.prototype.scrollIntoView=function(){if(this.parentMenu._scrollingMode){var d=this.parentMenu.getDocument();var sc=d.getElementById("scroll-container");var scrollTop=sc.scrollTop;var clientHeight=sc.clientHeight;var offsetTop=this._htmlElement.offsetTop;var offsetHeight=this._htmlElement.offsetHeight;if(offsetTop<scrollTop)
sc.scrollTop=offsetTop;else if(offsetTop+offsetHeight>scrollTop+clientHeight)
sc.scrollTop=offsetTop+offsetHeight-clientHeight;}};MenuItem.prototype.positionSubMenu=function(){var dir=this.subMenuDirection;var el=this._htmlElement;var useInsets=this._useInsets;var sm=this.subMenu;var oThis=this;if(!sm._isCssFileLoaded()){window.setTimeout("eventListeners.menuItem.onpositionsubmenutimer(\""+this.id+"\")",1);return;}
var rect={left:posLib.getScreenLeft(el),top:posLib.getScreenTop(el),width:el.offsetWidth,height:el.offsetHeight};var menuRect={left:sm.getLeft(),top:sm.getTop(),width:sm.getPreferredWidth(),height:sm.getPreferredHeight(),insetLeft:useInsets?sm.getInsetLeft():0,insetRight:useInsets?sm.getInsetRight():0,insetTop:useInsets?sm.getInsetTop():0,insetBottom:useInsets?sm.getInsetBottom():0};var screenWidth=screen.width;var screenHeight=screen.height;while(rect.left>screenWidth)
screenWidth+=screen.width;while(rect.top>screenHeight)
screenHeight+=screen.height;var left,top,width=menuRect.width,height=menuRect.height;if(dir=="vertical"){if(rect.left+menuRect.width-menuRect.insetLeft<=screenWidth)
left=rect.left-menuRect.insetLeft;else if(screenWidth>=menuRect.width)
left=screenWidth-menuRect.width;else left=0;if(rect.top+rect.height+menuRect.height-menuRect.insetTop<=screenHeight)
top=rect.top+rect.height-menuRect.insetTop;else if(rect.top-menuRect.height+menuRect.insetBottom>=0)
top=rect.top-menuRect.height+menuRect.insetBottom;else{var sizeAbove=rect.top+menuRect.insetBottom;var sizeBelow=screenHeight-rect.top-rect.height+menuRect.insetTop;if(sizeBelow>=sizeAbove){top=rect.top+rect.height-menuRect.insetTop;height=sizeBelow;}
else{top=0;height=sizeAbove;}}}
else{if(rect.top+menuRect.height-menuRect.insetTop<=screenHeight)
top=rect.top-menuRect.insetTop;else if(rect.top+rect.height-menuRect.height+menuRect.insetBottom>=0)
top=rect.top+rect.height-menuRect.height+menuRect.insetBottom;else if(screenHeight>=menuRect.height)
top=screenHeight-menuRect.height;else{top=0;height=screenHeight}
if(rect.left+rect.width+menuRect.width-menuRect.insetLeft<=screenWidth)
left=rect.left+rect.width-menuRect.insetLeft;else if(rect.left-menuRect.width+menuRect.insetRight>=0)
left=rect.left-menuRect.width+menuRect.insetRight;else if(screenWidth>=menuRect.width)
left=screenWidth-menuRect.width;else left=0;}
var scrollBefore=sm._scrollingMode;sm.show(left,top,width,height);if(sm._scrollingMode!=scrollBefore)
this.positionSubMenu();};MenuItem.prototype.destroy=function(){if(this.subMenu!=null)
this.subMenu.destroy();this.subMenu=null;this.parentMenu=null;var el=this._htmlElement
if(el!=null)
el._menuItem=null;this._htmlElement=null;menuCache.remove(this);};function CheckBoxMenuItem(sLabelText,bChecked,fAction,oSubMenu){this.MenuItem=MenuItem;this.MenuItem(sLabelText,fAction,null,oSubMenu);this.checked=bChecked;}
CheckBoxMenuItem.prototype=new MenuItem;CheckBoxMenuItem.prototype.getIconHtml=function(){return"<span class=\"check-box\">"+(this.checked?"a":" ")+"</span>";};CheckBoxMenuItem.prototype.getIconCellHtml=function(){return"<td class=\"icon-cell\">"+this.makeDisabledContainer(this.getIconHtml())+"</td>";};CheckBoxMenuItem.prototype.getCssClass=function(){var s=(this.checked?" checked":"");if(this.disabled&&this._selected)
return"disabled-hover"+s;else if(this.disabled)
return"disabled"+s;else if(this._selected)
return"hover"+s;return s;};CheckBoxMenuItem.prototype._menuItem_dispatchAction=MenuItem.prototype.dispatchAction;CheckBoxMenuItem.prototype.dispatchAction=function(){if(!this.disabled){this.checked=!this.checked;this._menuItem_dispatchAction();this.parentMenu.invalidate();this.parentMenu.closeAllMenus();}};function RadioButtonMenuItem(sLabelText,bChecked,sRadioGroupName,fAction,oSubMenu){this.MenuItem=MenuItem;this.MenuItem(sLabelText,fAction,null,oSubMenu);this.checked=bChecked;this.radioGroupName=sRadioGroupName;}
RadioButtonMenuItem.prototype=new MenuItem;RadioButtonMenuItem.prototype.getIconHtml=function(){return"<span class=\"radio-button\">"+(this.checked?"n":" ")+"</span>";};RadioButtonMenuItem.prototype.getIconCellHtml=function(){return"<td class=\"icon-cell\">"+this.makeDisabledContainer(this.getIconHtml())+"</td>";};RadioButtonMenuItem.prototype.getCssClass=function(){var s=(this.checked?" checked":"");if(this.disabled&&this._selected)
return"disabled-hover"+s;else if(this.disabled)
return"disabled"+s;else if(this._selected)
return"hover"+s;return s;};RadioButtonMenuItem.prototype._menuItem_dispatchAction=MenuItem.prototype.dispatchAction;RadioButtonMenuItem.prototype.dispatchAction=function(){if(!this.disabled){if(!this.checked){var items=this.parentMenu.items;var l=items.length;for(var i=0;i<l;i++){if(items[i]instanceof RadioButtonMenuItem){if(items[i].radioGroupName==this.radioGroupName){items[i].checked=items[i]==this;}}}
this.parentMenu.invalidate();}
this._menuItem_dispatchAction();this.parentMenu.closeAllMenus();}};function MenuSeparator(){this.MenuItem=MenuItem;this.MenuItem();}
MenuSeparator.prototype=new MenuItem;MenuSeparator.prototype.toHtml=function(){return"<tr class=\""+this.getCssClass()+"\""+(!this.visible?" style=\"display: none\"":"")+"><td colspan=\"4\">"+"<div class=\"separator-line\"></div>"+"</td></tr>";};MenuSeparator.prototype.getCssClass=function(){return"separator";};function MenuBar(){this.items=[];this.parentMenu=null;this.parentMenuItem=null;this.shownSubMenu=null;this._aboutToShowSubMenu=false;this.active=false;this.id=menuCache.getId();menuCache[this.id]=this;}
MenuBar.prototype=new Menu;MenuBar.prototype._document=null;MenuBar.leftMouseButton=1;MenuBar.prototype.toHtml=function(){var items=this.items;var l=items.length;var itemsHtml=new Array(l);for(var i=0;i<l;i++)
itemsHtml[i]=items[i].toHtml();return"<div class=\"menu-bar\" id=\""+this.id+"\">"+itemsHtml.join("")+"</div>";};MenuBar.prototype.invalidate=function(){if(this._htmlElement){this.detachEvents();var oldEl=this._htmlElement;var newEl=this.create(this._document);oldEl.parentNode.replaceChild(newEl,oldEl);}};MenuBar.prototype.createPopup=function(){};MenuBar.prototype.getPopup=function(){};MenuBar.prototype.drawMenu=function(){};MenuBar.prototype.getDocument=function(){return this._document;};MenuBar.prototype.show=function(left,top,w,h){};MenuBar.prototype.isShown=function(){return true;};MenuBar.prototype.fixSize=function(){}
MenuBar.prototype.getWidth=function(){return this._htmlElement.offsetWidth;};MenuBar.prototype.getHeight=function(){return this._htmlElement.offsetHeight;};MenuBar.prototype.getPreferredWidth=function(){var el=this._htmlElement;el.runtimStyle.whiteSpace="nowrap";var sw=el.scrollWidth;el.runtimStyle.whiteSpace="";return sw+parseInt(el.currentStyle.borderLeftWidth)+parseInt(el.currentStyle.borderRightWidth);};MenuBar.prototype.getPreferredHeight=function(){var el=this._htmlElement;el.runtimStyle.whiteSpace="nowrap";var sw=el.scrollHeight;el.runtimStyle.whiteSpace="";return sw+parseInt(el.currentStyle.borderTopWidth)+parseInt(el.currentStyle.borderBottomWidth);};MenuBar.prototype.getLeft=function(){return posLib.getScreenLeft(this._htmlElement);};MenuBar.prototype.getTop=function(){return posLib.getScreenLeft(this._htmlElement);};MenuBar.prototype.setLeft=function(l){};MenuBar.prototype.setTop=function(t){};MenuBar.prototype.setLocation=function(l,t){};MenuBar.prototype.setRect=function(l,t,w,h){};MenuBar.prototype.getInsetLeft=function(){return parseInt(this._htmlElement.currentStyle.borderLeftWidth);};MenuBar.prototype.getInsetRight=function(){return parseInt(this._htmlElement.currentStyle.borderRightWidth);};MenuBar.prototype.getInsetTop=function(){return parseInt(this._htmlElement.currentStyle.borderTopWidth);};MenuBar.prototype.getInsetBottom=function(){return parseInt(this._htmlElement.currentStyle.borderBottomWidth);};MenuBar.prototype.fixScrollButtons=function(){};MenuBar.prototype.fixScrollEnabledState=function(){};MenuBar.prototype.makeEventListeners=function(){if(this.eventListeners!=null)
return;this.eventListeners={onmouseover:new Function("eventListeners.menuBar.onmouseover(\""+this.id+"\")"),onmouseout:new Function("eventListeners.menuBar.onmouseout(\""+this.id+"\")"),onmousedown:new Function("eventListeners.menuBar.onmousedown(\""+this.id+"\")"),onkeydown:new Function("eventListeners.menuBar.onkeydown(\""+this.id+"\")"),onunload:new Function("eventListeners.menuBar.onunload(\""+this.id+"\")")};};MenuBar.prototype.detachEvents=function(){if(this.eventListeners==null)
return;this._htmlElement.detachEvent("onmouseover",this.eventListeners.onmouseover);this._htmlElement.detachEvent("onmouseout",this.eventListeners.onmouseout);this._htmlElement.detachEvent("onmousedown",this.eventListeners.onmousedown);this._document.detachEvent("onkeydown",this.eventListeners.onkeydown);window.detachEvent("onunload",this.eventListeners.onunload);}
MenuBar.prototype.hookupMenu=function(element){if(!this._document)
this._document=element.document;this.detachEvents();this.makeEventListeners();this._htmlElement=element;element.unselectable="on";var cs=element.childNodes;var items=this.items;var l=cs.length;for(var i=0;i<l;i++){items[i]._htmlElement=cs[i];cs[i]._menuItem=items[i];}
element.attachEvent("onmouseover",this.eventListeners.onmouseover);element.attachEvent("onmouseout",this.eventListeners.onmouseout);element.attachEvent("onmousedown",this.eventListeners.onmousedown);this._document.attachEvent("onkeydown",this.eventListeners.onkeydown);window.attachEvent("onunload",this.eventListeners.onunload);};function getMenuItemElement(el){while(el!=null&&el._menuItem==null)
el=el.parentNode;return el;}
function getTrElement(el){while(el!=null&&el.tagName!="TR")
el=el.parentNode;return el;}
MenuBar.prototype.write=function(oDocument){this._document=oDocument||document;this._document.write(this.toHtml());var el=this._document.getElementById(this.id);this.hookupMenu(el);};MenuBar.prototype.create=function(oDocument){this._document=oDocument||document;var dummyDiv=this._document.createElement("DIV");dummyDiv.innerHTML=this.toHtml();var el=dummyDiv.removeChild(dummyDiv.firstChild);this.hookupMenu(el);return el;};MenuBar.prototype.handleKeyEvent=function(e){if(this.getActiveState()=="open")
return;var nKeyCode=e.keyCode;if(this.active&&e[Menu.keyboardAccelProperty]){e.returnValue=false;e.keyCode=0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -