📄 wf_startpage.js
字号:
// Variables used in the file
var dateObj = new Date();
var UniqueIDString = "" + dateObj.getTime();
var gsDefaultFramesetCol = "230, *";
var gsDefaultFramesetRow = "200, *";
// Set the variable for test scenario
if (gsDefaultFramesetRow.substr(0, 2) == "%%") {
gsDefaultFramesetRow = "300, *";
}
if (gsDefaultFramesetCol.substr(0, 2) == "%%") {
gsDefaultFramesetCol = "200, *";
}
var gsLastFramesetCol = gsDefaultFramesetCol;
var gsCurFramesetCol = gsDefaultFramesetCol;
var gsLastFramesetRow = gsDefaultFramesetRow;
var gsCurFramesetRow = gsDefaultFramesetRow;
var gbVertical = false;
var gsBrowseSequenceInfo = "";
var gsTOCSyncInfo = "";
var gPoweredByWindow = null;
var gnTopicBGColor = 16777215;
var gbSkinLoaded = false;
var gnScrollbarTimerID = -1;
var gnLastScrollbarWidthRequest = 0;
var gnScrollbarDragOffset = 0;
var gnInitialFrameWidth = 0;
var gnInitialXPos = 0;
var IE_FRAMESET_RESIZE_INTERVAL = 300;
var DIV_MOVE_INTERVAL = 30;
var gsFlashVars="";
var gbCommLoaded=true;
var gbNavReloaded=false;
var gbTbReloaded=false;
var gbReloadNavigationOnly = false;
var gbNavPaneLoaded = false;
var gbToolBarLoaded = false;
var gnMouseOver = -1;
var gnMouseMove = -1;
var gnTimeOutXPos = -1;
var gbMouseTimeOut = false;
var gbHasTitle = false;
var gsNavPane = "wf_blank.htm";
var gsParamPasser = "wf_blank.htm";
var gFrameInterval = null;
//const
var CMD_SHOWTOC=1;
var CMD_SHOWINDEX=2;
var CMD_SHOWSEARCH=3;
var CMD_SHOWGLOSSARY=4;
function CheckFrameRendered()
{
clearInterval(gFrameInterval);
gFrameInterval = setTimeout("RerenderFrames()",2000);
}
function RerenderFrames()
{
var bRerender = true;
if (window.frames["Content"])
{
if (window.frames["Content"].frames)
{
if (window.frames["Content"].frames["master"])
{
if (window.frames["Content"].frames["master"].DoCommand)
{
if (window.frames["comm"])
{
bRerender = false;
}
}
}
}
}
if (!bRerender && !window.frames["Content"].frames["master"].gbSWFLoaded && (gbNavPaneLoaded || gbToolBarLoaded))
{
bRerender = true;
}
if (bRerender)
{
window.location.reload();
}
}
// Funtion to send a command to the master HTML file
function SendCmdToMasterHTML(cmd, param1, param2) {
if ((window.frames["Content"] != null) &&
(window.frames["Content"].frames["master"] != null) &&
(window.frames["Content"].frames["master"].DoCommand != null))
{
window.frames["Content"].frames["master"].DoCommand(cmd, param1, param2);
}
}
function SendCmdToTopic(cmd, param) {
if ((window.frames["Content"].frames["bottom"] != null) &&
(window.frames["Content"].frames["bottom"].frames["Topic Pane"] != null) &&
(window.frames["Content"].frames["bottom"].frames["Topic Pane"].DoCommand != null)) {
window.frames["Content"].frames["bottom"].frames["Topic Pane"].DoCommand(cmd, param);
}
}
function NavigateToTopic(url, target) {
target = target + "";
if ((window.frames["Content"].frames["bottom"] != null) && (window.frames["Content"].frames["bottom"].frames["Topic Pane"] != null))
{
if (target == "" || target == null || target == "0")
{
if (gbNav4 && !gbNav6)
{
// For NS 4, we need to use setTimeout. After changing to use fscommand to communicate with NS 4 from Flash,
// NS 4 will not perform a change in the URL
setTimeout("window.frames['Content'].frames['bottom'].frames['Topic Pane'].location='" + url + "'", 100);
}
else
{
window.frames["Content"].frames["bottom"].frames["Topic Pane"].location = url;
}
}
else
{
if (gbNav4 && !gbNav6)
{
setTimeout("window.open('" + url + "', '" + target + "','')",100);
}
else
{
window.open(url,target,"");
}
}
}
}
function getElement(elementID) {
var element = null;
// See if the browser supports the functions we need to get to the element
if (document.getElementById) {
element = document.getElementById(elementID);
} else if (document.all) {
element = document.all(elementID);
}
return element;
}
function getBottomElement(elementID) {
var element = null;
// See if the browser supports the functions we need to get to the element
if (window.frames["Content"].frames["bottom"].document.getElementById) {
element = window.frames["Content"].frames["bottom"].document.getElementById(elementID);
} else if (window.frames["Content"].frames["bottom"].document.all) {
element = window.frames["Content"].frames["bottom"].document.all(elementID);
}
return element;
}
function ShowNavigationPane(bShow) {
// Get to the frameset element
var frameset = getBottomElement("Bottom Frame");
// Show or hide as appropriate
if (bShow) {
if (gbVertical) {
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
gsCurFramesetRow = gsLastFramesetRow;
RedoBottomFrame(bShow);
} else if (gbIE) {
frameset.rows = gsLastFramesetRow;
}
} else {
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
gsCurFramesetCol = gsLastFramesetCol;
RedoBottomFrame(bShow);
} else if (gbIE) {
frameset.cols = gsLastFramesetCol;
}
}
} else {
// "frameset.cols" contains a string of the frameset columns
// You can get and set this value for Netscape but it doesn't re-render
// the pages so it looks like it has no effect.
if (gbVertical) {
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
// For some reason, frameset.rows doesn't work list frameset.cols. So, let's use innerHeight instead.
gsLastFramesetRow = "" + window.frames["Content"].frames["bottom"].frames["Navigation Pane"].innerHeight + ", *";
gsCurFramesetRow = "0, *";
RedoBottomFrame(bShow);
} else if (gbIE) {
window.frames["Content"].frames["bottom"].frames["Navigation Pane"].gbNavClosed = true;
if (gbIE6)
{
gsLastFramesetRow = frameset.rows;
}
else
{
gsLastFramesetRow = "" + window.frames["Content"].frames["bottom"].frames["Navigation Pane"].document.body.clientHeight + ", *";
}
frameset.rows = "0, *";
}
} else {
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
gsLastFramesetCol = gsCurFramesetCol;
gsCurFramesetCol = "0, *";
RedoBottomFrame(bShow);
} else if (gbIE) {
gsLastFramesetCol = frameset.cols;
frameset.cols = "0, *";
}
}
}
return;
}
function PrintCurrent() {
// Give the topic pane the focus and print
if (gbNav) {
window.frames["Content"].frames["bottom"].frames["Topic Pane"].print();
} else {
window.frames["Content"].frames["bottom"].frames["Topic Pane"].focus();
window.print();
}
}
function SaveState()
{
gsTopic = window.frames["Content"].frames["bottom"].frames["Topic Pane"].document.location.href;
}
function RedoBottomFrame(bShow)
{
// Save the current topic
SaveState();
if (gbNavPaneLoaded)
{
SendCmdToMasterHTML("CmdNavigationCleanup");
}
else
{
SendCmdToMasterHTML("CmdNavigationCleanupComplete");
}
}
function ReloadNavigation() {
gbReloadNavigationOnly = true;
RedoBottomFrame(false);
}
function SetVertical(bVertical) {
gbVertical = bVertical;
}
//////////////////////////////////////////////////////////////////////////////
//
// Frame resizing code
//
// We only want to try to resize the framesets every so often or the browsers
// will fall behind. A timer is set up to achieve this purpose and only the
// last requested size is used when resizing.
//
//////////////////////////////////////////////////////////////////////////////
function BeginMouseCapture()
{
var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
topicPane.document.onmouseover = MouseOver;
}
function MouseOver(e)
{
var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
var xMousePos = 0;
if (!e)
{
e = topicPane.window.event;
}
if (e.x)
{
xMousePos = e.x
}
else
{
xMousePos = e.pageX;
}
gnMouseOver = xMousePos;
if (gbOpera && gbMac)
{
ScrollbarDragStop(gnMouseOver + gnInitialFrameWidth,0);
}
topicPane.document.onmouseover = null;
}
function ScrollbarDragStart(x, y) {
if (gbSafari || (gbMac && gbOpera))
{
BeginMouseCapture();
}
// Calculate how far the mouse is from the edge of the frameset at the beginning
if (gbNav4) {
gnInitialFrameWidth = window.frames["Content"].frames["bottom"].frames["Navigation Pane"].window.innerWidth;
} else {
gnInitialFrameWidth = window.frames["Content"].frames["bottom"].frames["Navigation Pane"].document.body.clientWidth;
}
gnInitialXPos = x;
gnScrollbarDragOffset = gnInitialFrameWidth - x;
// Record the position
gnLastScrollbarWidthRequest = x;
// Let the topic know about the start drag if necessary. Calculate the coordinates in the topic coordinate space
var interval = IE_FRAMESET_RESIZE_INTERVAL;
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
var newX = x - gnInitialFrameWidth;
SendCmdToTopic("CmdScrollbarDragStart", newX);
interval = DIV_MOVE_INTERVAL;
}
// Make an initial call to "resize" the frameset
ResizeFrameset();
// Start a timer that will regulate how often the frameset is "resized"
gnScrollbarTimerID = setInterval("ResizeFrameset()", interval);
}
function MousePos_nsm(e)
{
var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
var xMousePos = 0;
if (!e)
{
e = topicPane.window.event;
}
if (e.x)
{
xMousePos = e.x
}
else
{
xMousePos = e.pageX;
}
gnMouseMove = xMousePos;
topicPane.document.onmousemove = null;
}
function ScrollbarDragStop(x, y) {
clearInterval(gnScrollbarTimerID);
// Resize for Netscape 7 on a MAC
if (gbNav7 && gbMac && !gbMouseTimeOut)
{
var topicPane = window.frames["Content"].frames["bottom"].frames["Topic Pane"];
gnMouseMove = -1;
topicPane.document.onmousemove = MousePos_nsm;
gbMouseTimeOut = true;
gnTimeOutXPos = x;
setTimeout("ScrollbarDragStop()",1000)
return;
}
else if (gbNav7 && gbMac && gbMouseTimeOut && (gnMouseMove > -1))
{
x = gnMouseMove + gnInitialFrameWidth;
gnLastScrollbarWidthRequest = gnMouseMove + gnInitialFrameWidth;
gnMouseMove = -1;
gbMouseTimeOut = false;
}
else if (gbNav7 && gbMac && gbMouseTimeOut)
{
x = gnTimeOutXPos;
gbMouseTimeOut = false;
}
// Limit the resize down to zero
if (x < 0) {
x = 0;
}
if (gbSafari && gnMouseOver == -1 && !gbMouseTimeOut)
{
gnTimeOutXPos = x;
gbMouseTimeOut = true;
setTimeout("ScrollbarDragStop()",50);
return;
}
else if (gbSafari && gbMouseTimeOut)
{
x = gnTimeOutXPos;
gbMouseTimeOut = false;
}
gnLastScrollbarWidthRequest = x;
if (gbSafari && gnMouseOver > -1)
{
x = gnMouseOver + gnInitialFrameWidth;
gnLastScrollbarWidthRequest = gnMouseOver + gnInitialFrameWidth;
gnMouseOver = -1;
}
ResizeFrameset();
// Let the topic know about the stop drag if necessary. Calculate the coordinates in the topic coordinate space
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
var newX = x - gnInitialFrameWidth;
SendCmdToTopic("CmdScrollbarDragStop", newX);
}
// Resize the framesets where necessary
if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
if (gnInitialXPos != x){
gsCurFramesetCol = (x+gnScrollbarDragOffset) + ", *";
}
RedoBottomFrame(false);
}
}
function ResizeFrameset() {
if ((gbIE) && (!gbOpera)) {
// Resize the frames
var frameWidth = gnLastScrollbarWidthRequest + gnScrollbarDragOffset;
var frameset = getBottomElement("Bottom Frame");
frameset.cols = "" + frameWidth + ", *";
} else if (gbNav4 || gbOpera || gbKonqueror || gbSafari) {
// Let the topic know where to draw its resize bar
var newX = gnLastScrollbarWidthRequest - gnInitialFrameWidth;
SendCmdToTopic("CmdScrollbarDragMove", newX);
}
}
function ScrollbarDrag(x, y) {
gnLastScrollbarWidthRequest = x;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -