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

📄 spmenu.js

📁 如果不使用IIS,请先运行 XSP.exe,待提示已侦听 8080端口后
💻 JS
📖 第 1 页 / 共 5 页
字号:
				}
			  this._m_sOuterTables = '\n<' + sTag + ' ID="tbl' + this._m_sNSpace + sID + '" CLASS="' + spm_fixCSSForMac(this.getIntCSSName('spmsub') + this.cssSubMenu) + '" STYLE="display:none; position: absolute;' + sStyle + this.menuTransitionStyle + '">\n<table CELLPADDING="0" CELLSPACING="0" BORDER="0">\n' + this.GetMenuItems(oNode) + '\n</table>\n</' + sTag + '>\n' + this._m_sOuterTables;
			}

    }
	}
	return sHTML;
}

	//--------------- Event Functions ---------------//
  //--- menubar click event ---//
	SolpartMenu.prototype.onMBC = function (e, evt)
	{
		this.GenerateSubMenus();

		var oCell = e; //event.srcElement;
		var sID = oCell.id.substr(2);

		var oMenu = spm_getById("tbl" + sID);
		
		if (oMenu != null)
		{
			this.hideAllMenus();		//mindelay mod
			if (oMenu.style.display == '')
			{
				this.hideAllMenus();		
				if (this.useIFrames)
					spm_iFrameIndex(oMenu, false, this.systemImagesPath);
				else
					spm_showElement("SELECT|OBJECT");
			}
			else
			{
				spm_positionMenu(this, oMenu, oCell);
				
				this.doTransition(oMenu);
				oMenu.style.display = "";
				this._m_aOpenMenuID[0] = sID;
				if (this.useIFrames)
					spm_iFrameIndex(oMenu, true, this.systemImagesPath);
				else
					spm_hideElement("SELECT|OBJECT",oMenu);
			}
		}
		
    this.fireEvent('onMenuBarClick', oCell);
    
    oMenu = spm_getById("td" + sID);
    if (spm_getAttr(oMenu, "menuclick", '').length)
    {
      eval(spm_getAttr(oMenu, "menuclick", ''));
      this.hideAllMenus();
    }
		spm_stopEventBubbling(evt);
	}
	
  //--- menubar mousedown event ---//
	SolpartMenu.prototype.onMBMD = function (e)
	{
		var oCell = e; //event.srcElement;
		this.applyBorder(oCell, 1, this.shColor, this.hlColor);
	}
  
  //--- menubar mouseup event ---//
	SolpartMenu.prototype.onMBMU = function (e)
	{
		var oCell = e; //event.srcElement;
		this.applyBorder(oCell, 1, this.hlColor, this.shColor);
	}
  
  //--- menubar mouseover event ---//
	SolpartMenu.prototype.onMBMO = function (e, bBypassDelay)
	{
		this.GenerateSubMenus();
		var oCell = e; //event.srcElement;
		
		if (oCell.id.length == 0) //cancelBubble
		  return;
		var sID = oCell.id.substr(2);
		var oMenu = spm_getById("tbl" + sID);

		if (this._m_aOpenMenuID.length || this.moExpand != '0')
		{
			if (this.minDelay != 0 && bBypassDelay != true)
			{
				if (this.minDelayTimer != null)
					window.clearTimeout(this.minDelayTimer);
				this.minDelayType = 'root';
				this.minDelayObj = e;
				this.minDelayTimer = setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].mouseInDelayHandler()', this.minDelay);
			}
			else
			{
				//--- if menu is shown then mouseover triggers the showing of all menus ---//
				this.hideAllMenus();

				if (oMenu != null)
				{
					spm_positionMenu(this, oMenu, oCell);
					this.doTransition(oMenu);
					oMenu.style.display = "";
					this._m_aOpenMenuID[0] = sID;
					if (this.useIFrames)
						spm_iFrameIndex(oMenu, true, this.systemImagesPath);
					else
						spm_hideElement("SELECT|OBJECT",oMenu);
				}
			}
			this.applyBorder(oCell, 1, this.shColor, this.hlColor);
		}
		else
		{
			this.applyBorder(oCell, 1, this.hlColor, this.shColor);
		}

		oCell.className =  spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmbar') + this.cssMenuBar + ' ' + this.cssMenuItemSel + ' ' + spm_getAttr(oCell, 'saveselcss', '') + ' ' + spm_getAttr(oCell, 'savecss', ''));
		
		this._m_dHideTimer = null;
		
		this.fireEvent('onMenuBarMouseOver', oCell);
		
	}
  //--- menubar mouseout event ---//
	SolpartMenu.prototype.onMBMOUT = function (e)
	{
		var oCell = e; //event.srcElement;
		var sID = oCell.id.substr(2);
		this.applyBorder(oCell, 1, spm_getCellBackColor(oCell), spm_getCellBackColor(oCell), "none");	
		this._m_dHideTimer = new Date();

		if (this.moutDelay != 0)
		  setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].hideMenuTime()', this.moutDelay);
		  
    oCell.className = spm_fixCSSForMac(this.getIntCSSName('spmbar spmitm') + this.cssMenuBar + ' ' + this.cssMenuItem + ' ' + spm_getAttr(e, 'savecss', ''));
    this.stopTransition();
    this.minDelayType = null;
    this.fireEvent('onMenuBarMouseOut', oCell);
	}
	
  //--- menuitem click ---//
	SolpartMenu.prototype.onMBIC = function (e, evt)
	{
		var oRow = spm_getSourceTR(e, this._m_sNSpace);  //event.srcElement
		var sID = oRow.id.substr(2);
		if (spm_itemHasChildren(sID, this._m_sNSpace) == false)
			this.hideAllMenus();

		this.fireEvent('onMenuItemClick', oRow);

    if (spm_getAttr(oRow, "menuclick", '').length)
    {
      eval(spm_getAttr(oRow, "menuclick", ''));
      this.hideAllMenus();
		}
		spm_stopEventBubbling(evt);
		
		this.handlembi_mo(oRow, true);
	}

  //--- menuitem mouseover event ---//
	SolpartMenu.prototype.onMBIMO = function (e)
	{		
		this.handlembi_mo(spm_getSourceTR(e, this._m_sNSpace)); //event.srcElement

		this._m_dHideTimer = null;
	}
  //--- menuitem mouseout event ---//
	SolpartMenu.prototype.onMBIMOUT = function (e)
	{	
		this.handlembi_mout(spm_getSourceTR(e, this._m_sNSpace));  //event.srcElement
		this._m_dHideTimer = new Date;
		//setTimeout(this.hideMenuTime, this.moutDelay);
		if (this.moutDelay != 0)
		  setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].hideMenuTime()', this.moutDelay);
		 
		this.minDelayType = null;
	}

	SolpartMenu.prototype.bodyclick = function()
	{
		this.hideAllMenus();
	}

  //--- handles display of newly opened menu ---//
	SolpartMenu.prototype.handleNewItemSelect = function (sID)
	{
		var i;
		var iNewLength=-1;
		var bDeleteRest=false; 
		for (i=0; i<this._m_aOpenMenuID.length; i++)
		{		
			if (bDeleteRest)
			{
				spm_getById("tbl" + this._m_aOpenMenuID[i]).style.display = "none";
				if (this.useIFrames)
					spm_iFrameIndex(spm_getById("tbl" + this._m_aOpenMenuID[i]), false, this.systemImagesPath);
			}
			if (this._m_aOpenMenuID[i] == this._m_sNSpace + sID)
			{
				bDeleteRest=true;
				iNewLength = i;
			}				
		}
		if (iNewLength != -1)
			this._m_aOpenMenuID.length = iNewLength+1;
	}
	
  //--- hides all menus that are currently displayed ---//
	SolpartMenu.prototype.hideAllMenus = function ()
	{
		var i;
		var oMenu;
		for (i=0; i<this._m_aOpenMenuID.length; i++)
		{		
			oMenu = spm_getById("tbl" + this._m_aOpenMenuID[i]);
			oMenu.style.display = "none";

			if (this.useIFrames)
				spm_iFrameIndex(oMenu, false, this.systemImagesPath);
		}
		if (this.useIFrames != true)
			spm_showElement("SELECT|OBJECT");

		this._m_aOpenMenuID.length = 0;
	}		
  
  
  function SolpartMenuTransitionObject()
  {
    this.id=null;
    this.stop = false;
  } 

  //--- stops menu transition effect ---//
  SolpartMenu.prototype.stopTransition = function ()
  {
    this.SolpartMenuTransitionObject.stop = true;
    this.doFilter();
    this.SolpartMenuTransitionObject = new SolpartMenuTransitionObject();
  }
  
  //--- starts menu transition effect ---//
  SolpartMenu.prototype.doTransition = function (oMenu)
  {
    if (this.menuTransition == 'None' || this.supportsTransitions == '0')
      return;

    var sID = this.SolpartMenuTransitionObject.id;
    
    switch (this.menuTransition)
    {
      case 'AlphaFade':
      {
        if (this.SolpartMenuTransitionObject.id != oMenu.id) 
        {
          this.SolpartMenuTransitionObject.id = oMenu.id;
          this.SolpartMenuTransitionObject.opacity = 0;
          this.doFilter();
        }
        break;
      }
      case 'Wave':
      {
        if (this.SolpartMenuTransitionObject.id != oMenu.id) 
        {        
          this.SolpartMenuTransitionObject.id = oMenu.id;
          this.SolpartMenuTransitionObject.phase = 0;
          this.doFilter();
        }
        break;
      }
      case 'ConstantWave':
      {
        if (sID != oMenu.id) 
        {        
          this.SolpartMenuTransitionObject.id = oMenu.id;
          this.SolpartMenuTransitionObject.phase = 0;
          this.SolpartMenuTransitionObject.constant=true;
          this.doFilter();
        }
        break;
      }
      case 'Inset': case 'RadialWipe': case 'Slide': case 'Spiral': case 'Stretch': case 'Strips': case 'Wheel': case 'GradientWipe': case 'Zigzag': case 'Barn': case 'Blinds': case 'Checkerboard': case 'Fade': case 'Iris': case 'RandomBars':
      {
        oMenu.filters('DXImageTransform.Microsoft.' + this.menuTransition).apply();
        oMenu.filters('DXImageTransform.Microsoft.' + this.menuTransition).duration = this.menuTransitionLength;
        oMenu.filters('DXImageTransform.Microsoft.' + this.menuTransition).play();
        break;
      }
    }
  }

  //--- applys transition filter ---//
  SolpartMenu.prototype.doFilter = function (bStop) 
  {      
    if (this.SolpartMenuTransitionObject.id == null)
      return;
      
    var o = spm_getById(this.SolpartMenuTransitionObject.id);
    window.status = new Date();
    switch (this.menuTransition)
    {
      case 'AlphaFade':
      {
        if (this.SolpartMenuTransitionObject.stop)
        {
          o.filters('DXImageTransform.Microsoft.Alpha').opacity = 100;
        }
        else
        {
          o.filters('DXImageTransform.Microsoft.Alpha').opacity = this.SolpartMenuTransitionObject.opacity;
          if (this.SolpartMenuTransitionObject.opacity < 100)
          {
            setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].doFilter()', 50);
            this.SolpartMenuTransitionObject.opacity += (100/20* this.menuTransitionLength);
          }
        }
        break;
      }
      case 'Wave': case 'ConstantWave':
      {
        if (this.SolpartMenuTransitionObject.stop)
        {
            o.filters("DXImageTransform.Microsoft.Wave").freq = 0;
            o.filters("DXImageTransform.Microsoft.Wave").lightstrength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").strength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").phase = 0;
        }
        else
        {
          o.filters("DXImageTransform.Microsoft.Wave").freq = 1;
          o.filters("DXImageTransform.Microsoft.Wave").lightstrength = 20;
          o.filters("DXImageTransform.Microsoft.Wave").strength = 5;
          o.filters("DXImageTransform.Microsoft.Wave").phase = this.SolpartMenuTransitionObject.phase;

          if (this.SolpartMenuTransitionObject.phase < 100 * this.menuTransitionLength || this.SolpartMenuTransitionObject.constant == true)
          {
            setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].doFilter()', 50);
            this.SolpartMenuTransitionObject.phase += 5;
          }
          else
          {
            o.filters("DXImageTransform.Microsoft.Wave").freq = 0;
            o.filters("DXImageTransform.Microsoft.Wave").lightstrength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").strength = 0;
            o.filters("DXImageTransform.Microsoft.Wave").phase = 0;
          }
        }
        break;
      }
    }
  }          

  //--- handles mouseover for menu item ---//
	SolpartMenu.prototype.handlembi_mo = function (oRow, bBypassDelay)
	{
		var sID = oRow.id.substr(2);

		spm_getById("icon" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmicn') + this.cssMenuIcon + ' ' + this.cssMenuItemSel + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
		spm_getById("td" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel') + this.cssMenuItemSel + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
		spm_getById("arrow" + sID).className = spm_fixCSSForMac(this.getIntCSSName('spmitmsel spmarw') + this.cssMenuItemSel + ' ' + this.cssMenuArrow + ' ' + spm_getAttr(oRow, 'saveselcss', ''));
		
		if (this.selBorderColor != '')
			spm_applyRowBorder(oRow, 1, this.selBorderColor, true);

		if (this.minDelay != 0 && bBypassDelay != true)
		{
			if (this.minDelayTimer != null)
				window.clearTimeout(this.minDelayTimer);
			this.minDelayType = 'sub';
			this.minDelayObj = oRow;
			this.minDelayTimer = setTimeout('m_oSolpartMenu["' + this._m_sNSpace + '"].mouseInDelayHandler()', this.minDelay);
			return;
		}
	
		if (this._m_aOpenMenuID[this._m_aOpenMenuID.length - 1] != oRow.id.replace('tr', ''))
		{
			this.handleNewItemSelect(spm_getAttr(oRow, "parentID", ""));
		
			if (spm_getById("tbl" + sID) != null)
			{
				var iWidth;
				oMenu = spm_getById("tbl" + sID);

				var oPDims = new spm_elementDims(oRow);
				var oMDims = new spm_elementDims(oMenu);
				        			
				oMenu.style.top = spm_getCoord(oPDims.t);
				
				spm_resetScroll(oMenu);

				this.doTransition(oMenu);

				oMDims = new spm_elementDims(oMenu);	//now that we moved need to reget dims
				oMenu.style.display = "";

			  if (oMDims.t - spm_getBodyScrollTop() + oMDims.h > spm_getViewPortHeight())
			  {
				  if (oMDims.h < spm_getViewPortHeight())
						oMenu.style.top = spm_getCoord(spm_getViewPortHeight() + spm_getBodyScrollTop() - oMDims.h);
					else
					{
						spm_handleScrollMenu(this, oMenu);
						
						oMDims = new spm_elementDims(oMenu);	//now that we moved need to reget dims
					}

⌨️ 快捷键说明

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