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

📄 webhtmleditorwindows.js.txt.exclude

📁 小孔子全站管理系统网站内容管理。相当于一个文章发布系统一个样
💻 EXCLUDE
📖 第 1 页 / 共 3 页
字号:
				var arrRules = null;				
				if (this.IsIE)arrRules = document.styleSheets[i].rules;
				else arrRules = document.styleSheets[i].cssRules;					
				for (var j = 0; j < arrRules.length; j++)
				{
					try
					{	
						var rule = arrRules[j];
						if (rule.selectorText == className || rule.selectorText == "." + className)
						{
							return rule;
						}
					}
					catch (ex)
					{
					}
				}
			}
			catch (ex)
			{
			}
		}
	}
	catch(ex)
	{
	}	
	return null;
}

WebHtmlEditorWindow.prototype.GetWidth = function()
{	
	var width = 0;
	if (!this.UseWebHtmlEditorWindow)
	{
		if (this.Window)width = this.Window.dialogWidth;
	}
	else
	{
		if (this.IsIE)
		{	
			width = parseInt(this.ContentWrapperTable.clientWidth);									
		}
		else
		{
			width = parseInt(this.ContentWrapperTable.scrollWidth);			
		}
		
		if (isNaN(width))
		{
			width = 0;
		}
		
		if (width > 0)
		{
			if (this.IsIE)width += 2 * this.borderWidth;
			else width -= 2 * this.borderWidth;
		}
	}
	return width;
}

WebHtmlEditorWindow.prototype.SetWidth = function(width)
{
	width = parseInt(width);
	if (isNaN(width))return;		
	
	if (!this.UseWebHtmlEditorWindow)
	{		
		if (this.Window)
		{		
			if (this.Window.dialogWidth)
			{				
				this.Window.dialogTop = this.Window.screenTop - 30;
				this.Window.dialogLeft = this.Window.screenLeft - 4;								
				this.Window.dialogWidth = width + "px";
			}
			else
			{
				this.Window.outerWidth = width;
			}
		}
	}
	else
	{
		if (this.IsIE)
		{
			this.ContentWrapperTable.style.width = width + "px";
		}
		else
		{			
			this.ContentWrapperTable.style.width = (width + 2 * this.borderWidth) + "px";
			this.ContentTD.style.width = (width - 2 * this.borderWidth) + "px";			
			this.ContentWindow.style.width = this.ContentTD.style.width;
			this.ContentWindow.style.overflow = "hidden";
		}
	}
}

WebHtmlEditorWindow.prototype.GetHeight = function()
{
	var height = 0;
	if (!this.UseWebHtmlEditorWindow)
	{
		if (this.Window)height = this.Window.dialogHeight;
	}
	else
	{
		if (this.IsIE)
		{
			height = parseInt(this.ContentWrapperTable.clientHeight);
			if (isNaN(height))height = 0;		
			if (height > 0)height += 2 * this.borderWidth;
		}
		else
		{
			height = this.ContentWrapperTable.scrollHeight;	
		}		
	}		
	return height;
}

WebHtmlEditorWindow.prototype.SetHeight = function(height)
{
	height = parseInt(height);
	if (isNaN(height))return;
	
	if (!this.UseWebHtmlEditorWindow)
	{
		if (this.Window)
		{
			if (this.Window.dialogWidth)
			{
				this.Window.dialogTop = this.Window.screenTop - 30;
				this.Window.dialogLeft = this.Window.screenLeft - 4;				
				this.Window.dialogHeight = height + "px";
			}
			else
			{
				this.Window.outerHeight = height;
			}
		}
	}
	else
	{
		if (this.IsIE)
		{		
			this.ContentWrapperTable.style["height"] = height + "px";
			var iframes = this.ContentWrapperTable.getElementsByTagName("IFRAME");			
			if (iframes && iframes.length > 0)
			{
				var dlgHeight = (height - 50);
				if (dlgHeight > 0)iframes.item(0).style["height"] = dlgHeight + "px";
			}
		}
		else
		{
			var totalHeight = this.borderWidth * 2;			
			for (var i = 0; i < this.ContentWrapperTable.rows.length; i++)
			{
				if (this.ContentTD.parentNode.rowIndex == i)continue;				
				var rowHeight = parseInt(this.ContentWrapperTable.rows[i].scrollHeight);			
				if (!isNaN(rowHeight))totalHeight += parseInt(rowHeight);

			}
						
			this.ContentTD["height"] = (height - totalHeight) + "px";			
			this.ContentWindow.style["height"] = (height - totalHeight) + "px";
			this.ContentWindow.style.overflow = "hidden";			
			this.ContentWrapperTable.style["height"] = height + "px";			
		}
	}
}

WebHtmlEditorWindow.prototype.SetSize = function(width, height)
{
	this.SetWidth(width);
	this.SetHeight(height);
	
	if (width > 0)this.Width = width;
		
	if (height > 0)this.Height = height;
}

WebHtmlEditorWindow.prototype.SetCaption = function(caption)
{
	if (this.Caption)this.Caption.innerHTML = caption;
}

WebHtmlEditorWindow.prototype.GetCaption = function()
{
	if (this.Caption)return this.Caption.innerHTML;	
	else return "";
}

var State_ActiveWindow = null; 
var State_ActiveWindowSpan = null;
var MousePosX = 0;
var MousePosY = 0;

function WebHtmlEditorWindowDragStart()
{   
	if (!State_ActiveWindow.CanDrag())return;
		
	if (document.all && document.body.attachEvent) 
	{	
		document.body.setCapture();
		document.body.attachEvent ("onmousemove", WebHtmlEditorWindowDrag);
		document.body.attachEvent ("onmouseup", WebHtmlEditorWindowDragEnd);
	} 
	else if (document.addEventListener)
	{
		document.addEventListener("mousemove", WebHtmlEditorWindowDrag, false);
		document.addEventListener("mouseup", WebHtmlEditorWindowDragEnd, false);			
	}	
	WebHtmlEditorWindowInitializeDrag(State_ActiveWindow);
}


function WebHtmlEditorWindowDragEnd()
{	
	if (document.all && document.body.detachEvent)
	{
		document.body.detachEvent ("onmousemove", WebHtmlEditorWindowDrag);
		document.body.detachEvent ("onmouseup", WebHtmlEditorWindowDragEnd);		
		document.body.releaseCapture();
	}
	else if (document.removeEventListener)
	{  
		document.removeEventListener("mousemove", WebHtmlEditorWindowDrag, false);
		document.removeEventListener("mouseup", WebHtmlEditorWindowDragEnd, false);		
	}
	if (State_ActiveWindow.IsModal)State_ActiveWindow.SetCapture();
	
	WebHtmlEditorWindowUnInitializeDrag(State_ActiveWindow);	
	State_ActiveWindow.SetContentVisible(true);
}

function WebHtmlEditorWindowDrag(e)
{	
	if (State_ActiveWindow.CanDrag())
	{
		switch (State_ActiveWindow.DragMode)
		{
			case "move":
				WebHtmlEditorWindowMove(e);							
				break;		
			case "size":
				WebHtmlEditorWindowSize(e);
				break;		
		}
	}
	e.cancelBubble = true;	
	MousePosX = e.clientX;
	MousePosY = e.clientY;	
	return false;
}

function WebHtmlEditorWindowInitializeDrag(targetWindow)
{
	if (!targetWindow)return;

	if (!State_ActiveWindowSpan)
	{
		State_ActiveWindowSpan = document.createElement("SPAN");
		State_ActiveWindowSpan.className = "WHETableWrapperResizeSpan";				
		State_ActiveWindowSpan.style.position = "absolute";	
		State_ActiveWindowSpan.style.zIndex = 50000;	
		State_ActiveWindowSpan.innerHTML = "&nbsp;&nbsp;";	
		document.body.appendChild(State_ActiveWindowSpan);
	}
	
	State_ActiveWindowSpan.style.visibility = "visible";	
	State_ActiveWindowSpan.style.top = targetWindow.ContentWrapperTable.style.top;
	State_ActiveWindowSpan.style.left = targetWindow.ContentWrapperTable.style.left;
	State_ActiveWindowSpan.style.width = targetWindow.GetWidth();
	State_ActiveWindowSpan.style["height"] = targetWindow.GetHeight();
	
	switch (targetWindow.DragMode)
	{
		case "move":
			State_ActiveWindowSpan.style.cursor = "default";
			break;	
		case "size":
			State_ActiveWindowSpan.style.cursor = "se-resize";
			break;		
	}
}

function WebHtmlEditorWindowUnInitializeDrag(targetWindow)
{
	if (State_ActiveWindowSpan)	State_ActiveWindowSpan.style.visibility = "hidden";
	targetWindow.SetPosition(State_ActiveWindowSpan.style.left, State_ActiveWindowSpan.style.top);
	targetWindow.SetSize(State_ActiveWindowSpan.style.width, State_ActiveWindowSpan.style["height"]);
}

function WebHtmlEditorWindowMove(e)
{	
	var WebHtmlEditorWindowX = State_ActiveWindow.X;
	var WebHtmlEditorWindowY = State_ActiveWindow.Y;
	var el = State_ActiveWindowSpan;
	var left = 0;
	var top = 0;
	if (document.all)
	{   
		left = e.clientX * 1 + GetScrollLeft(document) - WebHtmlEditorWindowX;
		top = e.clientY * 1 + GetScrollTop(document) - WebHtmlEditorWindowY;
	}
	else
	{       
		left = e.pageX * 1 - WebHtmlEditorWindowX;
		top = e.pageY * 1 - WebHtmlEditorWindowY;
	}
	
	if (left < 0)left = 0;		
	if (top < 0)top = 0;
	
	el.style.left = left + "px";
	el.style.top = top + "px";	
}

var minWidth = 0xc8;
var minHeight = 0xc8;

function WebHtmlEditorWindowSize(e)
{	
	var offsetX = e.clientX - MousePosX;
	var offsetY = e.clientY - MousePosY;	
	var width = parseInt(State_ActiveWindowSpan.style.width);
	var height = parseInt(State_ActiveWindowSpan.style["height"]);	
	width += offsetX;
	height += offsetY;	
	if (width < minWidth){width = minWidth;}
	if (height < minHeight){height = minHeight;}
	State_ActiveWindowSpan.style.width = width + "px";
	State_ActiveWindowSpan.style["height"] = height + "px";
}	



function GetWebHtmlEditorWindowManager()
{		
	var topWindow = GetParentWindow();	 
	if (!topWindow.radWindowManager)topWindow.radWindowManager = new WebHtmlEditorWindowManager();
	return topWindow.radWindowManager;
}

function GetParentWindow()
{
	var topWindow = null;

	var argumentsContainParentWindow = false;
	try
	{
		if (window.dialogArguments.parentWindow && argumentsContainParentWindow)argumentsContainParentWindow = true;
	}
	catch(ex)
	{
		argumentsContainParentWindow = false;
	}
	if (window.dialogArguments != null && argumentsContainParentWindow) 
	{
		topWindow = window.dialogArguments.parentWindow;	
	}
	else if (window.opener && !document.all && window.isWebHtmlEditorWindow)
	{	// NS
		topWindow = opener;
	}	
	else
	{
		topWindow = window;	
	}
	var stopLoop = false;
	while (topWindow.parent && !stopLoop)
	{
		try
		{	
			topWindowTagName = topWindow.parent.tagName.toUpperCase()
		}
		catch (exception)
		{
			topWindowTagName = "";
		}			
		if (topWindow.parent == topWindow)break;
		try
		{
			if (topWindow.parent.document.domain != window.document.domain)break;
		}
		catch(exc)
		{
			stopLoop = true;
			continue;
		}

		try
		{
			if (topWindow.frameElement != null && (topWindow.frameElement.tagName != "IFRAME" || topWindow.frameElement.name != "wheWindowContent"))break;
		}
		catch(exc)
		{
			alert('in the Exception!');
			stopLoop = true;
		}
		topWindow = topWindow.parent;		
	}		
	return topWindow;
}
function Document_OnFocus(e)
{
	if (!e){e = window.event;}	
	GetWebHtmlEditorWindowManager().ActivateWindow();
}

function Document_OnKeyDown(e)
{
	if (!e){e = window.event;}	
	return GetWebHtmlEditorWindowManager().OnKeyDown(e);
}
function WebHtmlEditorWindowInfo_Model()
{
	this.IsIE = (null != document.all);
	this.ID = null;
	this.Url = "";
	this.InnerHtml = "";
	this.InnerObject = null;
	this.Width = 300;
	this.Height = 200;
	this.Caption = "";
	this.IsVisible = true;
	this.Argument = null;
	this.CallbackFunc = null;
	this.OnLoadFunc = null;
	this.Param = null; 
	this.Resizable = true;
	this.Movable = true;
	this.CloseHide = false; 
	this.UseClassicDialogs = true;
	this.BlankIFrameLocation = "";
}

 
function WebHtmlEditorWindowManager()
{
	this.ChildWindows = new Array();
	this.ActiveWindow = null;
	this.TopWindowZIndex = 10001;
	
	this.ContainerPool = new Array();
	this.IsIE = (null != document.all) && (window.opera == null);
	
	document.body.onfocus = Document_OnFocus;
	
	if (this.IsIE && document.body.attachEvent)
	{
		document.body.attachEvent("onkeydown", Document_OnKeyDown);
	}
	else if (document.body.addEventListener)

⌨️ 快捷键说明

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