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

📄 wf_startpage.js

📁 在eclipse中使用js时用到的插件
💻 JS
📖 第 1 页 / 共 2 页
字号:

function IsHideNavEnabledForRemoteURL() {
	if (gbIE) {
		return true;
	} else {
		return false;
	}
}

function IsHideNavEnabled() {
	// We should always be able to resize and thus hide the navpane
	return true;
}


function DoCommand(cmd, param1, param2) {
	switch (cmd) {
		case "CmdCurrentNav":
			gsDefaultTab = param1;
			break;
			
		case "CmdSkinSwfLoaded":
			gbSkinLoaded = true;
			break;

		case "CmdTopicIsLoaded":
		case "CmdTopicDisplayed":
		case "CmdTopicUnloaded":
			SendCmdToMasterHTML(cmd, param1, param2);
			break;
			
		case "CmdSyncTOC":
			// Store the information in case it is requested later
			gsTOCSyncInfo = param1;

			// Send it off
			SendCmdToMasterHTML(cmd, param1, param2);
			break;
			
		case "CmdSyncInfo":
			// Store the information in case it is requested later
			gsTOCSyncInfo = param1;
			break;

		case "CmdBrowseSequenceInfo":
			// Store the information in case it is requested later
			gsBrowseSequenceInfo = param1;
			
			// Send it off
			SendCmdToMasterHTML(cmd, param1, param2);
			break;
			
		case "CmdGetBrowseSequenceInfo":
			// Send it off
			SendCmdToMasterHTML("CmdBrowseSequenceInfo", gsBrowseSequenceInfo);
			break;

		case "CmdTopicBGColor":
			// Store the information in case it is requested later and send it off
			gnTopicBGColor = param1;
			SendCmdToMasterHTML(cmd, param1, param2);
			break;

		case "CmdGetTopicBGColor":
			SendCmdToMasterHTML("CmdTopicBGColor", gnTopicBGColor);
			break;
								
		case "CmdGetSkinFilename":
			SendCmdToMasterHTML("CmdSkinFilename", gsActiveSkinFileName);
			break;

		case "CmdDisplayTopic":
			// Navigate to the proper HTML file
			NavigateToTopic(param1, param2);
			break;

		case "CmdHideNavigation":
			ShowNavigationPane(false);
			break;
	
		case "CmdGetToolbarOrder":
			gbToolBarLoaded = true;
			CheckForPrint();
			SendCmdToMasterHTML("CmdToolbarOrder", gsToolbarOrder);
			break;

		case "CmdGetNavbarOrder":
			SendCmdToMasterHTML("CmdNavbarOrder", gsNavigationElement);
			break;

		case "CmdShowNavigation":
			ShowNavigationPane(true);
			break;
		
		case "CmdGetSyncTOC":
			SendCmdToMasterHTML("CmdSyncTOC", gsTOCSyncInfo, 0);
			break;
		
		case "CmdIsAutoSyncTOCEnabled":
			SendCmdToMasterHTML("CmdAutoSyncTOCEnabled", gbAutoSync);
			break;
			
		case "CmdGetDefaultNav":
			SendCmdToMasterHTML("CmdSelectItem", gsDefaultTab, param1);
			break;
		
		case "CmdSetFocus":
		
			if (param1 == "Navigation") {
				if (window.frames["Content"].frames["bottom"].frames["Navigation Pane"])
				{
					if (window.frames["Content"].frames["bottom"].frames["Navigation Pane"].navpaneSWF) {
						if (window.frames["Content"].frames["bottom"].frames["Navigation Pane"].navpaneSWF.focus)
						{
							window.frames["Content"].frames["bottom"].frames["Navigation Pane"].navpaneSWF.focus();
						}
					}
				}
			} else if (param1 == "Topic") {
				window.frames["Content"].frames["bottom"].frames["Topic Pane"].focus();
			}
			break;
		
		case "CmdPrint":
			PrintCurrent();
			break;
									
		case "CmdInvokePoweredBy":

			// Create a centered window
			var left = (screen.width / 2) - 200;
			var top = (screen.height / 2) - 200;
			var width = 300;
			var height = 200;
			if ((gbNav) && (gbNav4) && (!gbNav6)) {
				width += 10;
				height += 10;
			}

			// Open the window if it is not already open
			if ((gPoweredByWindow == null) || (gPoweredByWindow.closed == true)) {
			
				// Create the parameter list
				var param_str = "uniqueHelpID=" + UniqueID();
				param_str += "&pbpoweredby=" + gsFlashHelpVersion;
				param_str += "&pbgeneratedby=" + gsGeneratorVersion;
				param_str += "&pbaboutlabel="+param1;
				
				// Take different action depending on the browser
				if ((gbIE5 && gbWindows) && (!gbOpera)) {
					height += 30;
					var strWindow = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;resizable:no;status:no;scroll:no;help:no;center:yes;';
					gPoweredByWindow = window.showModelessDialog("wf_poweredby.htm", param_str, strWindow);

				} else 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 window.open of an HTML file during the processing of an fscommand.
					var strURL = "wf_poweredby.htm?" + param_str;
					var strWindow = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
					setTimeout("window.open('" + strURL + "', 'PoweredByWindow', '" + strWindow + "')", 100);
					
				} else if (gbIE4 && !gbIE5) {

					// Create the window string and add the parameters to the filename
					var strURL = "wf_poweredby.htm#" + param_str;
					var strWindow = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
					gPoweredByWindow = window.open(strURL, 'PoweredByWindow', strWindow);
				} else {
					// Create the window string and add the parameters to the filename
					var strURL = "wf_poweredby.htm?" + param_str;
					var strWindow = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top;
					gPoweredByWindow = window.open(strURL, 'PoweredByWindow', strWindow);
				}
			} else if (gPoweredByWindow != null) {
				gPoweredByWindow.focus();
			}
			break;
			
		case "CmdAskIsTopicOnly":
			param1.isTopicOnly=false;
			break;
			
		case "CmdScrollbarDragStart":
			ScrollbarDragStart(Number(param1), Number(param2));
			break;
			
		case "CmdScrollbarDragStop":
			ScrollbarDragStop(Number(param1), Number(param2));
			break;
			
		case "CmdScrollbarDragMove":
			ScrollbarDrag(Number(param1), Number(param2));
			break;
		
		case "CmdIsNavResizeVisible":
			SendCmdToMasterHTML("CmdNavResizeVisible", 	(gbNav4 || gbOpera) ? 1 : 0);
			break;

		case "CmdNavigationCleanupComplete":
			// Cleanup finished - we can now reload
			gbNavPaneLoaded = false;
			if (gbReloadNavigationOnly) {
				window.frames["Content"].frames["bottom"].frames["Navigation Pane"].window.location.reload();
				gbReloadNavigationOnly = false;
			} else {
				window.frames["Content"].frames["bottom"].window.location.reload();
			}
			break;
		case "CmdNavigationPaneLoaded":
			gbNavPaneLoaded = true;
			break;			
		case "CmdUILoadFailure":
			// Inform the user and load the plain HTML version of the help system
			alert(param1 + " failed to load the following components:\n" + param2 + "\nThe non-Flash version of the help system will be displayed.");
			window.location.replace("wf_njs.htm");
			break;
		
		case "CmdReloadNavigation":
			ReloadNavigation();
			break;

		case "CmdCanFocusBeSet":
			SendCmdToMasterHTML("CmdFocusCanBeSet", ((gbIE && !gbMac) ? true : false));
			break;
		
		case "CmdIsHideNavEnabled":
			SendCmdToMasterHTML("CmdHideNavEnabled", IsHideNavEnabled());
			break;
		
		case "CmdIsHideNavEnabledForRemoteURL":
			SendCmdToMasterHTML("CmdHideNavEnabledForRemoteURL", IsHideNavEnabledForRemoteURL());
			break;
		
		default:
			// See if this is a debug command and send it along to the master
			if (cmd.substr(0, 6) == "debug:") {
				SendCmdToMasterHTML(cmd, param1, param2);
			}
			break;
	}
}

// Create a unique string to ID this instance of the help system
function UniqueID() {
	return UniqueIDString;
}

function TestLoaded(bVert) {
	gbAutoSync = 1;
	gsNavigationElement="Previous|Next|Sync TOC|Hide";
	gsToolbarOrder="Contents|Index|Search|Glossary|Print|SearchInput|Logo/Author";
	gsDefaultTab="Index";
	gsActiveSkinFileName = "skin.xml";
	gsFlashHelpVersion="FlashHelp 1.5";
	gsGeneratorVersion="RoboHelp XX";
	DoCommand("CmdSetFocus","Navigation");
}

// Send the first command - setting the skin filename to the master
function Loaded() {
//	SendCmdToMasterHTML("CmdSkinFilename", gsActiveSkinFileName);
	// Reset the CurFrameset Col & Row because opera will not do this on reload
	gsCurFramesetCol = gsDefaultFramesetCol;
	gsCurFramesetRow = gsDefaultFramesetRow

	DoCommand("CmdSetFocus","Navigation");
}



var gnPans=2;
var gsTopic="0000_introduction.htm";

var gsAutoSync="1";
var gbAutoSync = (gsAutoSync == "1") ? 1 : 0;

var gsNavigationElement="Previous|Next|Hide";
var gsToolbarOrder="Contents|Index|Search|Print|SearchInput|Logo/Author";
var gsDefaultTab="Contents";
var gsActiveSkinFileName="flashhelp_default.fhs";
var gsLowCaseFileName="1";
var gsFlashHelpVersion="FlashHelp%201.5";
var gsGeneratorVersion="RoboHelp%20X5.0";
var gsResFileName="wfres.xml";
var gsToolbarPaneHeight="50";

// Set a default topic for testing
if (gsTopic.substr(0, 2) == "%%") {
	gsTopic = "wf_topic.htm";
}

if (gsToolbarPaneHeight.substr(0, 2) == "%%") {
	gsToolbarPaneHeight = "50";
}

// Don't show the navigation pane if there is nothing to show
if ((gsToolbarOrder.substr(0, 2) != "%%") &&
	(gsToolbarOrder.indexOf('Contents') == -1) &&
	(gsToolbarOrder.indexOf('Index') == -1) &&
	(gsToolbarOrder.indexOf('Search') == -1) &&
	(gsToolbarOrder.indexOf('Glossary') == -1)) {
	
	if (gbVertical) {
		gsCurFramesetRow = "0, *";
	} else {
		gsCurFramesetCol = "0, *";
	}
}


// Remove the "print" button as a possibility if the print function is not supported
function CheckForPrint() {
	if (!window.print || (gbMac && (gbNav6 && !gbNav7)) || gbOpera) {
		var iPrint = gsToolbarOrder.indexOf("Print");
		if (iPrint != -1) {
			var sNewOrder = gsToolbarOrder.substr(0, iPrint);
			if (gsToolbarOrder.length > iPrint + 5) {
				sNewOrder += gsToolbarOrder.substr(iPrint + 6, gsToolbarOrder.length);
			}
			gsToolbarOrder = sNewOrder;
		}
	}
}

	
if (location.hash.length > 1)
{
	if (location.hash.indexOf("#<") == 0)
	{
		document.location = "whcsh_home.htm#" + location.hash.substring(2);
	}
	else if (location.hash.indexOf("#>>") == 0)
	{
		parseParam(location.hash.substring(3));
	}
	else
	{
		var nPos = location.hash.indexOf(">>");
		if (nPos>1)
		{
			gsTopic = location.hash.substring(1, nPos);
			parseParam(location.hash.substring(nPos+2));
		}
		else
			gsTopic = location.hash.substring(1);

	}
	if (gnPans == 1 && gsTopic)
	{
		var strURL=location.href;
		if (location.hash)
		{
			var nPos=location.href.indexOf(location.hash);
			strURL=strURL.substring(0, nPos);
		}
		if (gbHasTitle)
			document.location=_getPath(strURL)+ "whskin_tw.htm" + location.hash;
		else
			document.location=_getPath(strURL)+ gsTopic;
	}
}

function parseParam(sParam)
{
	if (sParam)
	{
		var nBPos=0;
		do 
		{
			var nPos=sParam.indexOf(">>", nBPos);
			if (nPos!=-1)
			{
				if (nPos>0)
				{
					var sPart=sParam.substring(nBPos, nPos);
					parsePart(sPart);
				}
				nBPos = nPos + 2;
			}
			else
			{
				var sPart=sParam.substring(nBPos);
				parsePart(sPart);
				break;
			}
		} while(nBPos < sParam.length);
	}	
}

function parsePart(sPart)
{
	if(sPart.toLowerCase().indexOf("cmd=")==0)
	{
		gnCmd=parseInt(sPart.substring(4));
		if(gnCmd == CMD_SHOWTOC)
			gsDefaultTab="Contents";
		else if(gnCmd == CMD_SHOWINDEX)
			gsDefaultTab="Index";
		else if(gnCmd == CMD_SHOWSEARCH)
			gsDefaultTab="Search";
		else if(gnCmd == CMD_SHOWGLOSSARY)
			gsDefaultTab="Glossary";
	}
	else if(sPart.toLowerCase().indexOf("cap=")==0)
	{
		document.title=_browserStringToText(sPart.substring(4));
		gbHasTitle=true;
	}
	else if(sPart.toLowerCase().indexOf("pan=")==0)
	{
		gnPans=parseInt(sPart.substring(4));
	}
	else if(sPart.toLowerCase().indexOf("pot=")==0)
	{
		gnOpts=parseInt(sPart.substring(4));
	}
	else if(sPart.toLowerCase().indexOf("pbs=")==0)
	{
		var sRawBtns = sPart.substring(4);
		var aBtns = sRawBtns.split("|");
		for (var i=0;i<aBtns.length;i++)
		{
			aBtns[i] = transferAgentNameToPaneName(aBtns[i]);
		}
		gsRawBtns = aBtns.join("|");
	}
	else if(sPart.toLowerCase().indexOf("pdb=")==0)
	{
		gsDefaultBtn=transferAgentNameToPaneName(sPart.substring(4));
	}
}

function transferAgentNameToPaneName(sAgentName)
{
	if (sAgentName =="toc")
		return "toc";
	else if	(sAgentName =="ndx")
		return "idx";
	else if	(sAgentName =="nls")
		return "fts";
	else if	(sAgentName =="gls")
		return "glo";
	return "";
}

⌨️ 快捷键说明

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