📄 whtbar.js
字号:
// WebHelp 5.10.005
var gaButtons=new Array();
var gaTypes=new Array();
var gaBtnBgColor=new Array();
var gaSelBtnBgColor=new Array();
var gaOrders=null;
var gaObjBtns=new Array();
var BTN_TEXT=1;
var BTN_IMG=2;
var BTN_IMG_TOP=4
var BTN_IMG_BOTTOM=8;
var BTN_IMG_LEFT=16;
var BTN_IMG_RIGHT=32;
var gsAlign="left";
var gsBgImage="";
var gsBgColor="#99ccff";
var gsShadow="#cccccc";
var gsTBBgImage="";
var gnShowHideStyle=0;
var goTocInfo=null;
var gbTocInfoInited=false;
var goWebSearch=null;
var gsTBFontFamily="宋体";
var gsTBFontSize="xx-small";
var gsTBFontColor="#003063";
var gsTBDarkColor="#808080";
var gsTBLightColor="#FFFAFA";
var gsTBSelectedBgColor="#639ace";
var gsTBFontSelectedColor="#ffffff";
var gaOnLoads=new Array();
var goWebSearchEnable=true;
var goShow=null;
var goHide=null;
var goHide2=null;
var goSync=null;
var goToc=null;
var goIdx=null;
var goFts=null;
var goGlo=null;
var goNext=null;
var goPrev=null;
var LAYOUT=1;
var HLAYOUT=0;
var VLAYOUT=1;
var ALIGN=2;
var BALIGN=0;
var EALIGN=2;
var goEl=null;
var gnRE=0;
var gnButtonLayout=0;
var gnShowHide=-1;
var gbEqualSize=false;
var goCusButton=new Array();
var gsBtnStyle="";
var gaAvenues=null;
var gsCurAveName="";
var gsIToc=null;
var gsITocS=null;
var gsIIndex=null;
var gsIIndexS=null;
var gsISearch=null;
var gsISearchS=null;
var gsIGlossary=null;
var gsIGlossaryS=null;
var gsIBanner=null;
var gsIGo=null;
var gsIHide=null;
var gsIPrev=null;
var gsINext=null;
var gsISync=null;
var gsINextD=null;
var gsIPrevD=null;
var gsIWebSearch=null;
var gsIWebSearchD=null;
var gbAveButttnInited=false;
var goNextParent=null;
var goPrevParent=null;
var gsSearchPrompt="- 搜索 -";
var gstrSearch="";
var gbPreview=false;
gbPreview=false;
var gsSearchFormTitle="";
var gnHasNavPane=-1;
var gbInitBtn=false;
var gaBtns=new Array();
var gbWhTBar=false;
var goTextFont=null;
var goSelTextFont=null;
var gsPane="";
var gbNeedUpdateAve=false;
var gbUpdateTimerCount=0;
function setGoImage(sGoImage)
{
if(sGoImage)
{
gsIGo=sGoImage;
}
}
function btnBgColor(sType,sColor)
{
this.sType=sType;
this.sColor=sColor;
}
function setBackground(sBgImage)
{
gsBgImage=sBgImage;
}
function setBackgroundcolor(sBgColor)
{
gsBgColor=sBgColor;
}
function setAlignment(strAlignment)
{
gnButtonLayout=0;
if(strAlignment=="left")
{
gnButtonLayout=HLAYOUT|BALIGN;
}
else if(strAlignment=="right")
{
gnButtonLayout=HLAYOUT|EALIGN;
}
else if(strAlignment=="top")
{
gnButtonLayout=VLAYOUT|BALIGN;
}
else if(strAlignment=="bottom")
{
gnButtonLayout=VLAYOUT|EALIGN;
}
}
function writeStyle(bMiniBar)
{
var sStyle="";
sStyle+="<style type='text/css'>\n";
sStyle+="<!--\n";
sStyle+=".clsBtnNormal {\n";
if(!(gbNav4&&!gbNav6))
if (bMiniBar)
sStyle+="padding:2px;\n";
else
sStyle+="padding:5px;\n";
sStyle+="cursor:hand;\n";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";\n";
sStyle+="color:"+gsTBFontColor+";}\n";
sStyle+=".clsNoBNormal {\n";
sStyle+="padding-left:2px;padding-right:2px;\n";
sStyle+="cursor:hand;\n";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";\n";
sStyle+="color:"+gsTBFontColor+";}\n";
sStyle+=".clsNotBtn {\n";
if(!(gbNav4&&!gbNav6))
if (bMiniBar)
sStyle+="padding:2px;\n";
else
sStyle+="padding:5px;\n";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";\n";
sStyle+="color:"+gsTBFontColor+";}\n";
sStyle+=".clsBtnUp{\n";
if(!(gbNav4&&!gbNav6))
if (bMiniBar)
sStyle+="padding:1px;\n";
else
sStyle+="padding:4px;\n";
sStyle+="border-bottom:"+gsTBDarkColor+" 1px solid;\n";
sStyle+="border-left:"+gsTBLightColor+" 1px solid;\n";
sStyle+="border-right:"+gsTBDarkColor+" 1px solid;\n";
sStyle+="border-top:"+gsTBLightColor+" 1px solid;\n";
sStyle+="cursor:hand;";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";\n";
sStyle+="color:"+gsTBFontColor+";}\n";
sStyle+=".clsNoBUp{\n";
sStyle+="padding-left:2px;padding-right:2px;\n";
sStyle+="cursor:hand;";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";\n";
sStyle+="color:"+gsTBFontColor+";}\n";
sStyle+=".clsBtnDown{\n";
if(!(gbNav4&&!gbNav6))
if (bMiniBar)
sStyle+="padding:1px;\n";
else
sStyle+="padding:4px;\n";
sStyle+="border-bottom:"+gsTBLightColor+" 1px solid;\n";
sStyle+="border-left:"+gsTBDarkColor+" 1px solid;\n";
sStyle+="border-right:"+gsTBLightColor+" 1px solid;\n";
sStyle+="border-top:"+gsTBDarkColor+" 1px solid;\n";
sStyle+="color:"+gsTBFontColor+";\n";
sStyle+="cursor:hand;\n";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";}\n";
sStyle+=".clsNoBDown{\n";
sStyle+="padding-left:2px;padding-right:2px;\n";
sStyle+="cursor:hand;";
sStyle+="font-family:"+gsTBFontFamily+";\n";
sStyle+="font-size:"+gsTBFontSize+";\n";
sStyle+="color:"+gsTBFontColor+";}\n";
sStyle+=getDefaultButtonFont();
sStyle+=gsBtnStyle;
sStyle+=".clsToolbarBackground{\n";
sStyle+="margin:2px;}\n";
sStyle+="-->\n";
sStyle+=" body {\n";
if (gsBgImage)
sStyle+="border-top:"+gsBgColor+" 1px solid;}\n";
else
sStyle+="border-top:black 1px solid;}\n";
sStyle+="-->\n";
sStyle+="</style>\n";
document.write(sStyle);
}
function button(sType,sText,nWidth,nHeight)
{
this.sType=sType;
this.sText=sText;
this.nWidth=nWidth;
this.nHeight=nHeight;
this.aIs=new Array();
var i=0;
while(button.arguments.length>i+4)
{
if (button.arguments[4+i])
this.aIs[i]=_getFullPath(_getPath(document.location.href),button.arguments[4+i]);
else
this.aIs[i]="";
i++;
}
}
function getImage(oImage,sTitle)
{
if(oImage.aIs[0])
{
var sI="";
if(sTitle=="")
sTitle=oImage.sText;
sI+="<img alt=\""+sTitle+"\" src=\""+oImage.aIs[0]+"\"";
if(oImage.nWidth>0)
sI+=" width="+oImage.nWidth;
if(oImage.nHeight>0)
sI+=" height="+oImage.nHeight;
sI+=" border=0 align=\"absmiddle\">";
return sI;
}
return "";
}
function getCurrentAveName()
{
var oSelect=getElement("avenue");
if(oSelect)
return oSelect.value;
else
return "";
}
function updateWebSearch(bEnable)
{
var oWebSearch=getElement("btnwebsearch");
var oWebSearchParent=null;
if(oWebSearch)
oWebSearchParent=getParentNode(oWebSearch);
goWebSearchEnable=bEnable;
if(oWebSearchParent)
{
if(bEnable)
enableButton(oWebSearchParent,goWebSearch);
else
disableButton(oWebSearchParent,goWebSearch);
}
}
function setState(oEL,sState)
{
if(gbNav6)
oEL.setAttribute("state",sState);
else
oEL.state=sState;
}
function updateAvenueIfNeeded()
{
gbUpdateTimerCount--;
if (gbNeedUpdateAve&&gbUpdateTimerCount==0)
{
updateAvenue();
}
}
function updateAvenue()
{
var sSelect=getAvenueHTML(gaAvenues);
var oSelect=getElement("avenue");
if(oSelect)
{
if(gbNav6)
{
var oParent=getParentNode(oSelect);
if(oParent)
{
removeThis(oSelect);
oParent.insertAdjacentHTML("afterBegin",sSelect);
}
}
else
oSelect.outerHTML=sSelect;
oSelect=getElement("avenue");
if(isValidAvenue(gaAvenues,gsCurAveName))
oSelect.value=gsCurAveName;
}
updateAveButton();
}
function initAveButtonObj()
{
if(!gbAveButttnInited)
{
var oNext=getElement("btnavnext");
if(oNext)
goNextParent=getParentNode(oNext);
var oPrev=getElement("btnavprev");
if(oPrev)
goPrevParent=getParentNode(oPrev);
}
gbAveButttnInited=true;
}
function disableAveButton()
{
initAveButtonObj();
if(goNextParent)
disableButton(goNextParent,goNext);
if(goPrevParent)
disableButton(goPrevParent,goPrev);
}
function disableButton(oEl,oBtn)
{
setState(oEl,"disable");
var sPF=oEl.className.substring(0,6);
oEl.className=sPF+"Normal";
var oIs=getElementsByTag(oEl,"img");
if(oIs.length>0&&oBtn&&oBtn.aIs&&oBtn.aIs.length>3)
{
if(oBtn.aIs[3])
oIs[0].src=oBtn.aIs[3];
}
else
oEl.style.visibility="hidden";
}
function enableButton(oEl,oBtn)
{
setState(oEl,"normal");
if(oEl==goEl)
{
var sPF=oEl.className.substring(0,6);
oEl.className=sPF+"Up";
}
var oIs=getElementsByTag(oEl,"img");
if(oIs.length>0&&oBtn&&oBtn.aIs&&oBtn.aIs.length>0)
{
if(oBtn.aIs[0])
oIs[0].src=oBtn.aIs[0];
}
oEl.style.visibility="visible";
}
function updateAveButton()
{
initAveButtonObj();
var strAveName=getCurrentAvenue();
if(strAveName!="")
{
if(gaAvenues)
{
for(var i=0;i<gaAvenues.length;i++)
if(gaAvenues[i].sName==strAveName)
{
if(goNextParent)
{
if(gaAvenues[i].sNext!=null&&gaAvenues[i].sNext!="")
enableButton(goNextParent,goNext);
else
disableButton(goNextParent,goNext);
}
if(goPrevParent)
{
if(gaAvenues[i].sPrev!=null&&gaAvenues[i].sPrev!="")
enableButton(goPrevParent,goPrev);
else
disableButton(goPrevParent,goPrev);
}
break;
}
}
}
else
{
var bNext=false;
var bPrev=false;
if(gaAvenues&&gaAvenues.length>0)
{
for(var i=0;i<gaAvenues.length&&(!bNext||!bPrev);i++)
{
if(!bNext)
if(gaAvenues[i].sNext!=null&&gaAvenues[i].sNext!="")
bNext=true;
if(!bPrev)
if(gaAvenues[i].sPrev!=null&&gaAvenues[i].sPrev!="")
bPrev=true;
}
}
if(goNextParent)
{
if(bNext)
enableButton(goNextParent,goNext);
else
disableButton(goNextParent,goNext);
}
if(goPrevParent)
{
if(bPrev)
enableButton(goPrevParent,goPrev);
else
disableButton(goPrevParent,goPrev);
}
}
}
function isValidAvenue(aAvenues,sValue)
{
if(aAvenues)
{
for(var i=0;i<aAvenues.length;i++)
{
if(aAvenues[i].sName==sValue)
return true;
}
}
return false;
}
function getAvenueHTML(aAvenues)
{
var sSelect="<select id=\"avenue\" size=\"1\" name=\"avenue\" onchange=\"updateAveButton();\">";
sSelect+="<option value=\"\" selected> - Select Avenue - </option>";
if(aAvenues)
{
for(var i=0;i<aAvenues.length;i++)
{
sSelect+="<option value=\""+aAvenues[i].sName+"\">"+aAvenues[i].sName+"</option>";
}
}
sSelect+="</select>";
return sSelect;
}
function addAvenueSelection()
{
var oMsg=new whMessage(WH_MSG_GETAVIAVENUES,this,1,new Object());
var sButton="";
if(SendMessage(oMsg))
{
sButton=getAvenueHTML(oMsg.oParam.aAvenues);
}
else
{
sButton=getAvenueHTML(null);
}
gaButtons[gaButtons.length]="<td NOWRAP align=\"center\" valign=\"middle\">"+sButton+"</td>";
}
function setSearchFormTitle(sTitle)
{
gsSearchFormTitle=sTitle;
}
function highLightIfNeeded()
{
if(document.searchForm.searchString.value==gsSearchPrompt)
{
document.searchForm.searchString.select();
}
}
function addSearchForm()
{
var sPropmptString=gsSearchPrompt;
var nWidth=20;
if(!nWidth) nWidth=20;
if(gbNav4) nWidth=nWidth*.6;
if(gsSearchFormTitle)
sPropmptString="";
var sButton="<table id=\"searchInput\" CELLSPACING=0 CELLPADDING=1><tr><td valign=\"middle\" NOWRAP class=\"clsNotBtn\"><span class=\"btnsearchform\">"+_textToHtml(gsSearchFormTitle)+"</span></td><td NOWRAP valign=\"middle\"><input class=\"inputsearchform\" type=\"text\" onfocus=\"highLightIfNeeded();\" name=\"searchString\" value=\""+sPropmptString+"\" size=\""+nWidth+"\"></td>";
if(gbNav6)
sButton="<form id=\"searchInput\" name=\"searchForm\" method=\"POST\" action=\"javascript:searchB()\">"+sButton;
if("image"=="text")
{
sButton+="<td NOWRAP valign=\"middle\"><a class=\"searchbtn\" href=\"javascript:void(0);\" onclick=\"searchForm.submit(); return false;\"></a></td>";
}
else if("image"=="image"&&gsIGo)
{
sButton+="<td NOWRAP valign=\"middle\"><a class=\"searchbtn\" href=\"javascript:void(0);\" onclick=\"searchForm.submit(); return false;\">"
sButton+="<img alt=\"转至\" src=\""+gsIGo+"\" border=0 align=\"absmiddle\"></a></td>";
}
sButton+="</tr></table>";
if(gbNav6)
sButton+="</form>";
var nBtn=gaButtons.length;
gaButtons[nBtn]="<td NOWRAP align=\"center\" valign=\"middle\">"+sButton+"</td>";
gaTypes[nBtn]="searchform";
}
function getShowHide()
{
var sText="";
var sI="";
if(hasNavPane())
{
if(goHide)
{
if(gnShowHideStyle&BTN_TEXT)
sText=goHide.sText;
if(gnShowHideStyle&BTN_IMG)
sI=getImage(goHide,"Hide");
}
}
else
{
if(goShow)
{
if(gnShowHideStyle&BTN_TEXT)
sText=goShow.sText;
if(gnShowHideStyle&BTN_IMG)
sI=getImage(goShow,"Show");
}
}
var sButton=genButton(sText,sI,gnShowHideStyle);
return sButton;
}
function addBanner(sImage)
{
if(sImage)
{
var nBtn=gaButtons.length;
gaButtons[nBtn]="<td NOWRAP align=\"center\" valign=\"middle\"> <a href=\"javascript:void(0);\" onclick=\"showBanner();return false;\"><img alt=\"About WebHelp\"src=\""+sImage+"\" border=0 align=\"absmiddle\"></a></td>";
gaTypes[nBtn]="banner";
}
}
function showBanner()
{
if (!gbPreview)
{
var nWidth=390;
var nHeight=204;
var nScreenWidth=screen.width;
var nScreenHeight=screen.height;
var nLeft=(nScreenWidth-nWidth)/2;
var nTop=(nScreenHeight-nHeight)/2;
if (gbIE4)
{
if (gbIE5)
nHeight+=20;
else
nHeight+=40;
window.showModalDialog("whskin_banner.htm","","dialogHeight:"+nHeight+"px;dialogWidth:"+nWidth+"px;resizable:no;status:no;scroll:no;help:no;center:yes;");
}
else
window.open("whskin_banner.htm","banner","dependent,innerHeight="+nHeight+",innerWidth="+nWidth+",height="+nHeight+",width="+nWidth+",resizable=no,menubar=no,location=no,personalbar=no,status=no,scrollbar=no,toolbar=no,screenX="+nLeft+",screenY="+nTop);
}
}
function addButton(sType,nStyle,sTitle,sHref,sOnClick,sOnMouseOver,sOnLoad,nWidth,nHeight,sI1,sI2,sI3,sI4,sI5,sI6)
{
var sButton="";
var bMini=false;
var sText="";
var sI="";
var bState=false;
var nBtn=gaButtons.length;
var bHref=false;
if(sType=="show"&&isShowHideEnable())
{
var svTitle="显示导航组件";
sButton="<a title=\""+svTitle+"\" id=\"btnshowhide\" class=\"btnshow\" href=\"javascript:void(0);\" onclick=\"showHidePane();return false;\">";
gnShowHideStyle=nStyle;
goShow=new button(sType,sTitle,nWidth,nHeight,sI1,sI2,sI3);
gaObjBtns[nBtn]=goShow;
if(gnShowHide!=-1)
{
nBtn=gnShowHide;
}
else
{
gnShowHide=nBtn;
}
sButton+=getShowHide();
sButton+="</a>";
bState=true;
}
else if(sType=="hide"&&isShowHideEnable())
{
var svTitle="隐藏导航组件";
sButton="<a title=\""+svTitle+"\" id=\"btnshowhide\" class=\"btnhide\" href=\"javascript:void(0);\" onclick=\"showHidePane();return false;\">";
gnShowHideStyle=nStyle;
goHide=new button(sType,sTitle,nWidth,nHeight,sI1,sI2,sI3);
gaObjBtns[nBtn]=goHide;
if(gnShowHide!=-1)
{
nBtn=gnShowHide;
}
else
{
gnShowHide=nBtn;
}
sButton+=getShowHide();
sButton+="</a>";
bState=true;
}
else if(sType=="hide2"&&(!gbNav4))
{
var svTitle="隐藏导航组件";
sButton="<a title=\""+svTitle+"\" id=\"btnhide\" class=\"btnhide\" href=\"javascript:void(0);\" onclick=\"showHidePane();return false;\">";
gnShowHideStyle=nStyle;
if(!sI1)
sI1=gsIHide;
goHide2=new button(sType,sTitle,nWidth,nHeight,sI1,sI2,sI3);
gaObjBtns[nBtn]=goHide2;
if(nStyle&BTN_TEXT)
sText=goHide2.sText
if(nStyle&BTN_IMG)
sI=getImage(goHide2,svTitle);
sButton+=genButton(sText,sI,nStyle);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -