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

📄 fckeditorcode_ie_2.js

📁 一套能快速建立多语言
💻 JS
📖 第 1 页 / 共 2 页
字号:
FCK.RedirectNamedCommands=new Object();
FCK.ExecuteNamedCommand=function(A,B,C)
{
	if (!C&&FCK.RedirectNamedCommands[A]!=null) FCK.ExecuteRedirectedNamedCommand(A,B);
	else
	{
		FCK.Focus();
		FCK.EditorDocument.execCommand(A,false,B);
		FCK.Events.FireEvent('OnSelectionChange');
	};
};
FCK.GetNamedCommandState=function(A)
{
	try
	{
		if (!FCK.EditorDocument.queryCommandEnabled(A)) return FCK_TRISTATE_DISABLED;
		else return FCK.EditorDocument.queryCommandState(A)?FCK_TRISTATE_ON:FCK_TRISTATE_OFF;
	}
	catch (e)
	{
		return FCK_TRISTATE_OFF;
	};
};
FCK.SwitchEditMode=function()
{
	var A=(FCK.EditMode==FCK_EDITMODE_WYSIWYG);
	document.getElementById('eWysiwyg').style.display=A?'none':'';
	document.getElementById('eSource').style.display=A?'':'none';
	if (A)
	{
		document.getElementById('eSourceField').value=FCK.GetXHTML(FCKConfig.FormatSource);
	}
	else FCK.SetHTML(document.getElementById('eSourceField').value,true);
	FCK.EditMode=A?FCK_EDITMODE_SOURCE:FCK_EDITMODE_WYSIWYG;
	FCKToolbarSet.RefreshModeState();
	FCK.Focus();
};
FCK.CreateElement=function(A)
{
	var e=FCK.EditorDocument.createElement(A);
	return FCK.InsertElementAndGetIt(e);
};
FCK.InsertElementAndGetIt=function(e)
{
	e.setAttribute('__FCKTempLabel',1);
	this.InsertElement(e);
	var A=FCK.EditorDocument.getElementsByTagName(e.tagName);
	for (var i=0;i<A.length;i++)
	{
		if (A[i].getAttribute('__FCKTempLabel'))
		{
			A[i].removeAttribute('__FCKTempLabel');
			return A[i];
		};
	};
	return null;
};
FCK.InsertElement=function(A)
{
	FCK.InsertHtml(A.outerHTML);
};
FCK.AttachToOnSelectionChange=function(A)
{
	this.Events.AttachEvent('OnSelectionChange',A);
};
FCK.CreateLink=function(A)
{
	FCK.ExecuteNamedCommand('Unlink');
	if (A.length>0)
	{
		var B='javascript:void(0);/*'+(new Date().getTime())+'*/';
		FCK.ExecuteNamedCommand('CreateLink',B);
		var C=this.EditorDocument.links;
		for (i=0;i<C.length;i++)
		{
			if (C[i].href==B)
			{
				C[i].href=A;
				return C[i];
			};
		};
	};
};
var FCKSelection=new Object();
FCK.Selection=FCKSelection;
FCKSelection.GetType=function()
{
	return FCK.EditorDocument.selection.type;
};
FCKSelection.GetSelectedElement=function()
{
	if (this.GetType()=='Control')
	{
		var A=FCK.EditorDocument.selection.createRange();
		if (A&&A.item) return FCK.EditorDocument.selection.createRange().item(0);
	};
};
FCKSelection.GetParentElement=function()
{
	switch (this.GetType())
	{
		case 'Control':return FCKSelection.GetSelectedElement().parentElement;
		case 'None':return;
		default:return FCK.EditorDocument.selection.createRange().parentElement();
	};
};
FCKSelection.SelectNode=function(A)
{
	FCK.Focus();
	FCK.EditorDocument.selection.empty();
	var B=FCK.EditorDocument.selection.createRange();
	B.moveToElementText(A);
	B.select();
};
FCKSelection.Collapse=function(A)
{
	FCK.Focus();
	var B=FCK.EditorDocument.selection.createRange();
	B.collapse(A==null||A===true);
	B.select();
};
FCKSelection.HasAncestorNode=function(A)
{
	var B;
	if (FCK.EditorDocument.selection.type=="Control")
	{
		B=this.GetSelectedElement();
	}
	else
	{
		var C=FCK.EditorDocument.selection.createRange();
		B=C.parentElement();
	};
	while (B)
	{
		if (B.tagName==A) return true;
		B=B.parentNode;
	};
	return false;
};
FCKSelection.MoveToAncestorNode=function(A)
{
	var B;
	if (FCK.EditorDocument.selection.type=="Control")
	{
		var C=FCK.EditorDocument.selection.createRange();
		for (i=0;i<C.length;i++)
		{
			if (C(i).parentNode)
			{
				B=C(i).parentNode;
				break;
			};
		};
	}
	else
	{
		var C=FCK.EditorDocument.selection.createRange();
		B=C.parentElement();
	};
	while (B&&B.nodeName!=A) B=B.parentNode;
	return B;
};
FCKSelection.Delete=function()
{
	var A=FCK.EditorDocument.selection;
	if (A.type.toLowerCase()!="none")
	{
		A.clear();
	};
	return A;
};
var FCKPanel=function(A)
{
	this.IsRTL=false;
	this.IsContextMenu=false;
	this._IsOpened=false;
	this._Window=A?A:window;
	this._Popup=this._Window.createPopup();
	this.Document=this._Popup.document;
	this.PanelDiv=this.Document.body.appendChild(this.Document.createElement('DIV'));
	this.PanelDiv.className='FCK_Panel';
	this.EnableContextMenu(false);
	this.SetDirection(FCKLang.Dir);
};
FCKPanel.prototype.EnableContextMenu=function(A)
{
	this.Document.oncontextmenu=A?null:FCKTools.CancelEvent;
};
FCKPanel.prototype.AppendStyleSheet=function(A)
{
	FCKTools.AppendStyleSheet(this.Document,A);
};
FCKPanel.prototype.SetDirection=function(A)
{
	this.IsRTL=(A=='rtl');
	this.Document.dir=A;
};
FCKPanel.prototype.Load=function(x,y,A)
{
	this._Popup.show(x,y,0,0,A);
};
FCKPanel.prototype.Show=function(x,y,A,B,C)
{
	this.Load(x,y,A);
	this.PanelDiv.style.width=B?B+'px':'';
	this.PanelDiv.style.height=C?C+'px':'';
	if (this.IsRTL)
	{
		if (this.IsContextMenu) x=x-this.PanelDiv.offsetWidth+1;
		else if (A) x=x+(A.offsetWidth-this.PanelDiv.offsetWidth);
	};
	this._Popup.show(x,y,this.PanelDiv.offsetWidth,this.PanelDiv.offsetHeight,A);
	if (this._OnHide)
	{
		if (FCKPanel_ActivePopupInfo.Timer) CheckPopupOnHide();
		FCKPanel_ActivePopupInfo.Timer=window.setInterval(CheckPopupOnHide,200);
		FCKPanel_ActivePopupInfo.Panel=this;
	};
	this._IsOpened=true;
};
FCKPanel.prototype.Hide=function()
{
	this._Popup.hide();
};
FCKPanel.prototype.CheckIsOpened=function()
{
	return this._Popup.isOpen;
};
FCKPanel.prototype.AttachToOnHideEvent=function(A)
{
	this._OnHide=A;
};
var FCKPanel_ActivePopupInfo=new Object();
function CheckPopupOnHide()
{
	var oPanel=FCKPanel_ActivePopupInfo.Panel;
	if (oPanel&&!oPanel._Popup.isOpen)
	{
		window.clearInterval(FCKPanel_ActivePopupInfo.Timer);
		if (oPanel._OnHide) oPanel._OnHide(oPanel);
		FCKPanel_ActivePopupInfo.Timer=null;
		FCKPanel_ActivePopupInfo.Panel=null;
	};
}
var FCKNamedCommand=function(A)
{
	this.Name=A;
};
FCKNamedCommand.prototype.Execute=function()
{
	FCK.ExecuteNamedCommand(this.Name);
};
FCKNamedCommand.prototype.GetState=function()
{
	return FCK.GetNamedCommandState(this.Name);
};
var FCKDialogCommand=function(A,B,C,D,E,F,G)
{
	this.Name=A;
	this.Title=B;
	this.Url=C;
	this.Width=D;
	this.Height=E;
	this.GetStateFunction=F;
	this.GetStateParam=G;
};
FCKDialogCommand.prototype.Execute=function()
{
	FCKDialog.OpenDialog('FCKDialog_'+this.Name,this.Title,this.Url,this.Width,this.Height);
};
FCKDialogCommand.prototype.GetState=function()
{
	if (this.GetStateFunction) return this.GetStateFunction(this.GetStateParam);
	else return FCK_TRISTATE_OFF;
};
var FCKUndefinedCommand=function()
{
	this.Name='Undefined';
};
FCKUndefinedCommand.prototype.Execute=function()
{
	alert(FCKLang.NotImplemented);
};
FCKUndefinedCommand.prototype.GetState=function()
{
	return FCK_TRISTATE_OFF;
};
var FCKSourceCommand=function()
{
	this.Name='Source';
};
FCKSourceCommand.prototype.Execute=function()
{
	if (FCKBrowserInfo.IsGecko)
	{
		var A=FCKConfig.ScreenWidth*0.65;
		var B=FCKConfig.ScreenHeight*0.65;
		FCKDialog.OpenDialog('FCKDialog_Source',FCKLang.Source,'dialog/fck_source.html',A,B,null,null,true);
	}
	else FCK.SwitchEditMode();
};
FCKSourceCommand.prototype.GetState=function()
{
	return (FCK.EditMode==FCK_EDITMODE_WYSIWYG?FCK_TRISTATE_OFF:FCK_TRISTATE_ON);
};
var FCKTextColorCommand=function(A)
{
	this.Name=A=='TextColor';
	this.Type=A;
	this._Panel=new FCKPanel();
	this._Panel.AppendStyleSheet(FCKConfig.SkinPath+'fck_contextmenu.css');
	this._CreatePanelBody(this._Panel.Document,this._Panel.PanelDiv);
	FCKTools.DisableSelection(this._Panel.Document.body);
};
FCKTextColorCommand.prototype.Execute=function(A,B,C)
{
	FCK._ActiveColorPanelType=this.Type;
	this._Panel.Show(A,B,C);
};
FCKTextColorCommand.prototype.SetColor=function(A)
{
	if (FCK._ActiveColorPanelType=='ForeColor') FCK.ExecuteNamedCommand('ForeColor',A);
	else if (FCKBrowserInfo.IsGecko) FCK.ExecuteNamedCommand('hilitecolor',A);
	delete FCK._ActiveColorPanelType;
};
FCKTextColorCommand.prototype.GetState=function()
{
	return FCK_TRISTATE_OFF;
};
function FCKTextColorCommand_OnMouseOver()
{
	this.className='ColorSelected';
};
function FCKTextColorCommand_OnMouseOut()
{
	this.className='ColorDeselected';
};
function FCKTextColorCommand_OnClick()
{
	this.className='ColorDeselected';
	this.Command.SetColor('#'+this.Color);
	this.Command._Panel.Hide();
};
function FCKTextColorCommand_AutoOnClick()
{

⌨️ 快捷键说明

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