📄 edit.js
字号:
var flash_font = flashvar[13];
var flash_align = flashvar[14];
var flash_quality = flashvar[15];
var flash_scale = flashvar[16];
var string = "<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" height=\"" + flash_height + flash_height_unit + "\" width=\"" + flash_width + flash_width_unit + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" name=\"" + flash_name + "\" hspace=\"" + flash_hspace + "\" vspace=\"" + flash_hspace + "\" title=\"" + flash_title + "\" border=\"" + flash_border + "\" align=\"" + flash_align + "\">";
string += "<param name=\"_cx\" value=\"12700\">";
string += "<param name=\"_cy\" value=\"8467\">";
string += "<param name=\"FlashVars\" value=\"\">";
string += "<param name=\"Movie\" value=\"" + flash_path + "\">";
string += "<param name=\"Src\" value=\"" + flash_path + "\">";
string += "<param name=\"WMode\" value=\"Window\">";
string += "<param name=\"Play\" value=\"" + flash_autoplay +"\">";
string += "<param name=\"Loop\" value=\"" + flash_loop +"\">";
string += "<param name=\"Quality\" value=\"" + flash_quality + "\">";
string += "<param name=\"SAlign\" value=\"" + flash_align + "\">";
string += "<param name=\"Menu\" value=\"" + flash_menu + "\">";
string += "<param name=\"Base\" value=\"\">";
string += "<param name=\"AllowScriptAccess\" value=\"always\">";
string += "<param name=\"Scale\" value=\"" + flash_scale + "\">";
string += "<param name=\"DeviceFont\" value=\"" + flash_font + "\">";
string += "<param name=\"EmbedMovie\" value=\"0\">";
string += "<param name=\"BGColor\" value=\"\">";
string += "<param name=\"SWRemote\" value=\"\">";
string += "<param name=\"MovieData\" value=\"\">";
string += "<embed src=\"" + flash_path + "\" quality=\"" + flash_quality + "\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + flash_width + flash_width_unit + "\" height=\"" + flash_height + flash_height_unit + "\"></embed>";
string += "</object>";
selectedFlash.outerHTML = string;
}
}
}
function ModifyTable () {
if (isTableSelected()) {
var res = showModalDialog('edithtml/tablemod.php', selectedTable, 'dialogWidth: 360px; dialogHeight: 210px; center: yes; resizable: no; scroll: no; status: no;');
if (res){
if (res.width)
selectedTable.width = res.width;
else
selectedTable.removeAttribute('width',0);
if (res.cellPadding)
selectedTable.cellPadding = res.cellPadding;
else
selectedTable.removeAttribute('cellPadding',0);
if (res.bgColor)
selectedTable.bgColor = res.bgColor;
else
selectedTable.removeAttribute('bgColor',0);
if (res.background)
selectedTable.background = res.background;
else
selectedTable.removeAttribute('background',0);
if (res.cellSpacing)
selectedTable.cellSpacing = res.cellSpacing;
else
selectedTable.removeAttribute('cellSpacing',0);
if (res.border)
selectedTable.border = res.border;
else
selectedTable.removeAttribute('border',0);
}
}
}
function ModifyCell (){
if (isCursorInTableCell()){
res = showModalDialog('edithtml/cell.php', selectedTD, 'dialogWidth: 380px; dialogHeight: 220px; center: yes; resizable: no; scroll: no; status: no;');
if (res){
selectedTD.colSpan = res.colSpan;
selectedTD.rowSpan = res.rowSpan;
if(res.width)
selectedTD.width = res.width;
else
selectedTD.removeAttribute('width',0);
if (res.height)
selectedTD.height = res.height;
else
selectedTD.removeAttribute('height',0);
if (res.bgColor)
selectedTD.bgColor = res.bgColor;
else
selectedTD.removeAttribute('bgColor',0);
if (res.background)
selectedTD.background = res.background;
else
selectedTD.removeAttribute('background',0);
if (res.align && !res.align.match(/^None$/i))
selectedTD.align = res.align;
else
selectedTD.removeAttribute('align',0);
if (res.vAlign && !res.vAlign.match(/^None$/i))
selectedTD.vAlign = res.vAlign;
else
selectedTD.removeAttribute('vAlign',0);
}
}
}
function InsRowAbove (){
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 = " "
}
}
}
function InsRowBelow (){
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+1)
for (i = 0; i < numCols; i++){
newTD = newTR.insertCell()
newTD.innerHTML = " "
}
}
}
function InsColLeft (){
if (isCursorInTableCell()) {
moveFromEnd = (selectedTR.cells.length-1) - (selectedTD.cellIndex)
allRows = selectedTable.rows
for(i=0;i<allRows.length;i++){
rowCount = allRows[i].cells.length - 1
position = rowCount - moveFromEnd
if (position < 0)
position = 0
newCell = allRows[i].insertCell(position+1)
newCell.innerHTML = " "
}
}
}
function InsColRight (){
if (isCursorInTableCell()){
moveFromEnd = (selectedTR.cells.length-1) - (selectedTD.cellIndex)
allRows = selectedTable.rows
for (i=0;i<allRows.length;i++){
rowCount = allRows[i].cells.length - 1
position = rowCount - moveFromEnd
if (position < 0)
position = 0
newCell = allRows[i].insertCell(position)
newCell.innerHTML = " "
}
}
}
function DeleteRow(){
if(isCursorInTableCell())
selectedTable.deleteRow(selectedTR.rowIndex)
}
function DeleteCol(){
if (isCursorInTableCell()){
moveFromEnd = (selectedTR.cells.length-1) - (selectedTD.cellIndex)
allRows = selectedTable.rows
for (var i=0;i<allRows.length;i++){
endOfRow = allRows[i].cells.length - 1
position = endOfRow - moveFromEnd
if(position < 0)
position = 0
allCellsInRow = allRows[i].cells
if (allCellsInRow[position].colSpan > 1)
allCellsInRow[position].colSpan = allCellsInRow[position].colSpan - 1
else
allRows[i].deleteCell(position)
}
}
}
function Font () {
if (form.modeedit.value != "design") {
alert ("disable");
return false;
}
var str = showModalDialog ('edithtml/font.php', window, 'dialogWidth: 390px; dialogHeight: 139px; center: yes; resizable: no; scroll: no; status: no;');
//alert (str);
if (str != null) {
str = str.split("*");
if (str[0] != "") format ("FontName", str[0]);
if (str[1] != "") format ("FontSize", str[1]);
if (str[2] != "") format ("ForeColor", str[2]);
if (str[3] != "") format ("BackColor", str[3]);
}
}
function Paragraph () {
if (form.modeedit.value != "design") {
alert ("disable");
return false;
}
var str = showModalDialog ('edithtml/paragraph.htm', window, 'dialogWidth: 350px; dialogHeight: 125px; center: yes; resizable: no; scroll: no; status: no;');
if (str != null) {
str = str.split("*");
if (str[0] != "") format ("FontName", str[0]);
if (str[1] != "") format ("FontSize", str[1]);
if (str[2] != "") format ("ForeColor", str[2]);
if (str[3] != "") format ("BackColor", str[3]);
if (str[4] != "") format (str[4]);
if (str[5] != "") format (str[5]);
if (str[6] != "") format (str[6]);
if (str[7] != "") format (str[7]);
if (str[8] != "") format(str[8]);
if (str[9] != "") format(str[9]);
if (str[10] != "") format(str[10]);
if (str[11] != "") format(str[11]);
}
}
function isImageSelected() {
EditorID.focus();
selectRange();
if (RangeType == "Control") {
if (edit(0).tagName.toUpperCase() == "IMG") {
selectedImage = edit(0);
return true;
}
}
}
function isFlashSelected() {
EditorID.focus();
selectRange();
if (RangeType == "Control") {
if (edit(0).tagName.toUpperCase() == "OBJECT") {
selectedFlash = edit(0);
return true;
}
}
}
function isTableSelected(){
EditorID.focus()
selectRange();
if(RangeType == "Control"){
if(edit(0).tagName.toUpperCase() == "TABLE"){
selectedTable = edit(0);
return true;
}
}
}
function isCursorInTableCell(){
EditorID.focus();
selectRange();
if(RangeType != "Control"){
var elem = edit.parentElement();
while (elem.tagName.toUpperCase() != "TD" && elem.tagName.toUpperCase() != "TR"){
elem = elem.parentElement;
if(elem == null)
break
}
if(elem){
selectedTD = elem
selectedTR = selectedTD.parentElement
selectedTBODY = selectedTR.parentElement
selectedTable = selectedTBODY.parentElement
return true
}
}
}
function PasteEditHtml(html){
if (form.modeedit.value == "design"){
setFocus();
selectRange();
edit.pasteHTML(html);
edit.select();
setFocus();
}
}
window.onload = preliminary;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -