📄 dialog.js
字号:
var objParent=window.opener;
var arrArgs=window.dialogArguments;
if(arrArgs==null&&objParent!=null)arrArgs=objParent.ETSOOSavedArguments;
if(objParent==null)objParent=arrArgs[0];
var objEditor=objParent.ETSOOEditor;
if(objEditor==null){
var objTemp=objParent.objParent;
if(objTemp){
objEditor=objTemp.ETSOOEditor;
if(objEditor)objParent.ETSOOGetPos=objTemp.ETSOOGetPos;
}
}
if(objEditor==null){
var objTemp=objParent;
while(objTemp){
objTemp=objTemp.opener;
if(objTemp&&objTemp.ETSOOEditor){
objEditor=objTemp.ETSOOEditor;
objParent.ETSOOGetPos=objTemp.ETSOOGetPos;
break;
}
}
}
var objTarget=arrArgs[1];
var objJustActive=objEditor.ActiveTarget;
var objDialogAdd=arrArgs[2];
var objField=objEditor.ActiveField;
var strBgColor=objField.BgColor;
var arrWindowLangs=objEditor.WindowLangs;
var langBOK=arrWindowLangs[0];
var langBCancel=arrWindowLangs[1];
var langBClose=arrWindowLangs[2];
arrWindowLangs=null;
var numBrowser=objEditor.Browser;
var strCharset=objEditor._GetCharset();
var strEditorLanguage=objField.Language;
//浏览文件,需要扩充
function doBrowse(objTarget,strType,strPath){
var arrArguments=new Array(objTarget,strType,strPath);
var numType=1;
if(document.body.contentEditable==null)numType=-1;
if(objParent&&objParent.ETSOOPopup){
objParent.ETSOOPopup.Open("/ETSOOBase/EOFile/",arrArguments,780,objParent.ETSOOGetAdjustHeight(560),numType);
}
}
//导入语言文件
function GetLanguage(){
var numLen=arguments.length;
var strLang='';
for(var numI=0;numI<numLen;numI++){
strLang+='<script lang="'+strCharset+'" language="javascript" src="../Languages/'+strEditorLanguage+'/'+arguments[numI]+'"></script>';
}
document.write(strLang);
}
//显示颜色提示
function showColorPallette(objE,objEvent){
var numLeft,numTop;
if(numBrowser<100){
var arrPos=objParent.ETSOOGetPos(objE);
numLeft=arrPos[0]
numTop=arrPos[1]+objE.clientHeight+2;
}else{
numLeft=objEvent.clientX-objEvent.offsetX-3;
numTop=objEvent.clientY+objE.clientHeight-objEvent.offsetY-1;
}
var numSTop=document.body.scrollTop;
var numSLeft=document.body.scrollLeft;
numLeft+=numSLeft;numTop+=numSTop;
var objPopup=new ETSOOPopup(null,null,null,numLeft,numTop);
objPopup.BgColor=strBgColor;
objPopup.Skin="../Skins/"+objField.Skin+"/Popup.css";
objPopup.SourceObject=objE;
objPopup.Path="../";
objPopup.DefaultColor=objE.value;
objPopup.DoFunction="setColor";
objPopup.SourceId=objE.previousSibling.id;
objPopup.ShowColorPallette(objParent.ETSOOEditor.OtherLangs[1],objParent.ETSOOEditor.OtherLangs[2]);
ETSOOPopup._SetAddEvent(window);
}
//设置颜色
function setColor(strColor,strId){
var objE=document.getElementById(strId);
if(objE&&!objE.disabled){
objE.value=strColor;
objE.style.backgroundColor=strColor;
}
}
//按键值
function getKeyCode(objEvent){
return objEvent.keyCode;
}
//处理回车键
function doKeyPress(objEvent,strId){
if(getKeyCode(objEvent)==13){
var objT=GetObj(strId);
if(objT)objT.onclick();
}
}
//取得相对路径
function getRelativePath(strSrc){
if(strSrc==null)strSrc="";
return objParent.ETSOOEditor.GetRelativePath(strSrc);
}
//当值发生变化时
function doValueChange(objE){
var strValue=objE.value;
if(strValue=="")return;
var numValue=parseFloat(strValue);
if(isNaN(numValue)||numValue<0||numValue>10000)numValue=1;
objE.value=numValue;
return numValue;
}
//设置值
function doDefaultValue(objE,strValue){
if(strValue==null)strValue="";
var blnSet=false;
if(objE.type=="text")objE.value=strValue;
else{
strValue=new String(strValue);
strValue=strValue.toLowerCase();
var numLen=objE.length;
for(var numI=0;numI<numLen;numI++){
var objOne=objE[numI];
var strTemp=objOne.value;
strTemp=strTemp.toLowerCase();
if(strTemp==strValue){
if(objE.type=="select-one"||objE.type=="select-multiple")objOne.selected=true;
else objOne.checked=true;
blnSet=true;
}
}
}
return blnSet;
}
//设置属性
function setProperty(objE,strName,strValue){
try{
if(strValue==""){
objE.removeAttribute(strName,1);
}else{
if(strValue=="false")strValue=false;
if(strValue=="true")strValue=true;
objE.setAttribute(strName,strValue,1);
}
}catch(e){
return false;
}
}
//兼容propertychange
function GetChangeFun(strFun){
if(numBrowser>100)return 'onpropertychange="'+strFun+'"';
else return 'onmouseup="'+strFun+'" onkeyup="'+strFun+'" onchange="'+strFun+'"';
}
//使对象有效
function SetValid(objFrom,objTo){
objTo.disabled=(objFrom.value=="");
}
//获取对象
function GetObj(strId){
return document.getElementById(strId);
}
//设置颜色
function doSetColor(objE,numType,objEvent){
if(numType==1||(objEventt&&objEvent.keyCode==13)){
try{
objE.style.backgroundColor=objE.value;
return true;
}catch(e){
return false;
}
}
}
//自定义处理函数
function SelfOnload(){
}
//写网页
function WritePage(strId,strBody,numType){
var strSkin=objField.Skin;
var objObject=objEditor.GetObj("EE"+strId);
var strTitle=(objObject==null)?objEditor.Langs[strId]:objObject.title;
if(objTarget){
var strTitlePro=objEditor.Langs[strId+"Property"];
if(strTitlePro!=null)strTitle=strTitlePro;
}
if(strTitle==null)strTitle=strId;
var strDialog='<html>';
strDialog+='<head>';
strDialog+='<meta http-equiv="Content-Type" content="text/html; charset='+strCharset+'">';
strDialog+='<title>'+strTitle+'</title>';
strDialog+='<link rel="stylesheet" href="../Skins/'+strSkin+'/Dialog.css"></head>';
strDialog+='<style>v\\:* {behavior: url(#default#VML);}o\\:* {behavior: url(#default#VML);}.shape{behavior: url(#default#VML);}</style><XML:NAMESPACE NS=urn:schemas-microsoft-com:vml PREFIX=v />';
strDialog+='</head><body bgcolor="'+strBgColor+'"';
if(numType!=-1)strDialog+=' scroll="no"';
strDialog+='>';
strDialog+=strBody;
strDialog+='</body>';
strDialog+='</html>';
document.write(strDialog);
window.onload=function(){
SelfOnload();
}
document.onkeypress=function(objEvent){
if(objEvent==null)objEvent=window.event;
if(objEvent.keyCode==27)window.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -