📄 toolbar.js
字号:
if (ToolbarLoaded == false) return;
// Reset previous ICP Menu color if any
if (CurICPMenu != "")
{
PrevID = CurICPMenu.substring(4);
CurICPMenu = "";
setICPMenuColor(PrevID, aDefICPColor[0], aDefICPColor[1], aDefICPColor[2]);
}
var id = "AM_" + "ICP_" + MenuIDStr;
var thisMenu = document.all(id);
if (thisMenu != null)
{
CurICPMenu = "ICP_" + MenuIDStr;
aCurICPColor[0] = bgColor;
aCurICPColor[1] = fontColor;
aCurICPColor[2] = mouseoverColor;
// Change menu color
if (bgColor != "")
thisMenu.style.backgroundColor = bgColor;
if (fontColor != "")
thisMenu.style.color = fontColor;
// Change subMenu color
id = "ICP_" + MenuIDStr;
thisMenu = document.all(id);
if (thisMenu != null)
{
if (bgColor != "")
thisMenu.style.backgroundColor = bgColor;
if (fontColor != "")
{
i = 0;
id = "AS_" + "ICP_" + MenuIDStr;
thisMenu = document.all.item(id,i);
while (thisMenu != null)
{
thisMenu.style.color = fontColor;
i += 1;
thisMenu = document.all.item(id,i);
}
}
}
}
}
function setAds(Gif,Url,AltStr)
{ setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
}
function setICPBanner(Gif,Url,AltStr)
{
if(RTL){
if (Gif.indexOf("training_banner_training.gif") > 0){
Gif = "training_banner_training.gif";
}
}
setBanner(Gif,Url,AltStr,"<!--BEG_ICP_BANNER-->","<!--END_ICP_BANNER-->");
}
function setMSBanner(Gif,Url,AltStr)
{ tempGif = "/library/toolbar/images/" + Gif;
setBanner(tempGif,Url,AltStr,"<!--BEG_MSC_BANNER-->","<!--END_MSC_BANNER-->");
}
function setBanner(BanGif, BanUrl, BanAltStr, BanBegTag, BanEndTag)
{
begPos = HTMLStr.indexOf(BanBegTag);
endPos = HTMLStr.indexOf(BanEndTag) + BanEndTag.length;
SubStr = HTMLStr.substring(begPos, endPos);
SrcStr = "";
if (BanUrl != "")
SrcStr += "<A Target='_top' HREF='" + formatURL(BanUrl, BanGif) + "'>";
SrcStr += "<IMG SRC='" + BanGif + "' ALT='" + BanAltStr + "' BORDER=0>";
if (BanUrl != "")
SrcStr += "</A>";
SrcStr = BanBegTag + SrcStr + BanEndTag;
HTMLStr = HTMLStr.replace(SubStr, SrcStr);
}
function setICPSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{ tempID = "ICP_" + MenuIDStr;
setSubMenuWidth(tempID, WidthType, WidthUnit);
}
function setMSSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{ tempID = "MS_" + MenuIDStr;
setSubMenuWidth(tempID, WidthType, WidthUnit);
}
function setSubMenuWidth(MenuIDStr, WidthType, WidthUnit)
{
var fFound = false;
if (TotalMenu == MaxMenu)
{
alert("Unable to process menu. Maximum of " + MaxMenu + " reached.");
return;
}
for (i = 0; i < TotalMenu; i++)
if (arrMenuInfo[i].IDStr == MenuIDStr)
{
fFound = true;
break;
}
if (!fFound)
{
arrMenuInfo[i] = new menuInfo(MenuIDStr);
TotalMenu += 1;
}
if (!fFound && WidthType.toUpperCase().indexOf("DEFAULT") != -1)
{
arrMenuInfo[i].type = "A";
arrMenuInfo[i].unit = 160;
}
else
{
arrMenuInfo[i].type = (WidthType.toUpperCase().indexOf("ABSOLUTE") != -1)? "A" : "R";
arrMenuInfo[i].unit = WidthUnit;
}
}
// This function creates a menuInfo object instance.
function menuInfo(MenuIDStr)
{
this.IDStr = MenuIDStr;
this.type = "";
this.unit = 0;
this.width = 0;
this.count = 0;
}
function updateSubMenuWidth(MenuIDStr)
{
for (i = 0; i < TotalMenu; i++)
if (arrMenuInfo[i].IDStr == MenuIDStr)
{
if (arrMenuInfo[i].width < MenuIDStr.length)
arrMenuInfo[i].width = MenuIDStr.length;
arrMenuInfo[i].count = arrMenuInfo[i].count + 1;
break;
}
}
function addICPMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{
if(RTL){
if (LastICPMenu == "") HTMLStr = HTMLStr.replace("<!--ICP_MENU_TITLES-->", TBLStr);
}
if (addICPMenu.arguments.length > 4)
TargetStr = addICPMenu.arguments[4];
else
TargetStr = "_top";
tempID = "ICP_" + MenuIDStr;
addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, true);
if (RTL){
LastICPMenu = tempID;
}else{
bFstICPTBMenu=false;
}
}
function addMSMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{
TargetStr = "_top";
tempID = "MS_" + MenuIDStr;
//alert(" TempID: " + tempID + " MenuDisplayString: " + MenuDisplayStr + " Menu Help String :" + MenuHelpStr + " MenuUrl:" + MenuURLStr + " Target:" + TargetStr);
addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, false);
LastMSMenu = tempID;
}
function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr, TargetStr, bICPMenu)
{
cFont = bICPMenu? ICPFont : MSFont;
cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
if (RTL){
cStyle = "font:" + cFont + ";background-color:" + cColor0 + ";color:" + cColor1 + ";";
if (MenuHelpStr == "") MenuHelpStr = MenuDisplayStr; // Shailr. This line should have been before the line MenuStr = newLineChar; but I am tryig to avoid another if..else
}
tagStr = bICPMenu? "<!--ICP_MENU_TITLES-->" : "<!--MS_MENU_TITLES-->";
MenuStr = newLineChar;
if (!RTL){
if ((bICPMenu == false && LastMSMenu != "") || (bICPMenu == true && bFstICPTBMenu==false))
MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'>| </SPAN>";
MenuStr += "<A TARGET='" + TargetStr + "' TITLE='" + MenuHelpStr + "'" +
" ID='AM_" + MenuIDStr + "'" +
" STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";background-color:" + cColor0 + ";color:" + cColor1 + ";'";
if (MenuURLStr != "")
{
if (bICPMenu)
MenuStr += " HREF='" + formatURL(MenuURLStr, ("ICP_" + MenuDisplayStr)) + "'";
else
MenuStr += " HREF='" + formatURL(MenuURLStr, ("MS_" + MenuDisplayStr)) + "'";
}
else
MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
MenuStr += " onmouseout=" + char34 + "mouseMenu('out' ,'" + MenuIDStr + "'); hideMenu();" + char34 +
" onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
" " + MenuDisplayStr + " </a>";
MenuStr += tagStr;
}
if ( RTL ){
if (bICPMenu)
MenuStr += "<TD STYLE='" + cStyle + "' ID='AM_" + MenuIDStr + "' NOWRAP>";
else{
// RTL Correction: added: dir='rtl' (for MSMenu)
MenuStr += "<SPAN dir='rtl' STYLE='" + cStyle + "'>";
if (LastMSMenu != "") MenuStr += "|";
MenuStr += " ";
}
MenuStr += "<A STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + ";'" +
" TARGET='" + TargetStr + "'" +
" TITLE=" + char34 + MenuHelpStr + char34;
if (MenuURLStr != "")
MenuStr += " HREF='" + formatURL(MenuURLStr, ((bICPMenu? "ICP_":"MS_") + MenuDisplayStr)) + "'";
else
MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
MenuStr += " onmouseout=" + char34 + "mouseMenu('out' ,'" + MenuIDStr + "'); hideMenu();" + char34 +
" onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "'); doMenu('"+ MenuIDStr + "');" + char34 + ">" +
" " + MenuDisplayStr + " </a>";
if (bICPMenu)
MenuStr += " </TD><TD STYLE='" + cStyle + "'>|</TD>";
else
MenuStr += "</SPAN>";
MenuStr += tagStr;
}
HTMLStr = HTMLStr.replace(tagStr, MenuStr);
setSubMenuWidth(MenuIDStr,"default",0);
}
function addICPSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{
if (addICPSubMenu.arguments.length > 3)
TargetStr = addICPSubMenu.arguments[3];
else
TargetStr = "_top";
tempID = "ICP_" + MenuIDStr;
addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,true);
}
function addMSSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{
TargetStr = "_top";
tempID = "MS_" + MenuIDStr;
//alert("TempID: " + tempID + "\nSubMenuStr: " + SubMenuStr + "\n SubMenuURLStr: " + SubMenuURLStr + "\n TargetStr: " + TargetStr);
addSubMenu(tempID,SubMenuStr,SubMenuURLStr,TargetStr,false);
}
function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr, TargetStr, bICPMenu)
{
cFont = bICPMenu? ICPFont : MSFont;
cColor0 = bICPMenu? aDefICPColor[0] : aDefMSColor[0];
cColor1 = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
cColor2 = bICPMenu? aDefICPColor[2] : aDefMSColor[2];
var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
InstrumentStr = MenuIDStr.substring(0 , MenuPos) + "|" + SubMenuStr;
URLStr = formatURL(SubMenuURLStr, InstrumentStr);
var LookUpTag = "<!--" + MenuIDStr + "-->";
var sPos = HTMLStr.indexOf(LookUpTag);
if (sPos <= 0)
{
HTMLStr += newLineChar + newLineChar +
"<SPAN ID='" + MenuIDStr + "'";
if (!RTL){
HTMLStr += " STYLE='display:none;position:absolute;width:160px;background-color:" + cColor0 + ";padding-top:0px;padding-left:0px;padding-bottom:20px;z-index:9px;'";
}else if (RTL){
HTMLStr += " STYLE='display:none;position:absolute;width:160;background-color:" + cColor0 + ";padding-top:0;padding-left:0;padding-bottom:20;z-index:9;'";
}
HTMLStr += "onmouseout='hideMenu();'>";
if (Frame_Supported == false || bICPMenu == false)
if (!RTL){
HTMLStr += "<HR STYLE='position:absolute;left:0px;top:0px;color:" + cColor1 + "' SIZE=1>";
HTMLStr += "<DIV STYLE='position:relative;left:0px;top:8px;'>";
} else if (RTL){
HTMLStr += "<HR STYLE='position:absolute;left:0;top:0;color:" + cColor1 + "' SIZE=1>";
HTMLStr += "<DIV STYLE='right:0;top:8;' dir='rtl'>";
}
}
TempStr = newLineChar +
"<A ID='AS_" + MenuIDStr + "'" +
" STYLE='text-decoration:none;cursor:hand;font:" + cFont + ";color:" + cColor1 + "'" +
" HREF='" + URLStr + "' TARGET='" + TargetStr + "'" +
" onmouseout=" + char34 + "mouseMenu('out' ,'" + MenuIDStr + "');" + char34 +
" onmouseover=" + char34 + "mouseMenu('over','" + MenuIDStr + "');" + char34 + ">" +
" " + SubMenuStr + "</A><BR>" + LookUpTag;
if (sPos <= 0)
HTMLStr += TempStr + "</DIV></SPAN>";
else
HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
updateSubMenuWidth(MenuIDStr);
}
function addICPSubMenuLine(MenuIDStr)
{
tempID = "ICP_" + MenuIDStr;
addSubMenuLine(tempID,true);
}
function addMSSubMenuLine(MenuIDStr)
{
tempID = "MS_" + MenuIDStr;
addSubMenuLine(tempID,false);
}
function addSubMenuLine(MenuIDStr, bICPMenu)
{
var LookUpTag = "<!--" + MenuIDStr + "-->";
var sPos = HTMLStr.indexOf(LookUpTag);
if (sPos > 0)
{
cColor = bICPMenu? aDefICPColor[1] : aDefMSColor[1];
TempStr = newLineChar + "<HR STYLE='color:" + cColor + "' SIZE=1>" + LookUpTag;
HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
}
}
function addMSFooterMenu(MenuDisplayStr, MenuURLStr)
{
addFooterMenu(MenuDisplayStr, MenuURLStr, false)
}
function addICPFooterMenu(MenuDisplayStr, MenuURLStr)
{
addFooterMenu(MenuDisplayStr, MenuURLStr, true)
bFstICPFTMenu = false;
}
function addFooterMenu(MenuDisplayStr, MenuURLStr, bICPMenu)
{
cFont = bICPMenu? ICPFont : MSFont;
cColor1 = aDefICPColor[1];
cColor2 = aDefICPColor[2];
tagStr = bICPMenu? "<!--ICP_FOOTERMENU_TITLES-->" : "<!--MS_FOOTERMENU_TITLES-->";
MenuStr = "";
if ((bICPMenu) && bFstICPFTMenu == false)
MenuStr += "<SPAN STYLE='font:" + cFont + ";color:" + cColor1 + "'> |</SPAN>";
if ((bICPMenu == false) && (MenuURLStr == ''))
MenuStr += "<SPAN STYLE='font:" + cFont + ";color:<!--TEMPCOLOR-->'> " + MenuDisplayStr + " </SPAN>";
else
{
MenuStr += " <A TARGET='_top' STYLE='";
if (bICPMenu)
MenuStr += "text-decoration:none;";
MenuStr += "cursor:hand;font:" + cFont + ";"
if (bICPMenu)
MenuStr += "color:" + cColor1 + ";'";
else
MenuStr += "color:<!--TEMPCOLOR-->" + ";'";
MenuStr += " HREF='" + MenuURLStr + "'";
MenuStr += " onmouseout=" + char34 + "this.style.color = '";
if (bICPMenu)
MenuStr += cColor1;
else
MenuStr += "<!--TEMPCOLOR-->";
MenuStr += "'" + char34 + " onmouseover=" + char34 + "this.style.color = '"
if (bICPMenu)
MenuStr += cColor2
else
MenuStr += "<!--TEMPCOLOR2-->";
MenuStr += "'" + char34 + ">" + MenuDisplayStr + "</A> ";
}
MenuStr += tagStr;
FooterStr = FooterStr.replace(tagStr, MenuStr);
}
function mouseMenu(id, MenuIDStr)
{
IsMSMenu = (MenuIDStr.toUpperCase().indexOf("MS_") != -1);
IsMouseout = (id.toUpperCase().indexOf("OUT") != -1);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -