⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spmenu.js

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 JS
📖 第 1 页 / 共 5 页
字号:
			  }

				if (this.direction == 'rtl')
					oMenu.style.left = spm_getCoord(oPDims.l - oMDims.w - spm_getBodyScrollLeft());
				else
					oMenu.style.left = spm_getCoord(oPDims.l + oPDims.w - spm_getBodyScrollLeft());

				if (this.direction == 'rtl')
				{
					if (oMDims.l - spm_getBodyScrollLeft() < 0)
						oMenu.style.left = spm_getCoord(oPDims.l + oPDims.w - spm_getBodyScrollLeft());
				}
				else  
				{
					if (oPDims.l - spm_getBodyScrollLeft() + oPDims.w + oMDims.w > spm_getViewPortWidth())
						oMenu.style.left = spm_getCoord(oPDims.l - oMDims.w - spm_getBodyScrollLeft());
				}
					
				this._m_aOpenMenuID[this._m_aOpenMenuID.length] = sID;
				if (this.useIFrames)
					spm_iFrameIndex(oMenu, true, this.systemImagesPath);
				else
					spm_hideElement("SELECT|OBJECT",oMenu);

			}
		}
		this.fireEvent('onMenuItemMouseOver', oRow);
		
	}
	
  //--- handles mouseout for menu item ---//
	SolpartMenu.prototype.handlembi_mout = function (oRow)
	{
			var sID = oRow.id.substr(2);

			oRow.className = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));
		  spm_getById("icon" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmicn') + this.cssMenuIcon);
		  spm_getById("td" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oRow, 'savecss', ''));
		  spm_getById("arrow" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmarw') + this.cssMenuArrow);
			
			if (this.selBorderColor != '')
				spm_applyRowBorder(oRow, 1, "", false);

      this.stopTransition();
	}

  //used for raising events to client javascript
  SolpartMenu.prototype.fireEvent = function (sEvent, src) 
  {
		return; //disabled for now
    if (eval('this.' + sEvent + ' != null'))
		{
			var e = new Object();
			if (src != null)
				e.srcElement = src;
			else
				e.srcElement = this._m_oMenu;
				
				eval('this.' + sEvent + '(e)');
		}
  }

	//--- called by setTimeOut to check mouseout hide delay ---//
	SolpartMenu.prototype.hideMenuTime = function ()
  {
    if (this._m_dHideTimer != null && this.moutDelay > 0)
    {
      if (new Date() - this._m_dHideTimer >= this.moutDelay)
      {
        this.hideAllMenus();
        this._m_dHideTimer = null;
      }
      else
        setTimeout(this.hideMenuTime, this.moutDelay);
    }
  }

	SolpartMenu.prototype.mouseInDelayHandler = function ()
	{
		if (this.minDelayType == 'root')
			this.onMBMO(this.minDelayObj, true);
		else if (this.minDelayType == 'sub')
			this.handlembi_mo(this.minDelayObj, true);
		this.minDelayTimer = null;
		this.minDelayObj = null;
	}

	//--- called by setTimeOut to check mouseout hide delay ---//
	SolpartMenu.prototype.scrollMenu = function ()
  {
		if (this._m_oScrollingMenu != null)
		{
			if (spm_ScrollMenuClick(this._m_oScrollingMenu) == false)
				setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].scrollMenu()', 500);
			else
				this._m_oScrollingMenu = null;
		}
  }

//global
	function spm_iFrameIndex(eMenu, bShow, sysImgPath)
	{
		if (spm_browserType() == 'op')
			return;	//not needed
		
		if (document.readyState != 'complete')
			return;	//avoid operation aborted
		
		if (bShow)
		{
			var oIFR=spm_getById('ifr' + eMenu.id);
			if (oIFR == null)
			{
				var oIFR = document.createElement('iframe');
				oIFR.id = 'ifr' + eMenu.id;
				//oIFR.src = 'javascript: void(0);';
				oIFR.src = sysImgPath + 'spacer.gif';
				oIFR.style.top = spm_getCoord(0);
				oIFR.style.left = spm_getCoord(0);
				oIFR.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
				oIFR.scrolling = 'no';
				oIFR.frameBorder = 'no';
				oIFR.style.display = 'none';
				oIFR.style.position = 'absolute';
				document.body.appendChild(oIFR);
			}
			var oMDims = new spm_elementDims(eMenu);
			
			oIFR.style.width=oMDims.w;
			oIFR.style.height=oMDims.h;
			oIFR.style.top=spm_getCoord(oMDims.t);
			oIFR.style.left=spm_getCoord(oMDims.l);
			
			var iIndex = spm_getCurrentStyle(eMenu, 'zIndex');	//eMenu.style.zIndex;
			if (iIndex == null || iIndex == 0)
				eMenu.style.zIndex = 1;
			oIFR.style.zIndex=iIndex-1;
			oIFR.style.display="block";
		}
		else if (spm_getById('ifr' + eMenu.id) != null)
		{
			spm_getById('ifr' + eMenu.id).style.display='none';
		}
	}

	function spm_showElement(elmID)
	{
		if (spm_browserType() == 'op')
			return;	//not needed

		// Display any element that was hidden
		var sTags = elmID.split('|');
		for (var x=0; x<sTags.length; x++)
		{
			elmID = sTags[x];
			for (var i = 0; i < spm_getTags(elmID).length; i++)
			{
				obj = spm_getTags(elmID)[i];
				if (! obj || ! obj.offsetParent)
					continue;
				obj.style.visibility = "";
			}
		}
	}

	function spm_hideElement(elmID, eMenu)
	{
		if (spm_browserType() == 'op')
			return;	//not needed

		var obj;
		// Hide any element that overlaps with the dropdown menu
		var sTags = elmID.split('|');
		
		var oMDims = new spm_elementDims(eMenu);
		
		for (var x=0; x<sTags.length; x++)
		{
			elmID = sTags[x];
			for (var i = 0; i < spm_getTags(elmID).length; i++)
			{
				obj = spm_getTags(elmID)[i];
				var oODims = new spm_elementDims(obj);
				
				if (oODims.t > oMDims.t + oMDims.h)
				{
					//if element is below bottom of menu then do nothing
				}
				else if (oODims.l > oMDims.l + oMDims.w)
				{
					//if element is to the right of menu then do nothing
				}
				else if (oODims.l + oODims.w < oMDims.l)
				{
					//if element is to the left of menu then do nothing
				}
				else if (oODims.t + oODims.h < oMDims.t)
				{
					//if element is to the top of menu then do nothing
				}
				else
				{
					obj.style.visibility = "hidden";
				}
			}
		}
	}

	function spm_positionMenu(me, oMenu, oCell)
	{

		spm_resetScroll(oMenu);

		var oPDims = new spm_elementDims(oCell, false, me);
		
		if (me.display == 'vertical')
		{
			oMenu.style.top = spm_getCoord(oPDims.t);
			var oMDims = new spm_elementDims(oMenu);

			if (oMDims.t - spm_getBodyScrollTop() + oMDims.h >= spm_getViewPortHeight())
			{
				if (oMDims.h < spm_getViewPortHeight())
					oMenu.style.top = spm_getCoord(spm_getViewPortHeight() - oMDims.h + spm_getBodyScrollTop());	
				else
					spm_handleScrollMenu(me, oMenu);
			}
			
			var oOrigMDims;
			
			if (spm_browserType() != 'ie') //since mozilla doesn't set width greater than window size we need to store it here
				 oOrigMDims = new spm_elementDims(oMenu);
			
      if (me.direction == 'rtl')                
      {
          var oMDims2 = new spm_elementDims(oMenu);
          oMenu.style.left = spm_getCoord((oPDims.l) - oMDims2.w - spm_getBodyScrollLeft());
      }
      else
          oMenu.style.left = spm_getCoord(oPDims.l + oPDims.w - spm_getBodyScrollLeft());
					
			oMDims = new spm_elementDims(oMenu);
			if (oOrigMDims == null)
				oOrigMDims = oMDims;
			
			if (oMDims.l - spm_getBodyScrollLeft(true) + oOrigMDims.w > spm_getViewPortWidth())
			{
			  if (spm_getViewPortWidth() - oOrigMDims.w > 0)  //only do this if it fits
				  oMenu.style.left = spm_getCoord(oPDims.l - oOrigMDims.w - spm_getBodyScrollLeft(true));
			}

			//oMenu.style.display = "";
		}
		else
		{
			if (me.direction == 'rtl')			
			{
				var oMDims2 = new spm_elementDims(oMenu);
				oMenu.style.left = spm_getCoord((oPDims.l + oPDims.w) - oMDims2.w - spm_getBodyScrollLeft());
			}
			else			
				oMenu.style.left = spm_getCoord(oPDims.l - spm_getBodyScrollLeft());
				
			oMenu.style.top = spm_getCoord(oPDims.t + oPDims.h);
			var oMDims = new spm_elementDims(oMenu);
			
			if (oMDims.l - spm_getBodyScrollLeft(true) + oMDims.w > spm_getViewPortWidth())
			{
			  if (spm_getViewPortWidth() - oMDims.w > 0)  //only do this if it fits
				  oMenu.style.left = spm_getCoord(spm_getViewPortWidth() - oMDims.w + spm_getBodyScrollLeft(true));
			}
			
			if (oMDims.t - spm_getBodyScrollTop() + oMDims.h > spm_getViewPortHeight())
			{
			  if (oPDims.t - oMDims.h - spm_getBodyScrollTop() > 0) //only do this if it fits
				  oMenu.style.top = spm_getCoord(oPDims.t - oMDims.h);	//place above menu bar
				else
					spm_handleScrollMenu(me, oMenu);
			}
			//oMenu.style.display = "none";
		}
	}

	//--------- Internal (private) Functions --------//
	//--- Applies border to cell ---//
	SolpartMenu.prototype.applyBorder = function (oCell, iSize, sTopLeftColor, sBottomRightColor, sStyle)
	{
		if (this.moDisplay == 'Outset')
		{
			if (sStyle == null)
				sStyle = "solid";

			if (sTopLeftColor.length > 0 && sBottomRightColor.length > 0)
			{
				if (oCell.tagName == 'TR')
					oCell = oCell.childNodes(0);
				
				oCell.style.borderTop = sStyle + " " + iSize + "px " + sTopLeftColor;
				oCell.style.borderLeft = sStyle + " " + iSize + "px " + sTopLeftColor;
				oCell.style.borderRight = sStyle + " " + iSize + "px " + sBottomRightColor;
				oCell.style.borderBottom = sStyle + " " + iSize + "px " + sBottomRightColor;	
				
			}
		}
		if (this.moDisplay == 'HighLight')
		{
			if (sTopLeftColor == this.backColor)
			{
        oCell.className = spm_fixCSSForMac(this.getIntCSSName('spmbar spmitm') + ' ' + this.cssMenuItem + ' ' + spm_getAttr(oCell, 'savecss', ''));
			}
			else
			{
        oCell.className = spm_fixCSSForMac(this.getIntCSSName('spmbar spmitmsel') + ' ' + this.cssMenuItemSel + ' ' + spm_getAttr(oCell, 'saveselcss', ''));
			}
		}		
	}

	function spm_applyRowBorder(oRow, iSize, sColor, bSelected, sStyle)
	{
		if (oRow.cells.length == 0) //(spm_browserType() == 'safari')
			return;	//safari has issues with accessing cell
		
		var sColor2=sColor;
		if (sStyle == null)
			sStyle = "solid";

		if (sColor == "")
		{
				sColor2 = spm_getCurrentStyle(oRow.cells[0], 'background-Color');
				if ((sColor2 == null || sColor2 == '') && spm_browserType() != 'ie')
					sColor2 = 'transparent';
		}

		spm_applyBorders(oRow.cells[0], sStyle, iSize, sColor2, true, true, false, true);

		if (sColor == "" && bSelected == false)
    {
      sColor2 = spm_getCellBackColor(oRow.cells[1]);
      if (sColor2 == null || sColor2 == '')
				sColor2 = 'transparent';
    }
   
    //if (sColor2 != 'transparent')
    //{
			spm_applyBorders(oRow.cells[1], sStyle, iSize, sColor2, true, false, false, true);
			spm_applyBorders(oRow.cells[2], sStyle, iSize, sColor2, true, false, true, true);
		//}
	}
	
	function spm_getCellBackColor(o)
	{
		var sColor = spm_getCurrentStyle(o, 'background-Color');  
    if (spm_browserType() == 'ie')
    {
      //--- fix IE transparent border issue ---//
      while (sColor == 'transparent')
      {
        sColor = spm_getCurrentStyle(o, 'background-Color');  
        o = o.parentElement;
        if (o.id.indexOf('divOuterTables') != -1)	//if we are outside the realm of the menu then use transparency
					break;
      }
    }
    return sColor;
	}
	
	function spm_applyBorders(o, sStyle, iSize, sColor, t, l, r, b)
	{

		if (t) o.style.borderTop = sStyle + " " + iSize + "px " + sColor;
		if (b) o.style.borderBottom = sStyle + " " + iSize + "px " + sColor;
		if (r) o.style.borderRight = sStyle + " " + iSize + "px " + sColor;
		if (l) o.style.borderLeft = sStyle + " " + iSize + "px " + sColor;

	}

	function spm_resetScroll(oMenu)
	{
	
		if (oMenu.scrollItems != null)
		{
			oMenu.scrollPos = 1;
			oMenu.scrollItems = 9999;
			spm_showScrolledItems(oMenu);
		}	
	}
	
	
	function spm_handleScrollMenu(me, oMenu)
	{
		var oTbl = spm_getTags('table', oMenu)[0]; //oMenu.childNodes[1];	
		oMenu.style.display = '';
		if (oMenu.scrollPos == null)
		{
			oMenu.scrollPos = 1;			
						
			var oRow = spm_insertTableRow(oTbl);
			var oCell = document.createElement('TD');		
			oCell.id = 'dn' + oMenu.id.substring(3);
			oCell.colSpan = 3;
			oCell.align = 'center';
			oCell.style.backgroundColor = 'gray';	//can be overridden by MenuScroll style
			oCell.innerHTML='<div id="dn' + oMenu.id.substr(3) + '" onclick="return spm_ScrollMenuClick(this, event);" onmouseover="spm_ScrollMenuMO(this, m_oSolpartMenu[\'' + me._m_sNSpace + '\']);" onmouseout="spm_ScrollMenuMOUT(m_oSolpartMenu[\'' + me._m_sNSpace + '\']);" class="' + spm_fixCSSForMac(me.getIntCSSName('spmitmscr')) + ' ' + me.cssMenuScrollItem + '" style="width: 100%; font-size: 6pt;">...</div>';
			oRow.appendChild(oCell);

			oRow = spm_insertTableRow(oTbl, 0);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -