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

📄 fckeditorcode_ie_1.js

📁 一套能快速建立多语言
💻 JS
📖 第 1 页 / 共 2 页
字号:
FCKXHtml.TagProcessors['link']=function(A,B)
{
	if (B.getAttribute('_fcktemp')) return null;
	return A;
};
FCKXHtml.TagProcessors['table']=function(A,B)
{
	var C=A.attributes.getNamedItem('class');
	if (C&&FCKRegexLib.TableBorderClass.test(C.nodeValue))
	{
		var D=C.nodeValue.replace(FCKRegexLib.TableBorderClass,'');
		if (D.length==0) A.attributes.removeNamedItem('class');
		else FCKXHtml._AppendAttribute(A,'class',D);
	};
	FCKXHtml._AppendChildNodes(A,B,false);
	return A;
}
FCKXHtml._GetMainXmlString=function()
{
	return this.MainNode.xml;
};
FCKXHtml._AppendEntity=function(A,B)
{
	A.appendChild(this.XML.createEntityReference(B));
};
FCKXHtml._AppendAttributes=function(A,B,C,D)
{
	var E=B.attributes;
	for (var n=0;n<E.length;n++)
	{
		var F=E[n];
		if (F.specified)
		{
			var G=F.nodeName.toLowerCase();
			var H;
			if (G.startsWith('_fck')) continue;
			else if (G=='style') H=B.style.cssText;
			else if (G=='class'||G.indexOf('on')==0) H=F.nodeValue;
			else if (D=='body'&&G=='contenteditable') continue;
			else if (F.nodeValue===true) H=G;
			else if (!(H=B.getAttribute(G,2))) H=F.nodeValue;
			if (FCKConfig.ForceSimpleAmpersand&&H.replace) H=H.replace(/&/g,'___FCKAmp___');
			this._AppendAttribute(C,G,H);
		};
	};
};
FCKXHtml.TagProcessors['meta']=function(A,B)
{
	var C=A.attributes.getNamedItem('http-equiv');
	if (C==null||C.value.length==0)
	{
		var D=B.outerHTML.match(FCKRegexLib.MetaHttpEquiv);
		if (D)
		{
			D=D[1];
			FCKXHtml._AppendAttribute(A,'http-equiv',D);
		};
	};
	return A;
};
FCKXHtml.TagProcessors['font']=function(A,B)
{
	if (A.attributes.length==0) A=FCKXHtml.XML.createDocumentFragment();
	FCKXHtml._AppendChildNodes(A,B);
	return A;
};
FCKXHtml.TagProcessors['input']=function(A,B)
{
	if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);
	if (B.value&&!A.attributes.getNamedItem('value')) FCKXHtml._AppendAttribute(A,'value',B.value);
	return A;
};
FCKXHtml.TagProcessors['option']=function(A,B)
{
	if (B.selected&&!A.attributes.getNamedItem('selected')) FCKXHtml._AppendAttribute(A,'selected','selected');
	FCKXHtml._AppendChildNodes(A,B);
	return A;
};
FCKXHtml.TagProcessors['area']=function(A,B)
{
	if (!A.attributes.getNamedItem('coords'))
	{
		var C=B.getAttribute('coords',2);
		if (C&&C!='0,0,0') FCKXHtml._AppendAttribute(A,'coords',C);
	};
	if (!A.attributes.getNamedItem('shape'))
	{
		var C=B.getAttribute('shape',2);
		if (C&&C.length>0) FCKXHtml._AppendAttribute(A,'shape',C);
	};
	return A;
};
FCKXHtml.TagProcessors['label']=function(A,B)
{
	if (B.htmlFor.length>0) FCKXHtml._AppendAttribute(A,'for',B.htmlFor);
	FCKXHtml._AppendChildNodes(A,B);
	return A;
};
FCKXHtml.TagProcessors['form']=function(A,B)
{
	if (B.acceptCharset&&B.acceptCharset.length>0&&B.acceptCharset!='UNKNOWN') FCKXHtml._AppendAttribute(A,'accept-charset',B.acceptCharset);
	if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);
	FCKXHtml._AppendChildNodes(A,B);
	return A;
};
FCKXHtml.TagProcessors['textarea']=FCKXHtml.TagProcessors['select']=function(A,B)
{
	if (B.name) FCKXHtml._AppendAttribute(A,'name',B.name);
	FCKXHtml._AppendChildNodes(A,B);
	return A;
};
FCKXHtml.TagProcessors['div']=function(A,B)
{
	if (B.align.length>0) FCKXHtml._AppendAttribute(A,'align',B.align);
	FCKXHtml._AppendChildNodes(A,B);
	return A;
}
var FCKCodeFormatter;
if (!(FCKCodeFormatter=NS.FCKCodeFormatter))
{
	FCKCodeFormatter=NS.FCKCodeFormatter=new Object();
	FCKCodeFormatter.Regex=new Object();
	FCKCodeFormatter.Regex.BlocksOpener=/\<(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi;
	FCKCodeFormatter.Regex.BlocksCloser=/\<\/(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi;
	FCKCodeFormatter.Regex.NewLineTags=/\<(BR|HR)[^\>]\>/gi;
	FCKCodeFormatter.Regex.MainTags=/\<\/?(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR)[^\>]*\>/gi;
	FCKCodeFormatter.Regex.LineSplitter=/\s*\n+\s*/g;
	FCKCodeFormatter.Regex.IncreaseIndent=/^\<(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \/\>]/i;
	FCKCodeFormatter.Regex.DecreaseIndent=/^\<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \>]/i;
	FCKCodeFormatter.Regex.FormatIndentatorRemove=new RegExp(FCKConfig.FormatIndentator);
	FCKCodeFormatter.Regex.ProtectedTags=/(<PRE[^>]*>)([\s\S]*?)(<\/PRE>)/gi;
	FCKCodeFormatter._ProtectData=function(A,B,C,D)
	{
		return B+'___FCKpd___'+FCKCodeFormatter.ProtectedData.addItem(C)+D;
	};
	FCKCodeFormatter.Format=function(A)
	{
		FCKCodeFormatter.ProtectedData=new Array();
		var B=A.replace(this.Regex.ProtectedTags,FCKCodeFormatter._ProtectData);
		B=B.replace(this.Regex.BlocksOpener,'\n$&');;
		B=B.replace(this.Regex.BlocksCloser,'$&\n');
		B=B.replace(this.Regex.NewLineTags,'$&\n');
		B=B.replace(this.Regex.MainTags,'\n$&\n');
		var C='';
		var D=B.split(this.Regex.LineSplitter);
		B='';
		for (var i=0;i<D.length;i++)
		{
			var E=D[i];
			if (E.length==0) continue;
			if (this.Regex.DecreaseIndent.test(E)) C=C.replace(this.Regex.FormatIndentatorRemove,'');
			B+=C+E+'\n';
			if (this.Regex.IncreaseIndent.test(E)) C+=FCKConfig.FormatIndentator;
		};
		for (var i=0;i<FCKCodeFormatter.ProtectedData.length;i++)
		{
			var F=new RegExp('___FCKpd___'+i);
			B=B.replace(F,FCKCodeFormatter.ProtectedData[i]);
		};
		return B.trim();
	};
}
var FCK_StartupValue;
FCK.Events=new FCKEvents(FCK);
FCK.Toolbar=null;
FCK.TempBaseTag=FCKConfig.BaseHref.length>0?'<base href="'+FCKConfig.BaseHref+'" _fcktemp="true"></base>':'';
FCK.StartEditor=function()
{
	this.EditorWindow=window.frames['eEditorArea'];
	this.EditorDocument=this.EditorWindow.document;
	this.SetHTML(FCKTools.GetLinkedFieldValue());
	this.ResetIsDirty();
	FCKTools.AttachToLinkedFieldFormSubmit(this.UpdateLinkedField);
	this.SetStatus(FCK_STATUS_ACTIVE);
};
function Window_OnFocus()
{
	FCK.Focus();
	FCK.Events.FireEvent("OnFocus");
};
function Window_OnBlur()
{
	if (!FCKDialog.IsOpened) return FCK.Events.FireEvent("OnBlur");
};
FCK.SetStatus=function(A)
{
	this.Status=A;
	if (A==FCK_STATUS_ACTIVE)
	{
		window.frameElement.onfocus=window.document.body.onfocus=Window_OnFocus;
		window.frameElement.onblur=Window_OnBlur;
		if (FCKConfig.StartupFocus) FCK.Focus();
		if (FCKBrowserInfo.IsIE) FCKScriptLoader.AddScript('js/fckeditorcode_ie_2.js');
		else FCKScriptLoader.AddScript('js/fckeditorcode_gecko_2.js');
	};
	this.Events.FireEvent('OnStatusChange',A);
};
FCK.GetHTML=function(A)
{
	FCK.GetXHTML(A);
};
FCK.GetXHTML=function(A)
{
	var B=(FCK.EditMode==FCK_EDITMODE_SOURCE);
	if (B) this.SwitchEditMode();
	var C;
	if (FCKConfig.FullPage) C=FCKXHtml.GetXHTML(this.EditorDocument.getElementsByTagName('html')[0],true,A);
	else
	{
		if (FCKConfig.IgnoreEmptyParagraphValue&&this.EditorDocument.body.innerHTML=='<P>&nbsp;</P>') C='';
		else C=FCKXHtml.GetXHTML(this.EditorDocument.body,false,A);
	};
	if (B) this.SwitchEditMode();
	if (FCKBrowserInfo.IsIE) C=C.replace(FCKRegexLib.ToReplace,'$1');
	if (FCK.DocTypeDeclaration&&FCK.DocTypeDeclaration.length>0) C=FCK.DocTypeDeclaration+'\n'+C;
	if (FCK.XmlDeclaration&&FCK.XmlDeclaration.length>0) C=FCK.XmlDeclaration+'\n'+C;
	return FCKConfig.ProtectedSource.Revert(C);
};
FCK.UpdateLinkedField=function()
{
	FCK.LinkedField.value=FCK.GetXHTML(FCKConfig.FormatOutput);
	FCK.Events.FireEvent('OnAfterLinkedFieldUpdate');
};
FCK.RegisteredDoubleClickHandlers=new Object();
FCK.OnDoubleClick=function(A)
{
	var B=FCK.RegisteredDoubleClickHandlers[A.tagName];
	if (B) B(A);
};
FCK.OnAfterSetHTML=function()
{
	var A,i=0;
	while((A=FCKDocumentProcessors[i++])) A.ProcessDocument(FCK.EditorDocument);
	this.Events.FireEvent('OnAfterSetHTML');
};
FCK.ProtectUrls=function(A)
{
	A=A.replace(FCKRegexLib.ProtectUrlsAApo,'$1$2$3$2 _fcksavedurl=$2$3$2');
	A=A.replace(FCKRegexLib.ProtectUrlsANoApo,'$1$2 _fcksavedurl="$2"');
	A=A.replace(FCKRegexLib.ProtectUrlsImgApo,'$1$2$3$2 _fcksavedurl=$2$3$2');
	A=A.replace(FCKRegexLib.ProtectUrlsImgNoApo,'$1$2 _fcksavedurl="$2"');
	return A;
};
FCK.IsDirty=function()
{
	return (FCK_StartupValue!=FCK.EditorDocument.body.innerHTML);
};
FCK.ResetIsDirty=function()
{
	if (FCK.EditorDocument.body) FCK_StartupValue=FCK.EditorDocument.body.innerHTML;
};
var FCKDocumentProcessors=new Array();
var FCKDocumentProcessors_CreateFakeImage=function(A,B)
{
	var C=FCK.EditorDocument.createElement('IMG');
	C.className=A;
	C.src=FCKConfig.FullBasePath+'images/spacer.gif';
	C.setAttribute('_fckfakelement','true',0);
	C.setAttribute('_fckrealelement',FCKTempBin.AddElement(B),0);
	return C;
};
var FCKMediaProcessor=new Object();
FCKMediaProcessor.ProcessDocument=function(A)
{
	var B=A.getElementsByTagName('EMBED');
	var C;
	var i=B.length-1;
	while (i>=0&&(C=B[i--]))
	{
		if (C.src.endsWith('.swf',true))
		{
			var D=C.cloneNode(true);
			if (FCKBrowserInfo.IsIE)
			{
				D.setAttribute('play',C.getAttribute('play'));
				D.setAttribute('loop',C.getAttribute('loop'));
			};
			var E=FCKDocumentProcessors_CreateFakeImage('FCK__Media',D);
			E.setAttribute('_fckmeida','true',0);
			FCKMediaProcessor.RefreshView(E,C);
			C.parentNode.insertBefore(E,C);
			C.parentNode.removeChild(C);
		};
	};
};
FCKMediaProcessor.RefreshView=function(A,B)
{
	if (B.width>0) A.style.width=FCKTools.ConvertHtmlSizeToStyle(B.width);
	if (B.height>0) A.style.height=FCKTools.ConvertHtmlSizeToStyle(B.height);
};
FCKDocumentProcessors.addItem(FCKMediaProcessor);
FCK.GetRealElement=function(A)
{
	var e=FCKTempBin.Elements[A.getAttribute('_fckrealelement')];
	if (A.getAttribute('_fckmedia'))
	{
		if (A.style.width.length>0) e.width=FCKTools.ConvertStyleSizeToHtml(A.style.width);
		if (A.style.height.length>0) e.height=FCKTools.ConvertStyleSizeToHtml(A.style.height);
	};
	return e;
};
FCK.Description="FCKeditor for Internet Explorer 5.5+";
FCK._BehaviorsStyle='<style type="text/css" _fcktemp="true">\ INPUT { behavior:url(' + FCKConfig.FullBasePath + 'css/behaviors/hiddenfield.htc);} ';
if (FCKConfig.ShowBorders) FCK._BehaviorsStyle+='TABLE { behavior: url('+FCKConfig.FullBasePath+'css/behaviors/showtableborders.htc) ; }';
var sNoHandlers='INPUT, TEXTAREA, SELECT';
if (FCKConfig.DisableImageHandles) sNoHandlers+=', IMG';
FCK._BehaviorsStyle+=sNoHandlers+' { behavior: url('+FCKConfig.FullBasePath+'css/behaviors/disablehandles.htc) ; }';
FCK._BehaviorsStyle+='</style>';
function Doc_OnMouseUp()
{
	if (FCK.EditorWindow.event.srcElement.tagName=='HTML')
	{
		FCK.Focus();
		FCK.EditorWindow.event.cancelBubble=true;
		FCK.EditorWindow.event.returnValue=false;
	};
};
function Doc_OnDblClick()
{
	FCK.OnDoubleClick(FCK.EditorWindow.event.srcElement);
	FCK.EditorWindow.event.cancelBubble=true;
};
function Doc_OnSelectionChange()
{
	FCK.Events.FireEvent("OnSelectionChange");
};
FCK.InitializeBehaviors=function(A)
{
	this.EditorDocument.attachEvent('onmouseup',Doc_OnMouseUp);
	if (FCKConfig.TabSpaces>0)
	{
		window.FCKTabHTML='';
		for (i=0;i<FCKConfig.TabSpaces;i++) window.FCKTabHTML+="&nbsp;";
	};
	this.EditorDocument.attachEvent("ondblclick",Doc_OnDblClick);
	this.EditorDocument.attachEvent("onselectionchange",Doc_OnSelectionChange);
};
FCK.Focus=function()
{
	try
	{
		if (FCK.EditMode==FCK_EDITMODE_WYSIWYG) FCK.EditorDocument.body.focus();
		else document.getElementById('eSourceField').focus();
	}
	catch(e)
	{
	};
};
FCK.SetHTML=function(A,B)
{
	if (B||FCK.EditMode==FCK_EDITMODE_WYSIWYG)
	{
		A=FCKConfig.ProtectedSource.Protect(A);
		A=FCK.ProtectUrls(A);
		var C;
		if (FCKConfig.FullPage)
		{
			var C=FCK._BehaviorsStyle+'<link href="'+FCKConfig.FullBasePath+'css/fck_internal.css'+'" rel="stylesheet" type="text/css" _fcktemp="true" />';
			if (FCK.TempBaseTag.length>0&&!FCKRegexLib.HasBaseTag.test(A)) C+=FCK.TempBaseTag;
			C=A.replace(FCKRegexLib.HeadOpener,'$&'+C);
		}
		else
		{
			C=FCKConfig.DocType+'<html dir="'+FCKConfig.ContentLangDirection+'"';
			if (FCKConfig.IEForceVScroll) C+=' style="overflow-y: scroll"';
			C+='><head><title></title>'+'<link href="'+FCKConfig.EditorAreaCSS+'" rel="stylesheet" type="text/css" />'+'<link href="'+FCKConfig.FullBasePath+'css/fck_internal.css'+'" rel="stylesheet" type="text/css" _fcktemp="true" />';
			C+=FCK._BehaviorsStyle;
			C+=FCK.TempBaseTag;
			C+='</head><body>'+A+'</body></html>';
		};
		this.EditorDocument.open('','replace');
		this.EditorDocument.write(C);
		this.EditorDocument.close();
		this.InitializeBehaviors();
		this.EditorDocument.body.contentEditable=true;
		FCK.OnAfterSetHTML();
	}
	else document.getElementById('eSourceField').value=A;
};
FCK.InsertHtml=function(A)
{
	A=FCKConfig.ProtectedSource.Protect(A);
	A=FCK.ProtectUrls(A);
	FCK.Focus();
	var B=FCK.EditorDocument.selection;
	if (B.type.toLowerCase()!="none") B.clear();
	B.createRange().pasteHTML(A);
};
FCK.SetInnerHtml=function(A)
{
	var B=FCK.EditorDocument;
	B.body.innerHTML='<div id="__fakeFCKRemove__">&nbsp;</div>'+A;
	B.getElementById('__fakeFCKRemove__').removeNode(true);
}

⌨️ 快捷键说明

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