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

📄 ace.js

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

function getPageProperties(style)
	{//original
	var oEditor = eval("idContent"+this.oName);
	var vRetVal = eval("idContent"+this.oName+".document.body.currentStyle."+style);
	if(vRetVal == "none transparent scroll repeat 0% 0%") vRetVal="";
	return vRetVal;
	}

function getPageCSSText()
	{//margin=>padding
	if(this.getPageProperties("backgroundImage")=="none"){sTmp=""}
	else
		{
		//Change : background-image:url("include/bullet.gif")
		//To :     background-image:url('include/bullet.gif')
		sTmp = this.getPageProperties("backgroundImage");
		sTmp=(sTmp.substr(5));//remove first col("
		sTmp = sTmp.substr(0,sTmp.length-2);//remove last ")
		sTmp = "url('" + sTmp + "')";
		}

	//asumsi: target-nya div, maka : margin => padding
	sCssText = "BACKGROUND:"+this.getPageProperties("backgroundColor")+";" +
		"BACKGROUND-IMAGE:"+sTmp+";" +
		"PADDING-LEFT:"+this.getPageProperties("marginLeft")+";" +
		"PADDING-RIGHT:"+this.getPageProperties("marginRight")+";" +
		"PADDING-TOP:"+this.getPageProperties("marginTop")+";" +
		"PADDING-BOTTOM:"+this.getPageProperties("marginBottom")+";" +
		"FONT-FAMILY:"+this.getPageProperties("fontFamily")+";" +
		"FONT-SIZE:"+this.getPageProperties("fontSize")+";" +
		"COLOR:"+this.getPageProperties("color")+";";
	return sCssText;
	}
function setPageCSSText(sPageCSSText)
	{
	//kalau asalnya dari div, maka : padding => margin
	var arrTmp = sPageCSSText.split("PADDING");
	if (arrTmp.length > 1) sPageCSSText = arrTmp.join("MARGIN");

	eval("idContent"+this.oName).document.body.style.cssText += ";" + sPageCSSText;
	}

/*** 超级链接 ***/
function boxShow_InternalLink()
	{
	var oEditor = eval("idContent"+this.oName);
	oEditor.focus();//Why ?
	//Because:focus akan men-set oUtil.oNamem shg bisa dipakai di default_Asset.htm

	this.boxHide();
	this.saveSelection();
	if(this.InternalLinkPageURL=="")return;
	var popleft=((document.body.clientWidth - this.InternalLinkPageWidth) / 2)+window.screenLeft;
	var poptop=(((document.body.clientHeight - this.InternalLinkPageHeight) / 2))+window.screenTop-40;
	window.open(this.InternalLinkPageURL,"NewWindow","scrollbars=NO,width="+this.InternalLinkPageWidth+",height="+this.InternalLinkPageHeight+",left="+popleft+",top="+poptop);
	}

/*** 外部链接 ***/
function boxShow_ExternalLink()
	{
	this.boxHide();
	this.saveSelection();
	eval("boxLink").document.body.document.all.inpActiveEditor.innerText = this.oName;

	boxLink.document.body.document.all.popup_ContentBorder.style.cssText= this.style_popup_ContentBorder;
	boxLink.document.body.document.all.popup_BarArea.style.cssText= "width: 100%; height: 20px;padding-left: 5px;" + this.style_popup_BarArea;
	boxLink.document.body.document.all.popup_BarArea_close.style.cssText= "width: 100%; height: 20px;" + this.style_popup_BarArea;
	boxLink.document.body.style.cssText= "border:lightgrey 0px solid;" + this.style_popup_Body;

	//Additional
	var oSel	= this.Sel;
	var sType = this.SelType;

	if (oSel.parentElement)//If text is selected on a layer
		{
		this.SelTextFrame = GetElement(oSel.parentElement(),"DIV");//Store the active layer, so we can activate it after editing links
		if(this.SelTextFrame)this.SelTextFrameActive = true;
		else this.SelTextFrameActive = false;
		}
	else//If control is selected
		this.SelTextFrameActive = false;

	//idLinkImage & idLinkImageBorder
	if (oSel.parentElement)//If text is selected
		{
		oEl = GetElement(oSel.parentElement(),"A");//Get A element if any
		boxLink.document.body.document.all.idLinkImage.style.display = "none";//do not display Image features on the Link Dialog
		}
	else //If control is selected
		{
		oEl = GetElement(oSel.item(0),"A");//Get A element if any
		if ((oSel.item) && (oSel.item(0).tagName=="IMG"))//If an image
			{
			boxLink.document.body.document.all.idLinkImage.style.display = "block"; //display Image features on the Link Dialog
			boxLink.document.body.document.all.idLinkImageBorder.value = oSel.item(0).border; //get image border - dropdown
			}
		}

	//idLinkTarget & idLinkType & idLinkURL & idLinkName
	//Is there an A element ?
	if (oEl)//If Yes
		{
		boxLink.document.body.document.all.btnLinkInsert.style.display = "none";
		boxLink.document.body.document.all.btnLinkUpdate.style.display = "block";

		sURL = oEl.href; //get image url
		boxLink.document.body.document.all.idLinkTarget.value = oEl.target;//get image target
		if(oEl.name!=null) boxLink.document.body.document.all.idLinkName.innerText = oEl.name;
		if(oEl.NAME!=null) boxLink.document.body.document.all.idLinkName.innerText = oEl.NAME;
		if(sURL.indexOf(":")!=-1)
			{
			switch(sURL.split(":")[0])
				{
				case "http":
					boxLink.document.body.document.all.idLinkType.value = "http://";
					boxLink.document.body.document.all.idLinkURL.innerText = sURL.substr(7);
					break;
				case "https":
					boxLink.document.body.document.all.idLinkType.value = "https://";
					boxLink.document.body.document.all.idLinkURL.innerText = sURL.substr(8);
					break;
				case "mailto":
					boxLink.document.body.document.all.idLinkType.value = "mailto:";
					boxLink.document.body.document.all.idLinkURL.innerText = sURL.split(":")[1];
					break;
				case "ftp":
					boxLink.document.body.document.all.idLinkType.value = "ftp://";
					boxLink.document.body.document.all.idLinkURL.innerText = sURL.substr(6);
					break;
				case "news":
					boxLink.document.body.document.all.idLinkType.value = "news:";
					boxLink.document.body.document.all.idLinkURL.innerText = sURL.split(":")[1];
					break;
				}
			}
		else
			{
			boxLink.document.body.document.all.idLinkType.value = "";
			boxLink.document.body.document.all.idLinkURL.innerText = sURL;
			}
		}
	else //If No A element
		{
		boxLink.document.body.document.all.btnLinkInsert.style.display = "block";
		boxLink.document.body.document.all.btnLinkUpdate.style.display = "none";	

		boxLink.document.body.document.all.idLinkTarget.value = "";
		boxLink.document.body.document.all.idLinkName.innerText = "";
		boxLink.document.body.document.all.idLinkType.value = "";
		boxLink.document.body.document.all.idLinkURL.innerText = "";
		boxLink.document.body.document.all.idLinkImageBorder.value = 0;
		}

	this.boxDimension("boxLink");
	this.boxPosition("boxLink");
	document.all.boxLink.style.zIndex = 2;
	document.all.boxLink.style.visibility = "";
	document.all.boxLink.focus();
	}

function applyLink()
	{
	var inpURL = boxLink.document.body.document.all.idLinkURL.value;
	var inpURLType = boxLink.document.body.document.all.idLinkType.value;
	var sURL = inpURLType + inpURL;
	var inpAnchor = boxLink.document.body.document.all.idLinkName.value;

	var oSel	= eval(boxLink.document.body.document.all.inpActiveEditor.value).Sel;
	var sType = eval(boxLink.document.body.document.all.inpActiveEditor.value).SelType;

	//a must
	oSel = fixSel(boxLink.document.body.document.all.inpActiveEditor.value,oSel);
	sType = fixSelType(boxLink.document.body.document.all.inpActiveEditor.value,oSel,sType);

	//idLinkImageBorder
	if ((oSel.item) && (oSel.item(0).tagName=="IMG"))//If image is selected
		{
		oSel.item(0).width = oSel.item(0).offsetWidth;//give width attribute
		oSel.item(0).height = oSel.item(0).offsetHeight;//give height attribute
		oSel.item(0).border = boxLink.document.body.document.all.idLinkImageBorder.value;
		}

	if(inpURL!="")
		{
		if (oSel.parentElement)
			{
			if(boxLink.document.body.document.all.btnLinkInsert.style.display == "block")
				{
				if(oSel.text=="")//If no (text) selection, then build selection using the typed URL
					{
					var oSelTmp = oSel.duplicate();
					oSel.text = sURL;
					oSel.setEndPoint("StartToStart",oSelTmp);
					oSel.select();
					sType="Text";
					}
				}
			}

		//idLinkType & idLinkURL (sURL)
		oSel.execCommand("CreateLink",false,sURL);

		//After A element created, then add the Target
		if (oSel.parentElement)
			oEl = GetElement(oSel.parentElement(),"A");
		else
			oEl = GetElement(oSel.item(0),"A");
		if(oEl)
			{
			if(boxLink.document.body.document.all.idLinkTarget.value=="")
				oEl.removeAttribute("target",0);
			else
				oEl.target = boxLink.document.body.document.all.idLinkTarget.value;

			oEl.removeAttribute("NAME",0);
			oEl.removeAttribute("name",0);
			oEl.NAME = boxLink.document.body.document.all.idLinkName.value;

			//~~~ ANCHOR ~~~
			if(inpAnchor!="")
				{
				isImgAnchorExist=false;
				for(var j=0;j<oEl.childNodes.length;j++)
					{
					if(oEl.childNodes[j].tagName=="IMG")
						{
						sSrc = oEl.childNodes[j].src;
						if(sSrc.indexOf("yusasp_anchor.gif")!=-1) isImgAnchorExist=true;
						}
					}
				if(isImgAnchorExist!=true)
					oEl.innerHTML = "<IMG src='EDITOR/images/file_htm.gif' align=middle border=0>" + oEl.innerHTML;
				}
			else
				{
				for(var j=0;j<oEl.childNodes.length;j++)
					{
					if(oEl.childNodes[j].tagName=="IMG")
						{
						sSrc = oEl.childNodes[j].src;
						if(sSrc.indexOf("yusasp_anchor.gif")!=-1)
							oEl.removeChild(oEl.childNodes[j]);
						}
					}
				}
			//~~~
			}

		eval("idContent"+boxLink.document.body.document.all.inpActiveEditor.value).focus();
		oSel.select();//tambahan
		}
	else if(inpAnchor!="")
		{
		if (oSel.parentElement)
			{
			if(boxLink.document.body.document.all.btnLinkInsert.style.display == "block")
				{
				if(oSel.text=="")//If no (text) selection, then build selection using the typed URL
					{
					var oSelTmp = oSel.duplicate();
					oSel.text = inpAnchor;
					oSel.setEndPoint("StartToStart",oSelTmp);
					oSel.select();
					sType="Text";
					}
				}
			}

		oSel.execCommand("CreateLink",false,"");

		if (oSel.parentElement)
			oEl = GetElement(oSel.parentElement(),"A");
		else
			oEl = GetElement(oSel.item(0),"A");

		if(oEl)
			{
			//~~~ ANCHOR ~~~
			for(var j=0;j<oEl.childNodes.length;j++)
				{
				if(oEl.childNodes[j].tagName=="IMG")
					{
					sSrc = oEl.childNodes[j].src;
					if(sSrc.indexOf("yusasp_anchor.gif")!=-1)
						oEl.removeChild(oEl.childNodes[j]);
					}
				}
			//~~~

			oEl.removeAttribute("target",0);
			oEl.removeAttribute("href",0);

			oEl.removeAttribute("NAME",0);
			oEl.removeAttribute("name",0);
			oEl.NAME = inpAnchor;

			//~~~ ANCHOR ~~~
			oEl.innerHTML = "<IMG src='EDITOR/images/file_htm.gif' align=middle border=0>" + oEl.innerHTML;
			//~~~
			}
		eval("idContent"+boxLink.document.body.document.all.inpActiveEditor.value).focus();
		try
			{
			oSel.select();//tambahan	(unsp.err if no test in anchor)
			}
		catch(e){}
		}
	else
		{
		//~~~ ANCHOR ~~~
		if (oSel.parentElement)
			oEl = GetElement(oSel.parentElement(),"A");
		else
			oEl = GetElement(oSel.item(0),"A");

		if(oEl)
			{
			for(var j=0;j<oEl.childNodes.length;j++)
				{
				if(oEl.childNodes[j].tagName=="IMG")
					{
					sSrc = oEl.childNodes[j].src;
					if(sSrc.indexOf("yusasp_anchor.gif")!=-1)
						oEl.removeChild(oEl.childNodes[j]);
					}
				}
			}
		//~~~

		oSel.execCommand("unlink");//unlink
		}

	//Activate layer again
	if(eval(boxLink.document.body.document.all.inpActiveEditor.value).SelTextFrameActive) eval(boxLink.document.body.document.all.inpActiveEditor.value).SelTextFrame.setActive();

	eval(boxLink.document.body.document.all.inpActiveEditor.value).boxHide();
	}
	
/*** 自定义图片 ***/
function boxShow_Image()
	{
	var oEditor = eval("idContent"+this.oName);
	oEditor.focus();//Why ?
	//Because:focus akan men-set oUtil.oNamem shg bisa dipakai di default_Asset.htm

	this.boxHide();
	this.saveSelection();
	if(this.ImagePageURL=="")return;
	var popleft=((document.body.clientWidth - this.ImagePageWidth) / 2)+window.screenLeft;
	var poptop=(((document.body.clientHeight - this.ImagePageHeight) / 2))+window.screenTop-40;	
	window.open(this.ImagePageURL,"NewWindow","scrollbars=NO,width="+this.ImagePageWidth+",height="+this.ImagePageHeight+",left="+popleft+",top="+poptop);
	}

function imgSrc()
	{
	oEditor=eval("idContent"+this.oName);
	var oSel = oEditor.document.selection.createRange();

⌨️ 快捷键说明

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