📄 ace.js
字号:
/*******************
HTMLEDT Version 3.3
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
********************/
var oUtil = new ACEUtilities();
function ACEUtilities()
{
this.ACEObjects = "";
this.oName;
this.onloadFunction = "";
}
/*** 编辑区域 ***/
function boxDrawDrop(width,content)
{
var sHTML = "" +
"<style>" +
" body {border:lightgrey 0px solid;background: white;}" +
" td {font:8pt verdana,arial,sans-serif}" +
" .dropdown {cursor:hand}" +
"</style>" +
"<body topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 onselectstart=\"return event.srcElement.tagName=='INPUT'\" oncontextmenu='return false'>" +
" <table border=0 cellpadding=1 cellspacing=0 style='table-layout: fixed;border-right:#c3c3c3 1 solid;border-bottom:#c3c3c3 1 solid;border-left:#aeaeae 1 solid;border-top:#aeaeae 1 solid;' ID=tblPopup>" +
" <col width="+width+">" +
" <tr>" +
" <td>" +
content +
" </td>" +
" </tr>" +
" </table>" +
"<input type=text style='display:none;' id='inpActiveEditor' name='inpActiveEditor' contentEditable=true>" +
"</body>";
return sHTML;
}
function boxDrawPop(width,title,content)
{
var sHTML = "" +
"<style>" +
" select{height: 22px; top:2; font:8pt verdana,arial,sans-serif}" +
" body {border:lightgrey 0px solid;background: #ece9d8;}" +
" td {font:8pt verdana,arial,sans-serif}" +
" .dropdown {cursor:hand}" +
" .bar{padding-left: 5px;border-top: #99ccff 1px solid; background: #004684;WIDTH: 100%; border-bottom: #004684 1px solid;height: 20px}" +
" .bar2{border-top: #99ccff 1px solid; background: #004684;WIDTH: 100%; border-bottom: #004684 1px solid;height: 20px}" +
" div { font:10pt tahoma,arial,sans-serif}" +
"</style>" +
"<body onload='' topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0 onselectstart=\"return event.srcElement.tagName=='INPUT'\" oncontextmenu='return false'>" +
"<table border=0 cellpadding=0 cellspacing=0 style='table-layout: fixed' ID=tblPopup>" +
"<col width="+width+"><col width=13>" +
"<tr>" +
"<td>" +
" <div id='popup_BarArea' class=bar>" +
" <font size=2 face=tahoma color=white><b>"+title+"</b></font>" +
" </div>" +
"</td>" +
"<td style='cursor:hand' onclick=\"eval('parent.'+inpActiveEditor.value).boxHide()\">" +
" <div id='popup_BarArea_close' class=bar2>" +
" <font size=2 face=tahoma color=white><b>X</b></font> " +
" </div>" +
"</td>" +
"</tr>" +
"<tr>" +
"<td id='popup_ContentBorder' colspan=2 style='border-left: #336699 1px solid;border-right: #336699 1px solid;border-bottom: #336699 1px solid;' valign=top>" +
" <br>" +
" <div id=divPopup align=center>" + content +
" </div>" +
" <br>" +
"</td>" +
"</tr>" +
"</table>" +
"<input type=text style='display:none;' id='inpActiveEditor' name='inpActiveEditor' contentEditable=true>" +
"</body>";
return sHTML;
}
/*** 编辑区域函数部分 ***/
function saveSelection()
{
var oEditor = eval("idContent"+this.oName);
this.Sel = oEditor.document.selection.createRange();
this.SelType = oEditor.document.selection.type;
}
function boxDimension(boxName)
{
var tblPopup = document.frames(boxName).document.body.document.all("tblPopup");
eval("document.all."+boxName).style.width = tblPopup.offsetWidth;
eval("document.all."+boxName).style.height = tblPopup.offsetHeight;
}
function boxPosition(boxName)
{
var tblPopup = document.frames(boxName).document.body.document.all("tblPopup");
var oArea = eval("idArea" + this.oName);
myTop = 0; stmp = "";
while(eval("idArea"+ this.oName + stmp).tagName!="BODY")
{
myTop += eval("idArea"+ this.oName + stmp).offsetTop;
stmp += ".offsetParent";
}
myLeft = 0; stmp = "";
while(eval("idArea"+ this.oName + stmp).tagName!="BODY")
{
myLeft += eval("idArea"+ this.oName + stmp).offsetLeft;
stmp += ".offsetParent";
}
if(oArea.offsetHeight-tblPopup.offsetHeight > 0)
eval("document.all."+boxName).style.pixelTop=(myTop + (oArea.offsetHeight-tblPopup.offsetHeight)/2);
else
eval("document.all."+boxName).style.pixelTop=(myTop + (oArea.offsetHeight-tblPopup.offsetHeight)/2);
if(oArea.offsetWidth-tblPopup.offsetWidth > 0)
eval("document.all."+boxName).style.pixelLeft=(myLeft + (oArea.offsetWidth-tblPopup.offsetWidth)/2);
else
eval("document.all."+boxName).style.pixelLeft=myLeft;
}
function setPosition(idImg,boxName)//for dropdown
{
myTop = 0; stmp = "";
while(eval("idImg" + stmp).tagName!="BODY")
{stmp += ".offsetParent"; myTop += eval("idImg" + stmp).offsetTop;}
myTop = myTop + 28;
myLeft = 0; stmp = "";
while(eval("idImg" + stmp).tagName!="BODY")
{stmp += ".offsetParent"; myLeft += eval("idImg" + stmp).offsetLeft;}
myLeft = myLeft + 0;
eval("document.all."+boxName).style.pixelLeft = myLeft;
eval("document.all."+boxName).style.pixelTop = myTop;
}
function boxHide()
{
if(this.useZoom) document.all.boxZoom.style.visibility = "hidden";
if(this.useStyle) eval("document.all.boxStyle"+this.oName).style.visibility = "hidden";
if(this.useParagraph) document.all.boxParagraph.style.visibility = "hidden";
if(this.useFontName) document.all.boxFont.style.visibility = "hidden";
if(this.useSize) document.all.boxSize.style.visibility = "hidden";
if(this.useForeColor) document.all.boxForecolor.style.visibility = "hidden";
if(this.useBackColor) document.all.boxBackcolor.style.visibility = "hidden";
if(this.useTable) document.all.boxTable2.style.visibility = "hidden";
if(this.useExternalLink) document.all.boxLink.style.visibility = "hidden";
if(this.useSymbol) document.all.boxSymbol.style.visibility = "hidden";
if(this.usePageProperties) document.all.boxPage.style.visibility = "hidden";
}
function selOver(el)
{
el.style.background=this.selectionColor;
el.style.color="white";
}
function selOut(el)
{
el.style.background="";
el.style.color="black";
}
/**** 普通编辑区域 ***/
function boxShowPop(boxName)
{
this.boxHide();
this.saveSelection();
eval(boxName).document.body.document.all.inpActiveEditor.innerText = this.oName;
eval(boxName).document.body.document.all.popup_ContentBorder.style.cssText= this.style_popup_ContentBorder;
eval(boxName).document.body.document.all.popup_BarArea.style.cssText= "width: 100%; height: 20px;padding-left: 5px;" + this.style_popup_BarArea;
eval(boxName).document.body.document.all.popup_BarArea_close.style.cssText= "width: 100%; height: 20px;" + this.style_popup_BarArea;
eval(boxName).document.body.style.cssText= "border:lightgrey 0px solid;" + this.style_popup_Body;
this.boxDimension(boxName);
this.boxPosition(boxName);
eval("document.all."+boxName).style.zIndex = 2;
eval("document.all."+boxName).style.visibility = "";
eval("document.all."+boxName).focus();//editor lost focus
}
function boxShowDrop(boxName)
{
this.boxHide();
this.saveSelection();
eval(boxName).document.body.document.all.inpActiveEditor.innerText = this.oName;
this.boxDimension(boxName);
this.boxPosition(boxName);
eval("document.all."+boxName).style.zIndex = 2;
eval("document.all."+boxName).style.visibility = "";
eval("document.all."+boxName).focus();//editor lost focus
}
/*** 普通编辑区缩放 ***/
function applyZoom(val)
{
for(var i=0;i<parent.frames.length;i++)
{
if(parent.frames(i).name == window.name)
{
//~~~ frame ~~~~
eval("parent.frames."+window.name+"." + boxZoom.document.body.document.all.inpActiveEditor.value).boxHide();
var oEditor = eval("idContent"+boxZoom.document.body.document.all.inpActiveEditor.value);
oEditor.document.body.style.zoom = val;
//~~~
return;
}
}
//~~~ nonframe (popup or not) ~~~
eval("parent." + boxZoom.document.body.document.all.inpActiveEditor.value).boxHide();
var oEditor = eval("idContent"+boxZoom.document.body.document.all.inpActiveEditor.value);
oEditor.document.body.style.zoom = val;
//~~~
}
/*** 编辑区文章段 ***/
function applyPara(val)
{
for(var i=0;i<parent.frames.length;i++)
{
if(parent.frames(i).name == window.name)
{//frame
eval("parent.frames."+window.name+"." + boxParagraph.document.body.document.all.inpActiveEditor.value).doCmd2("FormatBlock",val);
return;
}
}
eval("parent." + boxParagraph.document.body.document.all.inpActiveEditor.value).doCmd2("FormatBlock",val);
}
/*** 编辑区字体名称 ***/
function applyFont(val)
{
for(var i=0;i<parent.frames.length;i++)
{
if(parent.frames(i).name == window.name)
{//frame
eval("parent.frames."+window.name+"." + boxFont.document.body.document.all.inpActiveEditor.value).doCmd2("fontname",val);
return;
}
}
eval("parent."+ boxFont.document.body.document.all.inpActiveEditor.value).doCmd2("fontname",val);
}
/*** 编辑区字体大小 ***/
function applySize(val)
{
for(var i=0;i<parent.frames.length;i++)
{
if(parent.frames(i).name == window.name)
{//frame
eval("parent.frames."+window.name+"." + boxSize.document.body.document.all.inpActiveEditor.value).doCmd2("fontsize",val);
return;
}
}
eval("parent." + boxSize.document.body.document.all.inpActiveEditor.value).doCmd2("fontsize",val);
}
/***编辑区字体颜色 ***/
function applyForecolor(val)
{
for(var i=0;i<parent.frames.length;i++)
{
if(parent.frames(i).name == window.name)
{//frame
eval("parent.frames."+window.name+"." + boxForecolor.document.body.document.all.inpActiveEditor.value).doCmd2("ForeColor",val);
return;
}
}
eval("parent." + boxForecolor.document.body.document.all.inpActiveEditor.value).doCmd2("ForeColor",val);
}
/*** 编辑区背景颜色 ***/
function applyBackcolor(val)
{
for(var i=0;i<parent.frames.length;i++)
{
if(parent.frames(i).name == window.name)
{//frame
eval("parent.frames."+window.name+"." + boxBackcolor.document.body.document.all.inpActiveEditor.value).doCmd2("BackColor",val);
return;
}
}
eval("parent." + boxBackcolor.document.body.document.all.inpActiveEditor.value).doCmd2("BackColor",val);
}
/*** 自定义页面工具 ***/
function boxShow_Page()
{
this.boxHide();
this.saveSelection();
boxPage.document.body.document.all.inpActiveEditor.innerText = this.oName;
boxPage.document.body.document.all.popup_ContentBorder.style.cssText= this.style_popup_ContentBorder;
boxPage.document.body.document.all.popup_BarArea.style.cssText= "width: 100%; height: 20px;padding-left: 5px;" + this.style_popup_BarArea;
boxPage.document.body.document.all.popup_BarArea_close.style.cssText= "width: 100%; height: 20px;" + this.style_popup_BarArea;
boxPage.document.body.style.cssText= "border:lightgrey 0px solid;" + this.style_popup_Body;
//Addition
var sTmp="";
if(this.getPageProperties("marginLeft")==""){sTmp=""}
else
{
sTmp = this.getPageProperties("marginLeft");
sTmp = sTmp.substr(0,sTmp.length-2);//remove last px
}
boxPage.document.body.document.all.inpPageLeft.innerText = sTmp;
if(this.getPageProperties("marginRight")==""){sTmp=""}
else
{
sTmp = this.getPageProperties("marginRight");
sTmp = sTmp.substr(0,sTmp.length-2);
}
boxPage.document.body.document.all.inpPageRight.innerText = sTmp;
if(this.getPageProperties("marginTop")==""){sTmp=""}
else
{
sTmp = this.getPageProperties("marginTop");
sTmp = sTmp.substr(0,sTmp.length-2);
}
boxPage.document.body.document.all.inpPageTop.innerText = sTmp;
if(this.getPageProperties("marginBottom")==""){sTmp=""}
else
{
sTmp = this.getPageProperties("marginBottom");
sTmp = sTmp.substr(0,sTmp.length-2);
}
boxPage.document.body.document.all.inpPageBottom.innerText = sTmp;
//Special(transparent)
if(this.getPageProperties("backgroundColor")=="transparent")
boxPage.objColor1.setColor("");
else
boxPage.objColor1.setColor(this.getPageProperties("backgroundColor"));
if(this.getPageProperties("backgroundImage")=="none"){sTmp=""}
else
{
sTmp = this.getPageProperties("backgroundImage");
sTmp=(sTmp.substr(5));//remove first col("
sTmp = sTmp.substr(0,sTmp.length-2);//remove last ")
}
boxPage.document.body.document.all.inpPageBgImg.innerText = sTmp;
boxPage.document.body.document.all.inpPageFont.innerText = this.getPageProperties("fontFamily");
if(this.getPageProperties("fontSize")==""){sTmp=""}
else
{
sTmp = this.getPageProperties("fontSize");
sTmp = sTmp.substr(0,sTmp.length-2);
}
boxPage.document.body.document.all.inpPageSize.innerText = sTmp;
boxPage.objColor2.setColor(this.getPageProperties("color"));//col obj.
this.boxDimension("boxPage");
this.boxPosition("boxPage");
document.all.boxPage.style.zIndex = 2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -