📄 comm.js
字号:
//if(!re.test(mSystem["LoadLnk"]))_alert("0x0006");
var sLnkTag = mSystem["LoadLnk"];
if(sEditorHTML.length > iLimit)
{
oField.value = sEditorHTML.substr(0,iLimit);
sEditorHTML = sEditorHTML.substr(iLimit);
while (sEditorHTML.length > 0)
{
i++;
//var sEleName = sLnkTag + "_"+ i;
var sEleName = sLnkTag;
var oTEXT = oField.document.createElement("<TEXTAREA name='" + sEleName + "'></TEXTAREA>") ;
oTEXT.style.display = "none";
oTEXT.value = sEditorHTML.substr(0,iLimit);
if(eleIsExist(oForm,sEleName)){
alert("ex");
var oOldTEXT = getElement(oForm,sEleName);
oOldTEXT.value = oTEXT.value;
}
else{
oForm.appendChild(oTEXT);
alert("exs");
}
sEditorHTML = sEditorHTML.substr(iLimit);
alert("gg");
}
}
else
{
oField.value = sEditorHTML;
}
var sTEXTCOUNT_NAME = sLnkTag + "_COUNT"
var oTEXT_COUNT = oField.document.createElement("<Input type=hidden name='" + sTEXTCOUNT_NAME + "' value='" + i + "'>");
if(eleIsExist(oForm,sTEXTCOUNT_NAME)){
var oOldTEXT_COUNT = getElement(oForm,sTEXTCOUNT_NAME);
oOldTEXT_COUNT.value = i;
}
else{
oForm.appendChild(oTEXT_COUNT);
}
}
function onFormReset(){document.location.reload();}
function onKeyDown(event)
{
var key = String.fromCharCode(event.keyCode).toUpperCase();
if (event.ctrlKey)
{
if (key=="+"){
scrollChange(100);
return false;
}
if (key=="-"){
scrollChange(-100);
return false;
}
if (key == "R"){
findReplace();
return false;
}
if (key=="1"){
setMode("VIEW");
return false;
}
if (key=="2"){
setMode("CODE");
return false;
}
if (key=="3"){
setMode("EDIT");
return false;
}
}
if (event.ctrlKey){
if ((key == "B")||(key == "I")||(key == "U")){
return false;
}
}
if(event.keyCode == 27){
try{
parent.opener.window;
parent.close();
return false;
}
catch(e){}
}
if(mSystem["EditMode"]!="VIEW")
{
if (event.keyCode==13)
{
var oSelTextRange = mEditor.document.selection.createRange();
if(mEditor.document.selection.type != "Control")
{
oSelTextRange.pasteHTML("<BR>");
event.cancelBubble = true;
event.returnValue = false;
oSelTextRange.select();
oSelTextRange.moveEnd("character", 1);
//oSelTextRange.moveStart("character", 1);
//oSelTextRange.collapse(false);
}
return false;
}
}
return true;
}
//============================================================================================================
function zPosition()
{
if(!checkMode("EDIT"))return false;
if (mEditor.document.selection.type != "Control") return;
var obj = null;
var oRange = mEditor.document.selection.createRange();
for (var i=0; i<oRange.length; i++)
{
obj = oRange.item(i);
if (obj.style.position != "absolute") {
obj.style.position="absolute";
}else{
obj.style.position="static";
}
}
}
function zIndex(action){
if(!checkMode("EDIT"))return false;
var obj = null;
if(mEditor.document.selection.type != "Control") return;
var oRange = mEditor.document.selection.createRange();
for(var i=0; i<oRange.length; i++)
{
obj = oRange.item(i);
obj.style.position="absolute";
if (action == '+'){
obj.style.zIndex += 1;
}
else{
obj.style.zIndex -= 1;
}
}
}
function findReplace(){
if(mSystem.SEV < 5.5){return _alert("0x1004");}
ShowDialog("dialog/findreplace.htm", 320, 165, false);
}
function createLink(){
if(!checkMode("EDIT"))return false;
if (mEditor.document.selection.type == "Control")
{
var oControlRange = mEditor.document.selection.createRange();
if (oControlRange(0).tagName.toUpperCase() != "IMG"){return _alert("0x1005");}
}
ShowDialog("dialog/hyperlink.htm", 350, 170, true);
}
function mapEdit(){
if(!checkMode("EDIT"))return false;
if(mSystem.SEV < 5.5){return _alert("0x1004");}
var oControlRange = mEditor.document.selection.createRange();
if (mEditor.document.selection.type != "Control" ||oControlRange(0).tagName.toUpperCase() != "IMG"){return _alert("0x1006");}
window.open("dialog/map.htm", 'mapEdit', 'toolbar=no,location=no,directories=no,status=not,menubar=no,scrollbars=no,resizable=yes,width=450,height=300');
return true;
}
function Maximize(){
try{
if(parent.opener == null || parent.opener.parent.opener == null){
var oWin = window.open("dialog/fullscreen.htm", "fs" + mSystem["LoadLnk"] , 'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,fullscreen==yes');
}
}
catch(e){}
}
function Minimize()
{
try{
if(parent.opener.window){parent.Minimize();}
}
catch(e){}
}
function ShowDialog(sURL, iWidth, iHeight ,bCheck)
{
if(bCheck && !checkMode("EDIT")){return false;}
if(mSystem["EditMode"]=="VIEW"){if(confirm(getLangText("Alert","0x1003"))){setMode("EDIT");}return false;}
mEditor.focus();
var oDialog = showModalDialog(sURL, window, "dialogWidth:" + iWidth.toString() + "px;dialogHeight:" + iHeight.toString() + "px;help:no;scroll:no;status:no");
mEditor.focus();
return oDialog;
}
function ExecCommand(bCheck,sCmd,sValue){
if(bCheck && !checkMode("EDIT"))return false;
if(mSystem["EditMode"]=="VIEW"){if(confirm(getLangText("Alert","0x1003"))){setMode("EDIT");}return false;}
mEditor.focus();
if (sValue==null){
var b = mEditor.document.execCommand(sCmd);
}
else{
var b = mEditor.document.execCommand(sCmd,"",sValue);
}
mEditor.focus();
return b;
}
function scrollChange(size)
{
if(mSystem.SEV < 5.5){return _alert("0x1004");}
var obj = mSystem["EDITORFRAME"];
var height = parseInt(obj.offsetHeight);
if((height + size)>200)obj.height = height + size;
}
function domEditorZoom(size){
try{
mEditor.document.body.runtimeStyle.zoom = size + "%";
mSystem["ZoomSize"] = size;
}
catch(e){}
}
//============================================================================================================
function setModeBtn(sMode)
{
try{
var sModeBtnName = "ModeBtn_" + sMode;
if(mSystem["LastModeBtn"]!=null){document.all[mSystem["LastModeBtn"]].className = "ModeBtnUp";}
document.all[sModeBtnName].className = "ModeBtnDown";
mSystem["LastModeBtn"] = sModeBtnName;
}
catch(e){}
}
function onBtnMouseOver()
{
var oBtn = event.srcElement.parentElement;
if(oBtn.tagName == "DIV")
{
oBtn.className = "ImgBtnUp";
event.cancelBubble=true;
}
}
function onBtnMouseOut()
{
var oBtn = event.srcElement.parentElement;
if(oBtn.tagName == "DIV")
{
oBtn.className = "ImgBtn";
event.cancelBubble=true;
}
}
function onBtnMouseDown()
{
var oBtn = event.srcElement.parentElement;
if(oBtn.tagName == "DIV")
{
oBtn.className = "ImgBtnDown";
event.cancelBubble=true;
}
}
function onBtnMouseUp()
{
var oBtn = event.srcElement.parentElement;
if(oBtn.tagName == "DIV")
{
oBtn.className = "ImgBtnUp";
event.cancelBubble=true;
}
}
function mCancelEvent(){
event.returnValue=false;
event.cancelBubble=true;
return false;
}
function InitBtn(btn){
btn.onmouseover = onBtnMouseOver;
btn.onmouseout = onBtnMouseOut;
btn.onmousedown = onBtnMouseDown;
btn.onmouseup = onBtnMouseUp;
}
function attachCancelEvent(obj)
{
obj.ondragstart = mCancelEvent;
obj.onselectstart = mCancelEvent;
obj.onselect = mCancelEvent;
}
function listToolbar()
{
var posLeft = 2, posTop = 2;
for(i=0;i<document.all.mToolbar.rows.length;i++)
{
var currRow = mToolbar.rows[i];
var currCell = currRow.firstChild;
currCell.innerHTML += " ";
attachCancelEvent(currRow);
for(j=0;j<currCell.childNodes.length;j++)
{
var currObject = currCell.childNodes[j];
switch(currObject.className)
{
case "TBHandle":
currObject.style.posLeft = posLeft;
currObject.style.posTop = posTop + 1;
posLeft += currObject.offsetWidth + 2;
break;
case "TBSep":
currObject.style.posLeft = posLeft;
currObject.style.posTop = posTop + 1;
posLeft += currObject.offsetWidth + 2;
break;
case "TBGen":
currObject.style.posLeft = posLeft;
currObject.style.posTop = posTop + 1;
posLeft += currObject.offsetWidth + 2;
break;
case "ImgBtn":
if(mSystem["LoadMode"] == "FULLSCREEN" && currObject.id == "Maximize"){document.all.Maximize.style.display="none";break}
if(mSystem["LoadMode"] != "FULLSCREEN" && currObject.id == "Minimize"){document.all.Minimize.style.display="none";break}
currObject.style.posLeft = posLeft;
currObject.style.posTop = posTop;
posLeft += currObject.offsetWidth + 2;
InitBtn(currObject);
break;
default:
if(typeof(currObject.className) != "undefined")
{
currObject.style.posLeft = posLeft;
currObject.style.posTop = posTop;
posLeft += currObject.offsetWidth + 2;
}
break;
}
}
posLeft = 2;
posTop += currCell.offsetHeight;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -