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

📄 whtopic.js

📁 在eclipse中使用js时用到的插件
💻 JS
📖 第 1 页 / 共 2 页
字号:
	}
	var argLen = fn_arguments.length;
	var e = fn_arguments[0];

	// Check to Make sure we have a valid number of parameters
	if (argLen < 3) 
	{
		return false;
	}
	
	var targetDoc = null;
	
	if (isInPopup())
	{
		targetDoc = parent;
	}
	else
	{
		targetDoc = this;
	}
	gRtTargetDoc = targetDoc;
	gsTargetFrame = fn_arguments[1];

	// If there is only one topic simply display this topic
	if (argLen <= 4) 
	{
		if (targetDoc != null) 
		{
			targetDoc.location.href = fn_arguments[3];
		}
		else 
		{
			if (fn_arguments[1] != null && typeof(fn_arguments[1]) != "undefined")
			{
				window.open(fn_arguments[3], fn_arguments[1]);
			}
			else
			{
				window.open(fn_arguments[3]);
			}
		}
		return false;
	}
	// Display the popup window
	else
	{
		// If the browser does not support DOM or ILayer open a new window
		if ((gbBsOpera6 && !gbBsOpera7) || gbKonqueror)
		{
			RtWindowCtrl(fn_arguments)
			return;
		}

		// Build the Flash Var List
		var strFlashVars = "";
		strFlashVars += "nItemCount="+argLen;
		strFlashVars += "&gsSkinSwf="+gsSkinIndexSwf;
		strFlashVars += "&gsFont="+gsSkinIndexFont;
		strFlashVars += "&gsFontHighlight="+gsSkinIndexHighlight;

		if (gbBsNS6 || gbBsNS4 || gbSafari)
		{
			strFlashVars += "&nTopicHeight="+(window.innerHeight-16);
		}
		else
		{
			strFlashVars += "&nTopicHeight="+(document.body.offsetHeight-20);
		}
		
		for (var i = 2; i < argLen; i++)
		{
			strFlashVars += "&arrVal"+i+"="+escapeChar(fn_arguments[i]);
		}
		gsFlashVars = strFlashVars;

		// Build the SWF Object
		var sHtml = "";
		if (gbMac && gbBsIE)
		{
			sHtml += "<TABLE STYLE='border:2px outset white;' BGCOLOR=#c0c0c0 id='relatedTopicsTB' width='1px' height='1px' CELLSPACING=0> <TR><TD>";
		}
		var rtWidth = "100%";
		var rtHeight = "100%";
		if ((gbBsNS6 && !gbNav7) || gbMozilla)
		{
			rtWidth = "1";
			rtHeight = "1";
		}

		sHtml += "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'";
		sHtml += "id='rlctrlSWF' ALIGN='' WIDTH='"+rtWidth+"' HEIGHT='"+rtHeight+"' VIEWASTEXT>";
		sHtml += "<PARAM NAME='base' value='"+strPath+"'>";
		sHtml += "<PARAM NAME='movie' VALUE='"+strPath+gsSwfLoader+"'>";
		sHtml += "<PARAM NAME=quality VALUE=high>";
		sHtml += "<PARAM NAME=FlashVars VALUE='" + strFlashVars + "'>";
		sHtml += "<EMBED src='"+strPath+gsSwfLoader+"' quality=high  NAME='rlctrlSWF' BASE="+strPath+" swLiveConnect='true' WIDTH='"+rtWidth+"' HEIGHT='"+rtHeight+"' ALIGN='' ";
		sHtml += "FlashVars='" + strFlashVars + "' ";
		sHtml += "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>";
		sHtml += "</EMBED>";
		sHtml += "</OBJECT>";
		if (gbMac && gbBsIE)
		{
			sHtml += "</TD></TR></TABLE>\n";
		}

		// Insert the SWF Object
		if (gbBsNS4 && !gbBsNS6) 
		{
			if (gbRtOpened)
			{
				closeRtCtrl();
				if (!gbMac && !gbWindows)
				{
					return;
				}
			}
			gbRtOpened = true;
			// Add an image otherwise NS4 will not render the swf
			sHtml += "<img src='"+strPath+"wf_loadswf.jpg'></img>";	
			gsHtml = sHtml;

			var rtLayer = document.layers["relatedTopicsLayer"];
			rtLayer.document.open();
			rtLayer.document.write(sHtml);
			rtLayer.document.close();
			gRtXPos = e.pageX;
			gRtYPos = e.pageY;
			gbRtSized = false;
			setTimeout("IsRtSized()",CHECK_RELATED_TIMEOUT);
		}
		else
		{
			var rtDiv = null;
			rtDiv = getElement("relatedTopicsDIV");
			rtDiv.style.visibility = "visible";
			rtDiv.innerHTML = sHtml;
			gRtXPos = e.clientX;
			gRtYPos = e.clientY;
			rtDiv.style.top  = 0;
			rtDiv.style.left = 0;
			rtDiv.style.width = 1;
			rtDiv.style.height= 1;
		
		}
		document.onmousedown = RtParentClicked;
		rtDiv.onmousedown = RtDivClicked;
	}
}

function RtDivClicked()
{
	gbDivClicked = true;
}

function sizeRtCtrl(rtWidth, rtHeight)
{
	var strPath = gsPPath;
	if (gbBsNS4 && !gbBsNS6)
	{
		strPath = escapeChar(gsPPath);
	}
	gbRtSized = true;
	rtWidth = Number(rtWidth);
	rtHeight = Number(rtHeight);

	// Get Window Height
	var nHeight = 0;

	if (gbBsNS6 || gbBsNS4 || gbSafari)
	{
		nHeight = window.innerHeight - 16;
	}
	else
	{
		nHeight = document.body.offsetHeight - 20;
	}

	// Set Y Position
	var scrollYOffset = 0;
	if (gbBsNS4 && !gbBsNS7)
	{
		scrollYOffset = window.pageYOffset;
	}
	else
	{
		scrollYOffset = document.body.scrollTop;
	}

	if (!gbBsNS4 || gbBsNS6)
	{
		if ((gRtYPos + rtHeight - scrollYOffset) > nHeight)
		{
			gRtYPos = scrollYOffset + nHeight - rtHeight;
		}
		else
		{
			gRtYPos += scrollYOffset;
			if (gRtYPos+rtHeight > scrollYOffset + nHeight)
			{
				gRtYPos = scrollYOffset + nHeight - rtHeight;
			}
		}
	}
	else
	{
		if (gRtYPos+rtHeight > scrollYOffset + nHeight)
		{
			gRtYPos = scrollYOffset + nHeight - rtHeight;
		}
	}

	// Get Window Width
	var nWidth = 0;

	if (gbBsNS6 || gbBsNS4 || gbSafari)
	{
		nWidth = window.innerWidth - 16;
	}
	else
	{
		nWidth = document.body.offsetWidth - 20;
	}

	// Set X Position
	var scrollXOffset = 0;
	if (gbBsNS4 && !gbBsNS7)
	{
		scrollYOffset = window.pageYOffset;
	}
	else
	{
		scrollXOffset = document.body.scrollLeft;
	}

	if (!gbBsNS4 || gbBsNS6)
	{
		if ((gRtXPos + rtWidth - scrollXOffset) > nWidth)
		{
			gRtXPos = scrollXOffset + nWidth - rtWidth;
		} 
		else 
		{
			gRtXPos += scrollXOffset;
			if (gRtXPos +rtWidth > scrollXOffset + nWidth)
			{
				gRtXPos = scrollXOffset + nWidth - rtWidth;
			}
		}
	}
	else
	{
		if (gRtXPos +rtWidth > scrollXOffset + nWidth)
		{
			gRtXPos = scrollXOffset + nWidth - rtWidth;
		}
	}


	if (gbBsNS4 && !gbBsNS6)
	{
		var rtLayer = document.layers["relatedTopicsLayer"];
		var strFlashVars = gsFlashVars + "&gnNoResize=1";
		gRtWidth = rtWidth;
		gRtHeight = rtHeight;
		// Rebuild flash object with correct width and height
		var sHtml = "";
		sHtml += "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'";
		sHtml += "id='rlctrlSWF' ALIGN='' WIDTH='"+rtWidth+"' HEIGHT='"+rtHeight+"' VIEWASTEXT>";
		sHtml += "<PARAM NAME='base' value='"+strPath+"'>";
		sHtml += "<PARAM NAME='movie' VALUE='"+strPath+gsSwfLoader+"'>";
		sHtml += "<PARAM NAME=quality VALUE=high>";
		sHtml += "<PARAM NAME=FlashVars VALUE='" + strFlashVars + "'>";
		sHtml += "<EMBED src='"+strPath+gsSwfLoader+"' quality=high BASE="+strPath+" NAME='rlctrlSWF' swLiveConnect='true' WIDTH='"+rtWidth+"' HEIGHT='"+rtHeight+"' ALIGN='' ";
		sHtml += "FlashVars='" + strFlashVars + "' ";
		sHtml += "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>";
		sHtml += "</EMBED>";
		sHtml += "</OBJECT>";

		rtLayer.moveTo( gRtXPos, gRtYPos);
		rtLayer.resizeTo(rtWidth,rtHeight);
		rtLayer.document.open();
		rtLayer.document.write(sHtml);
		rtLayer.document.close();
		gbRtLoaded = false;
		setTimeout("IsRtLoaded()",CHECK_RELATED_TIMEOUT);
	}
	else if ((gbBsNS6 && !gbNav7) || gbMozilla)
	{
		var strFlashVars = gsFlashVars + "&gnNoResize=1";
		gRtWidth = rtWidth;
		gRtHeight = rtHeight;
		// Rebuild flash object with correct width and height
		var sHtml = "";
		sHtml += "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'";
		sHtml += "id='rlctrlSWF' ALIGN='' WIDTH='"+rtWidth+"' HEIGHT='"+rtHeight+"' VIEWASTEXT>";
		sHtml += "<PARAM NAME='base' value='"+strPath+"'>";
		sHtml += "<PARAM NAME='movie' VALUE='"+strPath+gsSwfLoader+"'>";
		sHtml += "<PARAM NAME=quality VALUE=high>";
		sHtml += "<PARAM NAME=FlashVars VALUE='" + strFlashVars + "'>";
		sHtml += "<EMBED src='"+strPath+gsSwfLoader+"' quality=high BASE="+strPath+" NAME='rlctrlSWF' swLiveConnect='true' WIDTH='"+rtWidth+"' HEIGHT='"+rtHeight+"' ALIGN='' ";
		sHtml += "FlashVars='" + strFlashVars + "' ";
		sHtml += "TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'>";
		sHtml += "</EMBED>";
		sHtml += "</OBJECT>";

		var rtDiv = null;
		rtDiv = getElement("relatedTopicsDIV");
		// moveTo
		rtDiv.style.top   = gRtYPos;
		rtDiv.style.left  = gRtXPos;
		// resizeTo
		rtDiv.style.width = rtWidth;
		rtDiv.style.height= rtHeight;

		rtDiv.innerHTML = sHtml;
	}
	else 
	{
		if (gbMac && gbBsIE)
		{
			var rtTable = getElement("relatedTopicsTB");
			rtTable.style.height = rtHeight;
			rtTable.style.width = rtWidth;		
		}

		rtDiv = getElement("relatedTopicsDIV");
		rtDiv.style.top   = gRtYPos;
		rtDiv.style.left  = gRtXPos;
		rtDiv.style.width = rtWidth;
		rtDiv.style.height= rtHeight;

		if (!isInPopup())
		{
			if (window.rlctrlSWF)
			{
				if (window.rlctrlSWF.focus)
				{
					window.rlctrlSWF.focus();
				}
			}
		}
	}
}


function IsRtSized()
{
	if (!gbRtSized)
	{
		var rtLayer = document.layers["relatedTopicsLayer"];
		rtLayer.document.open();
		rtLayer.document.write(gsHtml);
		rtLayer.document.close();
		setTimeout("IsRtSized()",CHECK_RELATED_TIMEOUT);
	}
}

function closeRtCtrl()
{
	gbRtOpened = false;
	if (gbBsNS4 && !gbBsNS6)
	{
		if (!gbMac && !gbWindows)
		{
			document.location.reload();
			return;
		}
		var rtLayer = document.layers["relatedTopicsLayer"];
		rtLayer.visibility="hide";
		rtLayer.resizeTo(1,1);
		rtLayer.moveTo( -10, -10);
		rtLayer.document.open();
		rtLayer.document.write("<TABLE>&nbsp;</TABLE>");
		rtLayer.document.close();
	}
	else
	{
		rtDiv = getElement("relatedTopicsDIV");
		rtDiv.innerHTML = "<TABLE>&nbsp;</TABLE>\n";
		rtDiv.style.visibility = "hidden";
	}
}


function RtClicked(strTopicURL)
{
	closeRtCtrl();
	if (gRtTargetDoc != null) 
	{
		if (gsTargetFrame != "")
		{
			gRtTargetDoc.window.open(strTopicURL,gsTargetFrame,"");
		}
		else
		{
			gRtTargetDoc.location.href = strTopicURL;
		}
	}
	else if (gsTargetFrame != "")
	{
		window.open(strTopicURL,gsTargetFrame,"");
	}
	else
	{
		window.location.href = strTopicURL;
	}
}


function IsRtLoaded()
{
	var rtLayer = document.layers["relatedTopicsLayer"];
	if (!gbRtLoaded && rtLayer.visibility !="show")
	{
		sizeRtCtrl(gRtWidth, gRtHeight);
	}
}

function RtLoaded()
{
	gbRtLoaded = true;
	var rtLayer = document.layers["relatedTopicsLayer"];
	rtLayer.visibility = "show";
}

function RtParentClicked()
{
	if (!gbDivClicked)
	{
		document.onmousedown = gbRtOrigMouseDown;
		closeRtCtrl();
	}
	else
	{
		gbDivClicked = false;
	}

	return true;
}

var gPopWnd = null;
var gfn_arguments = null;

function RtWindowCtrl(fn_arguments)
{
	var strPath = gsPPath;
	if (gbBsNS4 && !gbBsNS6)
	{
		strPath = escapeChar(gsPPath);
	}
	gfn_arguments = fn_arguments;
	if (gbBsOpera6 && gbMac && gPopWnd == null)
	{
		var wndOldPopupLinks= window.open(strPath+"wf_blank.htm", "popuptemp");
		wndOldPopupLinks.close();
		setTimeout("RtWindowCtrl2();",100);
	}
	else
	{
		RtWindowCtrl2();
	}
}

function RtWindowCtrl2()
{
	var strPath = gsPPath;
	if (gbBsNS4 && !gbBsNS6)
	{
		strPath = escapeChar(gsPPath);
	}
	var fn_arguments = gfn_arguments;

	if (gPopWnd != null)
	{
		if (gPopWnd.close)
			gPopWnd.close();
		gPopWnd = null;
		setTimeout("RtWindowCtrl2()",100);
		return false;
	}

	var argLen 	= fn_arguments.length;
	var e = fn_arguments[0];

	// Create the window
	var nHeight = 200;
	var nWidth = 200;
	gRtXPos = e.clientX;
	gRtYPos = e.clientY+30;

	var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=no,scrollbars=auto";
	strParam += ",height=" + nHeight + ",width="+nWidth;
	strParam += ",left="+ gRtXPos + ",top="+gRtYPos;

	// Build the Flash Var List
	var strFlashVars = "";
	strFlashVars += "nItemCount="+argLen;
	strFlashVars += "&gsSkinSwf="+gsSkinIndexSwf;
	strFlashVars += "&gsFont="+gsSkinIndexFont;
	strFlashVars += "&gsFontHighlight="+gsSkinIndexHighlight;
	strFlashVars += "&nTopicHeight="+nHeight;

	for (var i = 2; i < argLen; i++)
	{
		strFlashVars += "&arrVal"+i+"="+fn_arguments[i];
	}
	gsFlashVars = strFlashVars;
	gbRtSized = false;

	// Create the popup window
	var wndPopupLinks=null;
	wndPopupLinks= window.open(strPath+"wf_related.htm", "popuplinks", strParam);
	gPopWnd = wndPopupLinks;
	return false;
}

var gsWndParams = "";
function ResizeRtWindow(nWidth, nHeight)
{
	var xPos = 100;
	var yPos = 100;
	gPopWnd.close();
	gbRtSized = true;
	var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=no,scrollbars=auto";
	strParam += ",height=" + nHeight + ",width="+nWidth;
	strParam += ",left="+ gRtXPos + ",top="+gRtYPos;
	gsWndParams = strParam;

	// Create the popup window
	setTimeout("OpenWindow()",100);


	return false;
}

function OpenWindow()
{
	var strPath = gsPPath;
	if (gbBsNS4 && !gbBsNS6)
	{
		strPath = escapeChar(gsPPath);
	}
	var wndPopupLinks=null;
	wndPopupLinks= window.open(strPath+"wf_related.htm", "popuplinks", gsWndParams);
	gPopWnd = wndPopupLinks;
}

⌨️ 快捷键说明

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