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

📄 whtbar.js

📁 阅读您的文件包然后写出其具体功能(至少要20个字)。尽量不要让站长把时间都花费在为您修正说明上。压缩包解压时不能有密码
💻 JS
📖 第 1 页 / 共 4 页
字号:
		UnRegisterListener2(this,WH_MSG_INITSEARCHSTRING);
		UnRegisterListener2(this,WH_MSG_NOSEARCHINPUT);
		UnRegisterListener2(this,WH_MSG_NOSYNC);
	}
}

function window_OnLoad()
{
	if(!gbOpera7&&document.body)
	{
		if(gsBgImage&&gsBgImage.length>0)
		{
			document.body.background=gsBgImage;
		}
		if(gsBgColor&&gsBgColor.length>0)
		{
			document.body.bgColor=gsBgColor;
		}
	}
	doCusOnLoad();
	var oMsg=new whMessage(WH_MSG_GETPANEINFO,this,1,null);
	if(SendMessage(oMsg))
	{
		setTimeout("flipPaneButton(\""+oMsg.oParam+"\");",1);
	}
	if (!gaAvenues)
	{
		var oMsg2=new whMessage(WH_MSG_GETAVIAVENUES,this,1,new Object());
		if(SendMessage(oMsg2))
		{
			gaAvenues=oMsg2.oParam.aAvenues;
			gbNeedUpdateAve=false;
			setTimeout("updateAvenue();",1);
		}
	}
}

function onSendMessage(oMsg)
{
	var nMsgId=oMsg.nMessageId;
	if(nMsgId==WH_MSG_GETSEARCHS)
	{
		if(document.searchForm&&document.searchForm.searchString)
		{
			oMsg.oParam.sValue=document.searchForm.searchString.value;
			return false;
		}
	}
	else if(nMsgId==WH_MSG_PANESTATUE)
	{
		if(oMsg.oParam=="visible")
		{
			if(isShowHideEnable())
				setTimeout("flipShowHide(true);",1);
			setTimeout("showPaneButton();",1);
		}
		else
		{
			if(isShowHideEnable())
				setTimeout("flipShowHide(false);",1);
			setTimeout("hidePaneButton();",1);
		}
	}
	else if(nMsgId==WH_MSG_PANEINFO)
	{
		if(oMsg.oParam)
			setTimeout("flipPaneButton(\""+oMsg.oParam+"\");",1);
		else
			setTimeout("hidePaneButton();",1);
	}
	else if(nMsgId==WH_MSG_SYNCINFO)
	{
		if(oMsg.oParam)
			goTocInfo=oMsg.oParam;
		else
			goTocInfo=null;
		gbTocInfoInited=true;
	}
	else if(nMsgId==WH_MSG_AVENUEINFO)
	{
		gaAvenues=oMsg.oParam;
		gbNeedUpdateAve=false;
		setTimeout("updateAvenue();",1);
	}
	else if(nMsgId==WH_MSG_GETCURRENTAVENUE)
	{
		var sAveName=getCurrentAvenue();
		if(sAveName!="")
		{
			oMsg.oParam.sAvenue=sAveName;
			return false;
		}
		else
			return true;
	}
	else if(nMsgId==WH_MSG_ENABLEWEBSEARCH)
	{
		setTimeout("updateWebSearch("+oMsg.oParam+");",1);
	}
	else if(nMsgId==WH_MSG_INITSEARCHSTRING)
	{
		if(gstrSearch!="")
		{
			oMsg.oParam=gstrSearch;
			gstrSearch="";
			return false;
		}
	}
	else if(nMsgId==WH_MSG_NOSEARCHINPUT)
	{
		var oSearchInput = getElement("searchInput");
		if (oSearchInput)
		{
			oSearchInput.style.visibility = "hidden";
			return false;
		}
	}
	else if(nMsgId==WH_MSG_NOSYNC)
	{
		var oSync = getElement("btnsynctoc");
		if (oSync)
		{
			oSync.style.visibility = "hidden";
			return false;
		}
	}
	return true;
}

function getCurrentAvenue()
{
	var strAveName="";
	var oSelect=getElement("avenue");
	if(oSelect)
	{
		strAveName=oSelect.value;
	}
	return strAveName;
}

function initBtn()
{
	var oBtn=null;
	oBtn=getElement("btntoc");
	if(oBtn)
		gaBtns[gaBtns.length]=oBtn;
	oBtn=getElement("btnidx");
	if(oBtn)
		gaBtns[gaBtns.length]=oBtn;
	oBtn=getElement("btnfts");
	if(oBtn)
		gaBtns[gaBtns.length]=oBtn;
	oBtn=getElement("btnglo");
	if(oBtn)
		gaBtns[gaBtns.length]=oBtn;
	gbInitBtn=true;
}

function showPaneButton()
{
	flipPaneButton(gsPane);
}

function hidePaneButton()
{
	flipPaneButton("");
}

function flipPaneButton(sPane)
{
	if (sPane)
		gsPane=sPane;
	if(!gbInitBtn)
		initBtn();

	var oUp=null;
	if(sPane)
	{
		oUp=getElement("btn"+sPane);
	}
	for(var i=0;i<gaBtns.length;i++)
	{
		if(gaBtns[i])
		{
			if(gaBtns[i]==oUp)
			{
				var oEl=getParentNode(oUp);
				var sPF=oEl.className.substring(0,6);
				var sState=getState(oEl);
				if(sState=="up")
				{
					setState(oEl,"down");
					oEl.className=sPF+"Down";
					if(sPF=="clsBtn")
					{
						if(gaBtns[i].id)
						{
							var sColor=getBtnColor(gaBtns[i].id.substring(3),true);
							if(sColor)
							{
								oEl.style.backgroundColor=sColor
							}
							else
							{
								oEl.style.backgroundColor="";
							}
						}
						var oaA=getElementsByTag(oEl,"A");
						if(oaA.length>0)
						{
							var strClassName=oaA[0].className;
							oaA[0].className="btnsel"+strClassName.substring(3);
						}
					}
					var oIs=getElementsByTag(oEl,"img");
					var oBtn=getButtonObjByType(gaBtns[i].id.substring(3));
					if(oIs.length>0&&oBtn&&oBtn.aIs&&oBtn.aIs.length>3)
					{
						if(oBtn.aIs[3])
							oIs[0].src=oBtn.aIs[3];
					}
				}
			}
			else
			{
				var oEl=getParentNode(gaBtns[i]);
				var sState=getState(oEl);
				var sPF=oEl.className.substring(0,6);
				if(sState=="down")
				{
					setState(oEl,"up");
					if(oEl==goEl)
						oEl.className=sPF+"Up";
					else
						oEl.className=sPF+"Normal";

					if(sPF=="clsBtn")
					{
						if(gaBtns[i].id)
						{
							var sColor=getBtnColor(gaBtns[i].id.substring(3),false);
							if(sColor)
							{
								oEl.style.backgroundColor=sColor
							}
							else
							{
								oEl.style.backgroundColor="";
							}
						}

						var oaA=getElementsByTag(oEl,"A");
						if(oaA.length>0)
						{
							var strClassName=oaA[0].className;
							oaA[0].className="btn"+strClassName.substring(6);
						}
					}
					var oIs=getElementsByTag(oEl,"img");
					var oBtn=getButtonObjByType(gaBtns[i].id.substring(3));
					if(oIs.length>0&&oBtn&&oBtn.aIs&&oBtn.aIs.length>0)
					{
						if(oBtn.aIs[0])
							oIs[0].src=oBtn.aIs[0];
					}
				}
			}
		}
	}
}

function flipShowHide(bShow)
{
	gnHasNavPane=-1;	
	var oA=getElement("btnshowhide");
	if(oA)
	{
		var oEl=getParentNode(oA);
		var sPF=oEl.className.substring(0,6);
		if(oEl&&oEl.state)
		{
			if(bShow)
			{
				oEl.state="down";
				oEl.className=sPF+"Down";
			}
			else
			{
				oEl.state="up";
				
				if(oEl==goEl)
					oEl.className=sPF+"Up";
				else
					oEl.className=sPF+"Normal";
			}
		}
		oA.innerHTML=getShowHide();
	}
}

function cusOnClick(nIdx)
{
	if(goCusButton.length>nIdx)
	{
		var sOnClick=goCusButton[nIdx].sOnClick;
		if(sOnClick&&sOnClick.length>0)
		{
			if(!gbPreview)
				eval(sOnClick);
			return false;
		}
	}
	return true;
}

function cusOnMouseOver(nIdx)
{
	if(goCusButton.length>nIdx)
	{
		var sOnMouseOver=goCusButton[nIdx].sOnMouseOver;
		if(sOnMouseOver&&sOnMouseOver.length>0)
		{
			if(!gbPreview)
				eval(sOnMouseOver);
			return false;
		}
	}
	return true;
}

function doCusOnLoad()
{
	if(!gbPreview&&gaOrders)
	{
		for(var i=0;i<gaOrders.length;i++)
		{
			for(var j=0;j<gaOnLoads.length;j++)
			{
				if(gaOrders[i]==gaOnLoads[j].sType)
				{
					eval(gaOnLoads[j].sOnLoad);
					break;
				}
			}
		}
	}
}

function registerOnLoad(sOnLoad,sType)
{
	gaOnLoads[gaOnLoads.length]=new cusOnLoad(sType,sOnLoad);	
}

function cusOnLoad(sType,sOnLoad)
{
	this.sType=sType;
	this.sOnLoad=sOnLoad;
}

function cusButton(sType,sText,sOnClick,sOnMouseOver,sOnLoad,nWidth,nHeight)
{
	this.sType=sType;
	this.sText=sText;
	this.sOnClick=sOnClick;
	this.sOnMouseOver=sOnMouseOver;
	this.sOnLoad=sOnLoad;
	this.nWidth=nWidth;
	this.nHeight=nHeight;
	this.aIs=new Array();
	var i=0;
	while(cusButton.arguments.length>i+7)
	{
		if (cusButton.arguments[7+i])
			this.aIs[i]=_getFullPath(_getPath(document.location.href),cusButton.arguments[7+i]);
		else
			this.aIs[i]="";
		i++;
	}
	if(sOnLoad)
	{
		registerOnLoad(sOnLoad,sType);
	}
}

function getBtnColor(sType,bSel)
{
	var aBtnColors=null;
	if(bSel)
		aBtnColors=gaSelBtnBgColor;
	else
		aBtnColors=gaBtnBgColor;
	if(aBtnColors)
	{
		for(var i=0;i<aBtnColors.length;i++)
		{
			if(aBtnColors[i].sType==sType)
				return aBtnColors[i].sColor;
		}
	}
	return "";
}

function setButtonBgColor(sType,sColor,bSel)
{
	if(sColor)
	{
		var aBtnColors=null;
		if(bSel)
			aBtnColors=gaSelBtnBgColor;
		else
			aBtnColors=gaBtnBgColor;
		if(aBtnColors!=null)
		{
			for(var i=0;i<aBtnColors.length;i++)
			{
				if(aBtnColors[i].sType==sType)
				{
					aBtnColors[i].sColor=sColor;
					return;
				}
			}
			aBtnColors[aBtnColors.length]=new btnBgColor(sType,sColor);
		}
	}
}

function getDefaultButtonFont()
{
	var strFontStyle="";
	for(var i=0;i<gaTypes.length;i++)
	{
		strFontStyle+=".btnsel"+gaTypes[i]+"{"+getFontStyle(goSelTextFont)+"}";
		strFontStyle+=".btn"+gaTypes[i]+"{"+getFontStyle(goTextFont)+"}";
	}
	return strFontStyle;
}

function setButtonFont(sType,sFontName,sFontSize,sFontColor,sFontStyle,sFontWeight,sFontDecoration,bSel)
{
	if(sFontName)
	{
		var vFont=new whFont(sFontName,sFontSize,sFontColor,sFontStyle,sFontWeight,sFontDecoration);
		if(bSel)
			gsBtnStyle+=".btnsel"+sType+"{"+getFontStyle(vFont)+"}\n";
		else
			gsBtnStyle+=".btn"+sType+"{"+getFontStyle(vFont)+"}\n";
	}
	if (sType=="searchform"&&!bSel)
	{
		var vFont1=new whFont(sFontName,sFontSize,"black",sFontStyle,sFontWeight,sFontDecoration);
		gsBtnStyle+=".inputsearchform {" + getFontStyle(vFont1)+"}\n";
	}
}

function getButtonObjByType(sType)
{
	for(var i=0;i<gaObjBtns.length;i++)
	{
		if(gaObjBtns[i].sType==sType)
			return gaObjBtns[i];
	}
	return null;
}

function onSelect()
{
	if (event.srcElement&&event.srcElement.name)
	{
		if (event.srcElement.name=="searchString")
			return true;
	}
	return false;
}

function window_onResize()
{
	gnRE++;
	setTimeout("tryReload();", 100);
}

function tryReload()
{
	if (gnRE==1)
		document.location.reload();
	gnRE--;
}

if(window.gbWhUtil&&window.gbWhMsg&&window.gbWhVer&&window.gbWhProxy)
{
	RegisterListener2(this,WH_MSG_GETSEARCHS);
	RegisterListener2(this,WH_MSG_PANESTATUE);
	RegisterListener2(this,WH_MSG_SYNCINFO);
	RegisterListener2(this,WH_MSG_PANEINFO);
	RegisterListener2(this,WH_MSG_AVENUEINFO);
	RegisterListener2(this,WH_MSG_GETCURRENTAVENUE);
	RegisterListener2(this,WH_MSG_ENABLEWEBSEARCH);
	RegisterListener2(this,WH_MSG_INITSEARCHSTRING);
	RegisterListener2(this,WH_MSG_NOSEARCHINPUT);
	RegisterListener2(this,WH_MSG_NOSYNC);

	window.onload=window_OnLoad;
	window.onunload=window_Unload;
	window.onresize=window_onResize;
	goTextFont=new whFont("Verdana","8pt","#003063","normal","normal","none");
	goSelTextFont=new whFont("Verdana","8pt","white","normal","normal","none");
	gbWhTBar=true;
}
else
	document.location.reload();

⌨️ 快捷键说明

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