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

📄 ace.js

📁 不错的ASP整站源代码。在IIS环境下运行都没有问题
💻 JS
📖 第 1 页 / 共 5 页
字号:
		boxPage.document.all["inpTitle"].innerText = this.getTitle();

	if(this.PageStyle!="")
		{
		//Apply external css to the document, if there is no existing..
		sHREF = this.getEditorPreviewPath(this.PageStylePath_RelativeTo_EditorPath + this.PageStyle);
		var bPageStyleExist = false;
		for(var i=0;i<oEditor.document.styleSheets.length;i++)
			{
			if(oEditor.document.styleSheets(i).href==sHREF)
				bPageStyleExist = true;
			}
		if(bPageStyleExist==false)
			{
			oElement = oEditor.document.createElement("<link rel='stylesheet' href='" + this.getEditorPreviewPath(this.PageStylePath_RelativeTo_EditorPath + this.PageStyle) + "' type='text/css'>");
			var oEl = oEditor.document.childNodes[0].childNodes[0].appendChild(oElement);
			}
		}

	if(this.useStyle)
		{
		// Apply external css for Style Selection, if there is no existing..
		sHREF = this.getEditorPreviewPath(this.StyleSelectionPath_RelativeTo_EditorPath + this.StyleSelection);
		var bStyleSelExist = false;
		for(var i=0;i<oEditor.document.styleSheets.length;i++)
			{
			if(oEditor.document.styleSheets(i).href==sHREF)
				bStyleSelExist = true;
			}
		if(bStyleSelExist==false)
			{
			oElement = oEditor.document.createElement("<link rel='stylesheet' href='" + this.getEditorPreviewPath(this.StyleSelectionPath_RelativeTo_EditorPath + this.StyleSelection) + "' type='text/css'>");
			var oEl = oEditor.document.childNodes[0].childNodes[0].appendChild(oElement);
			}
		}

	//Additional ***/
	oEditor.document.body.style.border = this.style_editor_Border;
	oEditor.document.body.contentEditable = true;
	oEditor.document.body.oncontextmenu = retFalse;

	//ADDITIONAL SETTINGS ***/
	oEditor.document.execCommand("2D-Position", true, true);
	oEditor.document.execCommand("MultipleSelection", true, true);
	oEditor.document.execCommand("LiveResize", true, true);
	oEditor.document.onkeypress = doOnKeyPress;

	//~~~ ANCHOR ~~~
	for(var i=0;i<oEditor.document.all.length;i++)
		{
		if(oEditor.document.all[i].tagName=="A")
			{
			if(oEditor.document.all[i].name!="")
				oEditor.document.all[i].innerHTML = "<IMG src='EDITOR/images/file_htm.gif' align=middle border=0>" + oEditor.document.all[i].innerHTML;
			}
		}
	//~~~~~~~~~~~~~
	}

function getTitle()
	{
	var oEditor = eval("idContent"+this.oName);
	return oEditor.document.title;
	}

function setTitle(sTitle)
	{
	var oEditor = eval("idContent"+this.oName);
	oEditor.document.title = sTitle;
	}

/*** 实行命令 ***/
function doCmd(sCmd,sOption)
	{
	this.boxHide();

	var oEditor = eval("idContent"+this.oName);
	var oSel = oEditor.document.selection.createRange();
	var sType = oEditor.document.selection.type;

	var oName = this.oName;//fail kalo pake oUtil.oName, krn ada delay..mesti tunggu

	//a must
	oSel = fixSel(oName,oSel);
	sType = fixSelType(oName,oSel,sType);

	var oTarget = (sType == "None" ? oEditor.document : oSel);
	oTarget.execCommand(sCmd, false, sOption);
	}
function doCmd2(sCmd,sOption)//For BOX
	{
	this.boxHide();

	var oEditor = eval("idContent"+this.oName);
	var oSel = this.Sel;
	var sType = this.SelType;

	var oName = this.oName;

	//a must
	oSel = fixSel(oName,oSel);
	sType = fixSelType(oName,oSel,sType);

	var oTarget = (sType == "None" ? oEditor.document : oSel);
	oSel.select();//tambahan
	oTarget.execCommand(sCmd, false, sOption);
	}

/*** 不受约束的 (必须) ***/
function fixSel(oName,oSel)//oName=string, oSel=object
	{
	var oEditor = eval("idContent"+oName);

	if(oSel.parentElement != null)
		{
		if(!IsInsideEditor(oSel.parentElement()))
			{
			oEditor.focus();
			var oSel = oEditor.document.selection.createRange();
			}
		}
	else
		{
		if(!IsInsideEditor(oSel.item(0)))
			{
			oEditor.focus();
			var oSel = oEditor.document.selection.createRange();
			}
		}
	return oSel;
	}
function fixSelType(oName,oSel,sType)//oName=string, oSel=object
	{
	var oEditor = eval("idContent"+oName);
	if(oSel.parentElement != null)
		{
		if(!IsInsideEditor(oSel.parentElement()))
			{
			oEditor.focus();
			var sType = oEditor.document.selection.type;
			}
		}
	else
		{
		if(!IsInsideEditor(oSel.item(0)))
			{
			oEditor.focus();
			var sType = oEditor.document.selection.type;
			}
		}
	return sType;
	}
function IsInsideEditor(oElement)
	{
	while (oElement!=null)
		{
		if(oElement.tagName=="BODY" && oElement.contentEditable=="true")return true;
		oElement = oElement.parentElement;
		}
	return false;
	}
function retFalse()
	{
	return false;
	}

/*** 选择样式 ***/
function LoadStyleSelection()
	{
	sHTML = "<head><link rel='stylesheet' href='"+ this.StyleSelectionPath_RelativeTo_EditorPath + this.StyleSelection+"' type='text/css'>" +
			"</head><body onload='parent."+this.oName+".WriteStyleSelection()'></body>";
	eval("boxStyleTmp"+this.oName).document.open("text/html","replace");
	eval("boxStyleTmp"+this.oName).document.write(sHTML);
	eval("boxStyleTmp"+this.oName).document.close();
	}
function WriteStyleSelection()
	{
	sHTML = "<link rel='stylesheet' href='"+ this.StyleSelectionPath_RelativeTo_EditorPath + this.StyleSelection+"' type='text/css'>" +	boxDrawDrop(150,this.writeStyle());
	eval("boxStyle"+this.oName).document.open("text/html","replace");
	eval("boxStyle"+this.oName).document.write(sHTML);
	eval("boxStyle"+this.oName).document.close();
	}
function writeStyle()
	{
	var val;
	var sHTML = "";
	sHTML += "<table align=center border=0 width=100% height=100% cellpadding=0 cellspacing=0>" +
			"<tr><td height=3></td></tr>";
	var oEditor = eval("boxStyleTmp"+this.oName);
	for(var i=0;i<oEditor.document.styleSheets(0).rules.length;i++)
		{
		h=oEditor.document.styleSheets(0).rules.item(i).selectorText;
		var selArr = h.split(".");
		var itemCount = selArr.length;
		if(itemCount>1) {val = selArr[1]}
		else {val = h}
		sHTML += "<tr><td onclick=\"parent."+this.oName+".applyStyle('"+val+"');\"  align=center onmouseover='parent."+this.oName+".selOver(this)' onmouseout='parent."+this.oName+".selOut(this)' class=dropdown style='height:18'><span class=\""+val+"\">" + val + "</span></td></tr>";
		}
	sHTML += "<tr><td height=3></td></tr>";
	sHTML += "</table>";
	return sHTML;
	}
function applyStyle(val)
	{
	var oSel = eval(eval("boxStyle"+this.oName).document.body.document.all.inpActiveEditor.value).Sel;
	var sType = eval(eval("boxStyle"+this.oName).document.body.document.all.inpActiveEditor.value).SelType;
	
	for(var i=0;i<parent.frames.length;i++)
		{
		if(parent.frames(i).name == window.name)
			{
			//~~~ frame ~~~
			eval(eval("parent.frames."+ window.name + ".boxStyle"+this.oName).document.body.document.all.inpActiveEditor.value+".doCmd2('fontname','')");
			if (oSel.parentElement)
					{
					oEl = GetElement(oSel.parentElement(),"FONT");
					if(oEl)oEl.className = val;
					}
			//~~~
			return;
			}
		}
	//~~~ nonframe (popup or not) ~~~
	eval(eval("parent.boxStyle"+this.oName).document.body.document.all.inpActiveEditor.value+".doCmd2('fontname','')");
	if (oSel.parentElement)
			{
			oEl = GetElement(oSel.parentElement(),"FONT");
			if(oEl)oEl.className = val;
			}
	//~~~
	}

/*** 工具栏函数 ***/
function drawIcon(block,nTop,width,id,title,command,isToggle)
	{
	document.write("<span unselectable='on' id='span_"+id+"' style=\"margin-left:2;margin-right:0;margin-bottom:3;width: "+width+";height:26;\"><span unselectable='on' style=\"position:absolute;clip: rect(0 "+width+" 26 0)\">");
	switch(block)
		{
		case 1:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon1.gif\" style=\"position:absolute;top:-"+nTop+";width:58\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 2:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon2.gif\" style=\"position:absolute;top:-"+nTop+";width:75\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 3:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon3.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 4:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon4.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 5:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon5.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 6:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon6.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 7:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon7.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 8:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon8.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 9:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon9.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 10:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon10.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		case 11:
			document.write("<img unselectable='on' id='"+id+"' btntoggle='"+isToggle+"' title=\""+title+"\" src=\""+ this.iconFolder +"icon11.gif\" style=\"position:absolute;top:-"+nTop+";width:27\" onmousedown=\"button_down(this,"+nTop+")\" onmouseup=\"button_up(this,"+nTop+");"+command+"\">");
			break;
		}
	document.write("</span></span>");
	}
function button_up(eButton, nTop)
	{
	eButton.style.top = -nTop;
	}
function button_down(eButton, nTop)
	{
	eButton.style.top = -nTop - 26;
	}

/*** 编辑系统 ***/
function RUN()
	{
	oName = this.oName;
	obj = eval(oName);
	if(this.base=="") this.base = this.baseEditor;

	//PREPARE ICONS ***/
	document.write("<IMG SRC='" +this.iconFolder+ "icon1.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon2.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon3.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon4.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon5.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon6.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon7.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon8.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon9.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon10.gif' width=1 height=1 style='display:none'>");
	document.write("<IMG SRC='" +this.iconFolder+ "icon11.gif' width=1 height=1 style='display:none'>");

	document.write("<table width='"+this.width+"' height='"+this.height+"' border=0 cellpadding=0 cellspacing=0><tr><td>")
	
	//默认工具栏 ***/
	document.write("<table style='display:none' id='idToolbar"+oName+"' cellpadding=0 cellspacing=0 border=0 width='100%' valign=bottom style=\""+this.style_editor_Toolbar+"\"><tr><td height=4></td></tr><tr><td>");
	
	if(this.useSave)obj.drawIcon(1,0,27,"btnSave"+oName,"保存",oName+".onSave()",false);
	if(this.usePrint)obj.drawIcon(1,52,27,"btnPrint"+oName,"打印",oName+".doCmd('Print')",false);
	if(this.useZoom)obj.drawIcon(1,104,36,"btnZoom"+oName,"缩放",oName+".boxShowDrop('boxZoom');setPosition(this,'boxZoom')",false);
	if(this.useStyle)obj.drawIcon(1,156,58,"btnStyle"+oName,"样式",oName+".boxShowDrop('boxStyle"+oName+"');setPosition(this,'boxStyle"+oName+"')",false);
	
	if(this.useParagraph)obj.drawIcon(2,0,75,"btnParagraph"+oName,"段落",oName+".boxShowDrop('boxParagraph');setPosition(this,'boxParagraph')",false);
	if(this.useFontName)obj.drawIcon(2,52,75,"btnFontName"+oName,"字体",oName+".boxShowDrop('boxFont');setPosition(this,'boxFont')",false);
	if(this.useSize)obj.drawIcon(2,104,55,"btnSize"+oName,"尺寸",oName+".boxShowDrop('boxSize');setPosition(this,'boxSize')",false);
	if(this.useText)obj.drawIcon(2,156,27,"btnText"+oName,"文本层",oName+".InsertText()",false);

	if(this.useSelectAll)obj.drawIcon(3,0,27,"btnSelectAll"+oName,"全部选择",oName+".doCmd('SelectAll')",false);
	if(this.useCut)obj.drawIcon(3,52,27,"btnCut"+oName,"剪切",oName+".doCmd('Cut')",false);
	if(this.useCopy)obj.drawIcon(3,104,27,"btnCopy"+oName,"拷贝",oName+".doCmd('Copy')",false);
	if(this.usePaste)obj.drawIcon(3,156,27,"btnPaste"+oName,"粘贴",oName+".doCmd('Paste')",false);
	
	if(this.useUndo)obj.drawIcon(4,0,27,"btnUndo"+oName,"撤销",oName+".doCmd('Undo')",false);
	if(this.useRedo)obj.drawIcon(4,52,27,"btnRedo"+oName,"重复",oName+".doCmd('Redo')",false);
	if(this.useBold)obj.drawIcon(4,104,27,"btnBold"+oName,"加粗",oName+".doCmd('Bold')",false);
	if(this.useItalic)obj.drawIcon(4,156,27,"btnItalic"+oName,"斜体",oName+".doCmd('Italic')",false);

	if(this.useUnderline)obj.drawIcon(5,0,27,"btnUnderline"+oName,"下划线",oName+".doCmd('Underline')",false);
	if(this.useStrikethrough)obj.drawIcon(5,52,27,"btnStrikethrough"+oName,"删除线",oName+".doCmd('Strikethrough')",false);
	if(this.useSuperscript)obj.drawIcon(5,104,27,"btnSuperscript"+oName,"上标",oName+".doCmd('Superscript')",false);
	if(this.useSubscript)obj.drawIcon(5,156,27,"btnSubscript"+oName,"下标",oName+".doCmd('Subscript')",false);
	
	if(this.useSymbol)obj.drawIcon(6,0,27,"btnSymbol"+oName,"特殊符号",oName+".boxShowPop('boxSymbol')",false);
	if(this.useJustifyLeft)obj.drawIcon(6,52,27,"btnJustifyLeft"+oName,"左对齐",oName+".doCmd('JustifyLeft')",false);
	if(this.useJustifyCenter)obj.drawIcon(6,104,27,"btnJustifyCenter"+oName,"中间对齐",oName+".doCmd('JustifyCenter')",false);
	if(this.useJustifyRight)obj.drawIcon(6,156,27,"btnJustifyRight"+oName,"右对齐",oName+".doCmd('JustifyRight')",false);

	if(this.useJustifyFull)obj.drawIcon(7,0,27,"btnJustifyFull"+oName,"两边对齐",oName+".doCmd('JustifyFull')",false);
	if(this.useNumbering)obj.drawIcon(7,52,27,"btnNumbering"+oName,"编号",oName+".doCmd('InsertOrderedList')",false);
	if(this.useBullets)obj.drawIcon(7,104,27,"btnBullets"+oName,"项目符号",oName+".doCmd('InsertUnorderedList')",false);
	if(this.useIndent)obj.drawIcon(7,156,27,"btnIndent"+oName,"减少缩进量",oName+".doCmd('Indent')",false);
	
	if(this.useOutdent)obj.drawIcon(8,0,27,"btnOutdent"+oName,"增加缩进量",oName+".doCmd('Outdent')",false);
	if(this.useImage)obj.drawIcon(8,52,27,"btnImage"+oName,"插入图像",oName+".boxShow_Image()",false);
	if(this.useForeColor)obj.drawIcon(8,104,27,"btnForeColor"+oName,"字体颜色",oName+".boxShowPop('boxForecolor')",false);
	if(this.useBackColor)obj.drawIcon(8,156,27,"btnBackColor"+oName,"背景颜色",oName+".boxShowPop('boxBackcolor')",false);

	if(this.useExternalLink)obj.drawIcon(9,0,27,"btnExternalLink"+oName,"插入超级链接",oName+".boxShow_ExternalLink()",false);
	if(this.useInternalLink)obj.drawIcon(9,52,27,"btnInternalLink"+oName,"Internal Link",oName+".boxShow_InternalLink()",false);
	if(this.useAsset)obj.drawIcon(9,104,27,"btnAsset"+oName,"Asset",oName+".boxShow_Asset()",false);
	if(this.useTable)obj.drawIcon(9,156,27,"btnTable"+oName,"插入表格",oName+".boxShow_Table()",false);
	
	if(this.useShowBorder)obj.drawIcon(10,0,27,"btnShowBorder"+oName,"显示表格边界",oName+".showBorder()",false);
	if(this.useAbsolute)obj.drawIcon(10,52,27,"btnAbsolute"+oName,"文字环绕",oName+".doCmd('AbsolutePosition')",false);//IE5.5 or later
	if(this.useClean)obj.drawIcon(10,104,27,"btnClean"+oName,"清除样式",oName+".doCmd('RemoveFormat')",false);
	if(this.useLine)obj.drawIcon(10,156,27,"btnLine"+oName,"线",oName+".doCmd('InsertHorizontalRule')",false);
	
	if(this.usePageProperties)obj.drawIcon(11,0,27,"btnPageProperties"+oName,"Page Properties",oName+".boxShow_Page()",false);
	if(

⌨️ 快捷键说明

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