📄 toolbar.js
字号:
var RTL = false;
var scFlag = false;
var scrollcount = 0;
if (document.dir == 'rtl')
RTL = true;
var Strict_Compat = false;
var ToolBar_Supported = false;
var Frame_Supported = false;
var DoInstrumentation = false;
var doImage = doImage;
var TType = TType;
if (navigator.userAgent.indexOf("MSIE") != -1 &&
navigator.userAgent.indexOf("Windows") != -1 &&
navigator.appVersion.substring(0,1) > 3)
{
ToolBar_Supported = true;
if(!RTL){
if (document.compatMode == "CSS1Compat")
{
//alert("strict!");
Strict_Compat = true;
}
}
}
if(doImage == null)
{
var a= new Array();
a[0] = prepTrackingString(window.location.hostname,7);
if (TType == null)
{
a[1] = prepTrackingString('PV',8);
}
else
{
a[1] = prepTrackingString(TType,8);
}
a[2] = prepTrackingString(window.location.pathname,0);
if( '' != window.document.referrer)
{
a[a.length] = prepTrackingString(window.document.referrer,5);
}
if (navigator.userAgent.indexOf("SunOS") == -1 && navigator.userAgent.indexOf("Linux") == -1)
{
buildIMG(a);
}
}
if (ToolBar_Supported)
{
var newLineChar = String.fromCharCode(10);
var char34 = String.fromCharCode(34);
var LastMSMenu = "";
var LastICPMenu = "";
var CurICPMenu = "";
var IsMSMenu = false;
var IsMenuDropDown = true;
var HTMLStr;
var FooterStr;
var TBLStr;
var x = 0;
var y = 0;
var x2 = 0;
var y2 = 0;
var x3 = 0;
var MSMenuWidth;
var ToolbarMinWidth;
var ToolbarMenu;
var ToolbarBGColor;
var ToolbarLoaded = false;
var aDefMSColor = new Array(3);
var aDefICPColor = new Array(3);
var aCurMSColor = new Array(3);
var aCurICPColor = new Array(3);
var MSFont;
var ICPFont;
var MSFTFont;
var ICPFTFont;
var MaxMenu = 30;
var TotalMenu = 0;
var arrMenuInfo = new Array(30);
var bFstICPTBMenu = true;
var bFstICPFTMenu = true;
// Output style sheet and toolbar ID
document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");
// Build Footer template
if ( !RTL ){
FooterStr = "<TABLE ID='idFooter1' STYLE='background-color:white;' cellSpacing='0' cellPadding='0' border='0'>" +
"<TR VALIGN='BOTTOM'><TD ID='idPosition' WIDTH='185'> </TD><TD ID='idFooterDate1' STYLE='background-color:white;height:30' NOWRAP><!--ICP_FOOTERDATE1_TITLES--></TD></TR>" +
"<TR VALIGN='BOTTOM'><TD COLSPAN='2' ID='idFooterDate2' STYLE='background-color:white;height:13;width:100%' NOWRAP><!--ICP_FOOTERDATE2_TITLES--></TD></TR>" +
"</TABLE><TABLE ID='idFooter' STYLE='background-color:white;width:100%' cellSpacing='0' cellPadding='0' border='0'>" +
"<TR VALIGN='MIDDLE'><TD ID='idFooterRow1' STYLE='background-color:white;height:20;width:100%' NOWRAP><!--ICP_FOOTERMENU_TITLES--></TD></TR>" +
"<TR VALIGN='MIDDLE'><TD ID='idFooterRow2' STYLE='background-color:white;height:30;width:100%' NOWRAP><!--MS_FOOTERMENU_TITLES--></TD></TR>" +
"</TABLE>";
}else if(RTL){
// Shailr - Not sure if I need this code yet.
// RTL Correction: Check if <html> or <body> have the dir="rtl" attribute
var isRTL = false;
var isIE5 = navigator.appVersion.indexOf("MSIE 4") == -1;
if (isIE5)
{
if (document.body.dir == 'rtl' || document.dir == 'rtl')
isRTL = true;
}
else // test RTL in IE4
{
var ht = document.body.outerHTML;
ht = ht.substring(1, ht.indexOf(">")).toLowerCase();
//if (ht.indexOf("dir=rtl") > -1) isRTL = true;
if ((ht.indexOf("iedir=rtl") > -1) || (ht.indexOf("dir=rtl") > -1)) isRTL = true;
}
// End of RTL Correction.
// MNP1 addition - Build Footer template
FooterStr = "<TABLE ID='idFooter1' STYLE='background-color:white;' cellSpacing='0' cellPadding='0' border='0'>" +
"<TR VALIGN='BOTTOM'><TD ID='idPosition' WIDTH='185'> </TD><TD ID='idFooterDate1' STYLE='background-color:white;height:30' NOWRAP><!--ICP_FOOTERDATE1_TITLES--></TD></TR>" +
"<TR VALIGN='BOTTOM'><TD COLSPAN='2' ID='idFooterDate2' STYLE='background-color:white;height:13;width:100%' NOWRAP><!--ICP_FOOTERDATE2_TITLES--></TD></TR>" +
"</TABLE><TABLE ID='idFooter' STYLE='background-color:white;width:100%' cellSpacing='0' cellPadding='0' border='0'>" +
"<TR VALIGN='MIDDLE'><TD ID='idFooterRow1' STYLE='background-color:white;height:20;width:100%' NOWRAP><!--ICP_FOOTERMENU_TITLES--></TD></TR>" +
"<TR VALIGN='MIDDLE'><TD ID='idFooterRow2' STYLE='background-color:white;height:30;width:100%' NOWRAP><!--MS_FOOTERMENU_TITLES--></TD></TR>" +
"</TABLE>";
//end of MNP1 addition
//isRTL = true;
}
// Build toolbar template
HTMLStr = "<DIV ID='idToolbar' STYLE='background-color:white;width:100%;'>";
HTMLStr += "<DIV ID='idRow1' STYLE='position:relative;height:20px;'>";
//HTMLStr += "<DIV ID='idICPBanner' STYLE='position:absolute;top:0px;left:0px;height:60px;width:250px;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>";
if (!RTL){
//HTMLStr = "<DIV ID='idToolbar' STYLE='background-color:white;width:100%'>";
//HTMLStr += "<DIV ID='idRow1' STYLE='position:relative;height:20px;'>";
HTMLStr += "<DIV ID='idICPBanner' STYLE='position:absolute;top:0px;left:0px;height:60px;width:250px;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>";
HTMLStr += "<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0px;left:250px;height:20px;width:18px;overflow:hidden;vertical-align:top;'><IMG SRC='/library/toolbar/images/curve.gif' BORDER=0></DIV>";
HTMLStr += "<DIV ID='idMSMenuPane' STYLE='position:absolute;top:0px;left:250px;height:20px;width:10px;background-color:black;float:right;' NOWRAP><!--MS_MENU_TITLES--></DIV>";
HTMLStr += "</DIV>";
}else if(RTL){
TBLStr = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR STYLE='height:20;vertical-align:middle'><!--ICP_MENU_TITLES--></TR></TABLE>";
//HTMLStr = "<DIV ID='idToolbar' STYLE='background-color:white;width:100%'>";
//HTMLStr += "<DIV ID='idRow1' STYLE='position:relative;height:20;'>";
HTMLStr += "<DIV ID='idICPBanner' STYLE='position:absolute;top:0;left:0;height:60;width:250;overflow:hidden;vertical-align:top;'><!--BEG_ICP_BANNER--><!--END_ICP_BANNER--></DIV>";
HTMLStr += "<DIV ID='idMSMenuCurve' STYLE='position:absolute;top:0;left:250;height:20;width:18;overflow:hidden;vertical-align:top;'><IMG SRC='/library/toolbar/iw/images/curve.gif' BORDER=0></DIV>";
// RTL Correction: added: dir='ltr' (forcing LTR!), added: (prevents last menu problem)
HTMLStr += "<DIV dir='ltr' lang='he' ID='idMSMenuPane' STYLE='position:absolute;top:0;left:250;height:20;width:10;color:white;background-color:black;float:left;' NOWRAP><!--MS_MENU_TITLES--> </DIV>";
HTMLStr += "</DIV>";
}
if(!RTL){
HTMLStr += "<DIV ID='idRow2' STYLE='position:relative;left:250px;height:40px;'>";
HTMLStr += "<DIV ID='idADSBanner' STYLE='position:absolute;top:0px;left:0px;height:40px;width:200px;vertical-align:top;overflow:hidden;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>";
HTMLStr += "<DIV ID='idMSCBanner' STYLE='position:absolute;top:0px;left:180px;height:40px;width:112px;vertical-align:top;overflow:hidden;' ALIGN=RIGHT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>";
HTMLStr += "</DIV>";
}else if(RTL){
HTMLStr += "<DIV ID='idRow2' STYLE='position:relative;left:000;height:40px;'>" ; // RTL Correction: was left:250
HTMLStr += "<DIV ID='idADSBanner' STYLE='position:absolute;top:0;left:0;height:40;width:200;vertical-align:top;overflow:hidden;'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></DIV>";
HTMLStr += "<DIV ID='idMSCBanner' STYLE='position:absolute;top:0;left:200;height:40;width:112;vertical-align:top;overflow:hidden;' ALIGN=LEFT><!--BEG_MSC_BANNER--><!--END_MSC_BANNER--></DIV>";
HTMLStr += "</DIV>";
}
if(!RTL){
HTMLStr += "<DIV ID='idRow3' STYLE='position:relative;height:20px;width:100%'>";
// zIndex Correction
HTMLStr += "<DIV ID='idICPMenuPane' STYLE='position:absolute;top:0px;left:0px;height:20px;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>";
HTMLStr += "</DIV>";
HTMLStr += "</DIV>";
}else if (RTL){
HTMLStr += "<DIV ID='idRow3' STYLE='position:relative;height:20px;width:100%'>";
// RTL Correction: added: dir='rtl'
HTMLStr += "<DIV dir='rtl' ID='idICPMenuPane' STYLE='position:absolute;top:0;left:0;height:20px;color:white;background-color:black;' NOWRAP><!--ICP_MENU_TITLES--></DIV>";
HTMLStr += "</DIV>";
HTMLStr += "</DIV>";
HTMLStr += "<SCRIPT FOR=idToolbar EVENT=onresize>resizeToolbar();</SCRIPT>";
HTMLStr += "<SCRIPT FOR=idToolbar EVENT=onmouseover>hideMenu();</SCRIPT>";
}
HTMLStr += "<SCRIPT TYPE='text/javascript'>" +
" var ToolbarMenu = StartMenu;" +
"</SCRIPT>" +
"<DIV WIDTH=100%>";
// Define event handlers
if(!RTL){
window.onresize = resizeToolbar;
window.onscroll = scrollbaroptions;
}
// Intialize global variables
ToolbarBGColor = "white"; // toolbar background color
if (Strict_Compat)
{
MSFont = "bold x-small Arial";
ICPFont = "bold x-small Verdana";
}
else
{
if( !RTL ){
MSFont = "xx-small Verdana";
ICPFont = "bold xx-small Verdana";
}else if(RTL){
MSFont = "x-small Arial"; // RTL Correction: (was Verdana)
ICPFont = "bold x-small Arial"; // RTL Correction: (was Verdana)
//MNP1 RTL revision
MSFTFont = "11px Arial";
ICPFTFont = "bold 11px Arial"
//end
}
}
aDefMSColor[0] = aCurMSColor[0] = "black"; // bgcolor;
aDefMSColor[1] = aCurMSColor[1] = "white"; // text font color
aDefMSColor[2] = aCurMSColor[2] = "red"; // mouseover font color
aDefICPColor[0] = aCurICPColor[0] = "#6699CC"; // bgcolor;
aDefICPColor[1] = aCurICPColor[1] = "white"; // text font color
aDefICPColor[2] = aCurICPColor[2] = "red"; // mouseover font color
}
// The hard-coded numbers in functions - drawToolbar() & resizeToolbar()
// correspond to the dimension of the four gif files:
// ICP_BANNER: 60h x 250w
// ADS_BANNER: 40h x 200w
// MSC_BANNER: 40h x 112w
// Curve: 20h x 18w
function drawFooter(sLastUpdated, position)
{
if(!RTL){
var re = "<!--TEMPCOLOR-->";
var sUpdatedDate = "";
if (ToolbarBGColor.toUpperCase() == "WHITE" || ToolbarBGColor.toUpperCase() == "#FFFFFF")
{
while (FooterStr.indexOf(re) != -1)
FooterStr = FooterStr.replace(re, "000000");
}
else
{
while (FooterStr.indexOf(re) != -1)
FooterStr = FooterStr.replace(re, aDefICPColor[1]);
}
var re2 = "<!--TEMPCOLOR2-->";
while (FooterStr.indexOf(re2) != -1)
FooterStr = FooterStr.replace(re2, aDefICPColor[2]);
}else if (RTL){
var re = /<!--TEMPCOLOR-->/g;
var sUpdatedDate = "";
if (ToolbarBGColor.toUpperCase() == "WHITE" || ToolbarBGColor.toUpperCase() == "#FFFFFF")
FooterStr = FooterStr.replace(re, "000000");
else
FooterStr = FooterStr.replace(re, aDefICPColor[1]);
var re2 = /<!--TEMPCOLOR2-->/g;
FooterStr = FooterStr.replace(re2, aDefICPColor[2]);
}
sUpdatedDate = "<SPAN STYLE='font:" + MSFont + "'>"
if (typeof sLastUpdated != "undefined")
sUpdatedDate += sLastUpdated;
sUpdatedDate += "</SPAN>";
FooterStr = FooterStr.replace("<!--ICP_FOOTERDATE1_TITLES-->", sUpdatedDate);
document.body.innerHTML += FooterStr;
idFooterRow1.style.backgroundColor = aDefICPColor[0];
idFooterRow2.style.backgroundColor = ToolbarBGColor;
if (typeof sLastUpdated == "undefined")
idFooter1.style.display = "none";
if (typeof position != "undefined")
idPosition.width = position;
}
function drawToolbar()
{
HTMLStr += "</DIV>";
document.write(HTMLStr);
ToolbarLoaded = true;
MSMenuWidth = Math.max(idMSMenuPane.offsetWidth, (200+112));
ToolbarMinWidth = (250+18) + MSMenuWidth;
idToolbar.style.backgroundColor = ToolbarBGColor;
idMSMenuPane.style.backgroundColor = aDefMSColor[0];
idICPMenuPane.style.backgroundColor = aDefICPColor[0];
if (RTL){
idMSMenuPane.style.color = aDefMSColor[1];
idICPMenuPane.style.color = aDefICPColor[1];
}
resizeToolbar();
for (i = 0; i < TotalMenu; i++)
{
thisMenu = document.all(arrMenuInfo[i].IDStr);
if (thisMenu != null)
{
if (arrMenuInfo[i].IDStr == LastMSMenu && arrMenuInfo[i].type == "R")
{
//Last MSMenu has to be absolute width
arrMenuInfo[i].type = "A";
arrMenuInfo[i].unit = 200;
}
if (arrMenuInfo[i].type == "A")
if(!RTL){
thisMenu.style.width = arrMenuInfo[i].unit + 'px';
}else{
thisMenu.style.width = arrMenuInfo[i].unit;
}
else
thisMenu.style.width = Math.round(arrMenuInfo[i].width * arrMenuInfo[i].unit) + 'em';
}
}
}
function resizeToolbar()
{
scFlag = false;
scrollcount = 0;
if (ToolBar_Supported == false) return;
w = Math.max(ToolbarMinWidth, document.body.clientWidth) - ToolbarMinWidth;
if ( !RTL ){
if (document.all("idMSMenuCurve"))
{
idMSMenuCurve.style.left = (250+w) + 'px';
idMSMenuPane.style.left = (250+w+18) + 'px';
idMSMenuPane.style.width = MSMenuWidth + 'px';
idADSBanner.style.left = (w+18) + 'px';
idMSCBanner.style.left = (w+18+200) + 'px';
idMSCBanner.style.width = (MSMenuWidth - 200) + 'px';
idICPMenuPane.style.width = ToolbarMinWidth + w + 'px';
}
}else if( RTL ){
idMSMenuCurve.style.left = MSMenuWidth; // RTL Correction: was (250+w);
idMSMenuPane.style.left = 0; // RTL Correction: was (250+w+18);
idMSMenuPane.style.width = MSMenuWidth;
idADSBanner.style.left = 112; // RTL Correction: was (w+18);
idMSCBanner.style.left = 0; // RTL Correction: was (w+18+200);
idMSCBanner.style.width = (MSMenuWidth - 200);
idICPMenuPane.style.width = ToolbarMinWidth + w;
idICPBanner.style.left = MSMenuWidth + 18 + w; // RTL Correction: line added for ICPBanner positioning
}
}
function setToolbarBGColor(color)
{
ToolbarBGColor = color;
if (ToolbarLoaded == true)
idToolbar.style.backgroundColor = ToolbarBGColor;
}
function setBannerColor(bannerColor, bgColor, fontColor, mouseoverColor)
{
if (bannerColor.toUpperCase() != "WHITE" && bannerColor.toUpperCase() != "FFFFFF")
bgColor = bannerColor;
setToolbarBGColor(bannerColor);
setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor);
}
function setMSMenuFont(sFont)
{
MSFont = sFont;
}
function setICPMenuFont(sFont)
{
ICPFont = sFont;
}
function setDefaultMSMenuColor(bgColor, fontColor, mouseoverColor)
{
if (bgColor != "") aDefMSColor[0] = bgColor;
if (fontColor != "") aDefMSColor[1] = fontColor;
if (mouseoverColor != "") aDefMSColor[2] = mouseoverColor;
}
function setDefaultICPMenuColor(bgColor, fontColor, mouseoverColor)
{
if (bgColor != "") aDefICPColor[0] = bgColor;
if (fontColor != "") aDefICPColor[1] = fontColor;
if (mouseoverColor != "") aDefICPColor[2] = mouseoverColor;
}
function setICPMenuColor(MenuIDStr, bgColor, fontColor, mouseoverColor)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -