📄 editor.asp
字号:
BtnMenu.ondragstart = YCancelEvent;
BtnMenu.onselectstart = YCancelEvent;
BtnMenu.onselect = YCancelEvent;
BtnMenu.YUSERONCLICK = BtnMenu.onclick;
BtnMenu.onclick = YCancelEvent;
BtnMenu.YINITIALIZED = true;
return true;
}
function InitTB(y){
if (!document.all){
setTimeout("InitTB("+ y +")",1000);
return;
}
y.TBWidth = 0;
if (! PopulateTB(y)) return false;
y.style.posWidth = y.TBWidth;
return true;
}
function YCancelEvent(){
event.returnValue=false;
event.cancelBubble=true;
return false;
}
function PopulateTB(y){
var i, elements, element;
elements = y.children;
for (i=0; i<elements.length; i++) {
element = elements[i];
if (element.tagName == 'SCRIPT' || element.tagName == '!') continue;
switch (element.className) {
case 'Btn':
if (element.YINITIALIZED == null) {
if (! InitBtn(element))
return false;
}
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;
case 'BtnMenu':
if (element.YINITIALIZED == null) {
if (! InitBtnMenu(element))
return false;
}
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;
case 'TBGen':
element.style.posLeft = y.TBWidth;
y.TBWidth += element.offsetWidth + 1;
break;
case 'TBSep':
element.style.posLeft = y.TBWidth + 2;
y.TBWidth += SEP_PADDING;
break;
case 'TBHandle':
element.style.posLeft = 2;
y.TBWidth += element.offsetWidth + HANDLE_PADDING;
break;
default:
return false;
}
}
y.TBWidth += 1;
return true;
}
function TemplateTBs(){
NumTBs = yToolbars.length;
if (NumTBs == 0) return;
var i;
var ScrWid = (document.body.offsetWidth) - 6;
var TotalLen = ScrWid;
for (i = 0 ; i < NumTBs ; i++) {
TB = yToolbars[i];
if (TB.TBWidth > TotalLen) TotalLen = TB.TBWidth;
}
var PrevTB;
var LastStart = 0;
var RelTop = 0;
var LastWid, CurrWid;
var TB = yToolbars[0];
TB.style.posTop = 0;
TB.style.posLeft = 0;
var Start = TB.TBWidth;
for (i = 1 ; i < yToolbars.length ; i++) {
PrevTB = TB;
TB = yToolbars[i];
CurrWid = TB.TBWidth;
if ((Start + CurrWid) > ScrWid) {
Start = 0;
LastWid = TotalLen - LastStart;
}else {
LastWid =PrevTB.TBWidth;
RelTop -=TB.offsetHeight;
}
TB.style.posTop = RelTop;
TB.style.posLeft = Start;
PrevTB.style.width = LastWid;
LastStart = Start;
Start += CurrWid;
}
TB.style.width = TotalLen - LastStart;
i--;
TB = yToolbars[i];
var TBInd = TB.sourceIndex;
var A = TB.document.all;
var item;
for (i in A) {
item = A.item(i);
if (! item) continue;
if (! item.style) continue;
if (item.sourceIndex <= TBInd) continue;
if (item.style.position == 'absolute') continue;
item.style.posTop = RelTop;
}
}
function DoTemplate(){
TemplateTBs();
}
function BtnMouseOver(){
if (event.srcElement.tagName != 'IMG') return false;
var image = event.srcElement;
var element = image.parentElement;
if (image.className == 'Ico') element.className = 'BtnMouseOverUp';
else if (image.className == 'IcoDown') element.className = 'BtnMouseOverDown';
event.cancelBubble = true;
}
function BtnMouseOut(){
if (event.srcElement.tagName != 'IMG') {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
yRaisedElement = null;
element.className = 'Btn';
image.className = 'Ico';
event.cancelBubble = true;
}
function BtnMouseDown(){
if (event.srcElement.tagName != 'IMG') {
event.cancelBubble = true;
event.returnValue=false;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
element.className = 'BtnMouseOverDown';
image.className = 'IcoDown';
event.cancelBubble = true;
event.returnValue=false;
return false;
}
function BtnMouseUp(){
if (event.srcElement.tagName != 'IMG') {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + 'anonymous()');
element.className = 'BtnMouseOverUp';
image.className = 'Ico';
event.cancelBubble = true;
return false;
}
function BtnMenuMouseOver(){
if (event.srcElement.tagName != 'IMG') return false;
var image = event.srcElement;
var element = image.parentElement;
if (image.className == 'Ico') element.className = 'BtnMenuMouseOverUp';
else if (image.className == 'IcoDown') element.className = 'BtnMenuMouseOverDown';
event.cancelBubble = true;
}
function BtnMenuMouseOut(){
if (event.srcElement.tagName != 'IMG') {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
yRaisedElement = null;
element.className = 'BtnMenu';
image.className = 'Ico';
event.cancelBubble = true;
}
function BtnMenuMouseDown(){
if (event.srcElement.tagName != 'IMG') {
event.cancelBubble = true;
event.returnValue=false;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
element.className = 'BtnMenuMouseOverDown';
image.className = 'IcoDown';
event.cancelBubble = true;
event.returnValue=false;
return false;
}
function BtnMenuMouseUp(){
if (event.srcElement.tagName != 'IMG') {
event.cancelBubble = true;
return false;
}
var image = event.srcElement;
var element = image.parentElement;
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + 'anonymous()');
element.className = 'BtnMenuMouseOverUp';
image.className = 'Ico';
event.cancelBubble = true;
return false;
}
// 系统初试化 和系统运用 函数组结速
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 表格处理定义函数组开始
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 表格相关全局变量
var selectedTD
var selectedTR
var selectedTBODY
var selectedTable
// 显示隐藏表格
var borderShown = "yes"
// 插入表格
function TableInsert(){
if (!isTableSelected()){
ShowDialog('Editor/editor_table.asp', 350, 410, true);
}
}
// 修改表格属性
function TableProp(){
if (isTableSelected()||isCursorInTableCell()){
ShowDialog('Editor/editor_table.asp?action=modify', 350, 410, true);
}
}
// 修改单元格属性
function TableCellProp(){
if (isCursorInTableCell()){
ShowDialog('Editor/editor_tablecell.asp', 350, 310, true);
}
}
// 拆分单元格
function TableCellSplit(){
if (isCursorInTableCell()){
ShowDialog('Editor/editor_tablecellsplit.asp', 200, 150, true);
}
}
// 修改表格行属性
function TableRowProp(){
if (isCursorInTableCell()){
ShowDialog('Editor/editor_tablecell.asp?action=row', 350, 310, true);
}
}
// 插入行(在上方)
function TableRowInsertAbove() {
if (isCursorInTableCell()){
var numCols = 0
allCells = selectedTR.cells
for (var i=0;i<allCells.length;i++) {
numCols = numCols + allCells[i].getAttribute('colSpan')
}
var newTR = selectedTable.insertRow(selectedTR.rowIndex)
for (i = 0; i < numCols; i++) {
newTD = newTR.insertCell()
newTD.innerHTML = " "
if (borderShown == "yes") {
newTD.runtimeStyle.border = "1px dotted #330000"
}
}
}
}
// 插入行(在下方)
function TableRowInsertBelow() {
if (isCursorInTableCell()){
var numCols = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -