📄 de_functions.js
字号:
if (isTableSelected() || isCursorInTableCell())
{
if (document.getElementById("toolbarTables") != null)
{
HTMLContent = HTMLContent + eval("cmTableMenu").innerHTML
height = height + 24
}
hellohawking = false;
}
if (isCursorInTableCell())
{
if (document.getElementById("toolbarTables") != null)
{
HTMLContent = HTMLContent + eval("cmTableFunctions").innerHTML
height = height + 211
hellohawking = false;
}
}
if (document.getElementById("toolbarSpell") != null)
{
HTMLContent = HTMLContent + eval("cmSpellMenu").innerHTML
height = height + 24
hellohawking = false;
}
if(hellohawking) {
HTMLContent = HTMLContent + eval("cmInsertPageMenu").innerHTML
height = height + 49
hellohawking = false;
}
HTMLContent = HTMLContent + "</td></tr></table>"
oPopBody.innerHTML = HTMLContent
oPopup2.show(lefter + 2,topper + 2, width, height, foo.document.body)
}
function doCommand(cmd) {
if (isAllowed())
{
document.execCommand(cmd)
}
oPopup.hide()
doToolbar()
if (cmd == "AbsolutePosition")
{
foo.document.execCommand("2D-Position",false, true)
}
}
function doFont(oFont) {
if (isAllowed())
{
foo.document.execCommand('FontName',false,oFont)
}
foo.focus()
doToolbar()
}
function doSize(oSize) {
if (isAllowed())
{
foo.document.execCommand('FontSize',false,oSize)
}
foo.focus()
doToolbar()
}
function doFormat(oFormat) {
if (isAllowed())
{
foo.document.execCommand('formatBlock',false,oFormat)
}
foo.focus()
doToolbar()
}
function doZoom(size) {
foo.document.body.runtimeStyle.zoom = size + "%"
document.getElementById("zoom500_").innerHTML = " 500% ";
document.getElementById("zoom200_").innerHTML = " 200% ";
document.getElementById("zoom150_").innerHTML = " 150% ";
document.getElementById("zoom100_").innerHTML = " 100% ";
document.getElementById("zoom75_").innerHTML = " 75% ";
document.getElementById("zoom50_").innerHTML = " 50% ";
document.getElementById("zoom25_").innerHTML = " 25% ";
document.getElementById("zoom10_").innerHTML = " 10% ";
document.getElementById("zoom" + size + "_").innerHTML = " • " + size + "% ";
zoomSize = size
oPopup.hide()
}
function doTextbox() {
foo.focus()
var oSel = foo.document.selection.createRange();
oSel.pasteHTML("<table id=de_textBox style='position:absolute;'><tr><td>Text box</td></tr></table>");
textBox = foo.document.getElementById("de_textBox")
if (borderShown == "yes")
{
textBox.runtimeStyle.border = "1px dotted #BFBFBF"
allRows = textBox.rows
for (y=0; y < allRows.length; y++) {
allCellsInRow = allRows[y].cells
for (x=0; x < allCellsInRow.length; x++) {
allCellsInRow[x].runtimeStyle.border = "1px dotted #BFBFBF"
}
}
}
textBox.removeAttribute("id")
}
function isTextSelected() {
if (foo.document.selection.type == "Text") {
return true;
} else {
return false;
}
}
function doCleanCode(code) {
// removes all Class attributes on a tag eg. '<p class=asdasd>xxx</p>' returns '<p>xxx</p>'
code = code.replace(/<([\w]+) class=([^ |>]*)([^>]*)/gi, "<$1$3")
// removes all style attributes eg. '<tag style="asd asdfa aasdfasdf" something else>' returns '<tag something else>'
code = code.replace(/<([\w]+) style="([^"]*)"([^>]*)/gi, "<$1$3")
// gets rid of all xml stuff... <xml>,<\xml>,<?xml> or <\?xml>
code = code.replace(/<\\?\??xml[^>]>/gi, "")
// get rid of ugly colon tags <a:b> or </a:b>
code = code.replace(/<\/?\w+:[^>]*>/gi, "")
// removes all empty <p> tags
code = code.replace(/<p([^>])*>( )*\s*<\/p>/gi,"")
// removes all empty span tags
code = code.replace(/<span([^>])*>( )*\s*<\/span>/gi,"")
return code
}
function pasteWord() {
foo.focus()
oPopup.hide()
var oSel = foo.document.selection.createRange()
if(oSel.parentElement)
{
TempArea = document.getElementById("myTempArea")
TempArea.focus()
TempArea.document.execCommand("SelectAll")
TempArea.document.execCommand("Paste")
code = doCleanCode(TempArea.innerHTML)
oSel.pasteHTML(doCleanCode(myTempArea.innerHTML))
oSel.select()
}
}
function isAllowed() {
var sel
var obj
sel = foo.document.selection
if (sel.type != "Control")
{
obj = sel.createRange().parentElement()
} else {
obj = sel.createRange()(0)
}
if (obj.isContentEditable) {
foo.focus()
return true
} else {
return false
}
}
function scrollUp() {
foo.scrollBy(0,0);
}
var editModeOn = true;
var editModeView = true;
function editMe() {
if (editModeView == false)
{
toolbar_full.className = "bevel3";
toolbar_code.className = "hide";
toolbar_preview.className = "hide"
document.all.foo.style.display = "";
document.all.previewFrame.style.display = "none";
if (sourceModeOn)
{
SwitchMode()
}
editModeView = true;
sourceModeView = false;
previewModeView = false;
sourceModeOn = false;
editModeOn = true;
document.getElementById("editTab").src = deveditPath1 + "/de_images/status_edit_up.gif"
document.getElementById("sourceTab").src = deveditPath1 + "/de_images/status_source.gif"
document.getElementById("previewTab").src = deveditPath1 + "/de_images/status_preview.gif"
initFoo()
foo.focus()
}
}
var sourceModeOn = false;
var sourceModeView = false;
function sourceMe() {
if (sourceModeView == false)
{
if (isEditingHTMLPage == 0)
{
if (foo.document.styleSheets.length > 0)
{
myStyleSheet = foo.document.styleSheets(0).href
}
}
toolbar_full.className = "hide";
toolbar_code.className = "bevel3";
toolbar_preview.className = "hide"
document.all.foo.style.display = "";
document.all.previewFrame.style.display = "none";
if (editModeOn)
{
SwitchMode()
}
sourceModeView = true;
editModeView = false;
previewModeView = false;
editModeOn = false;
sourceModeOn = true;
document.getElementById("editTab").src = deveditPath1 + "/de_images/status_edit.gif"
document.getElementById("sourceTab").src = deveditPath1 + "/de_images/status_source_up.gif"
document.getElementById("previewTab").src = deveditPath1 + "/de_images/status_preview.gif"
// update value breaks redo / undo buffer
updateValue()
foo.focus()
}
}
var previewModeView = false;
function previewMe() {
if (previewModeView == false)
{
toolbar_full.className = "hide";
toolbar_code.className = "hide";
toolbar_preview.className = "bevel3"
document.all.foo.style.display = "none";
document.all.previewFrame.style.display = "";
sourceModeView = false;
editModeView = false;
previewModeView = true;
if (sourceModeOn) {
ShowPreview(1)
} else {
ShowPreview(0)
}
document.getElementById("editTab").src = deveditPath1 + "/de_images/status_edit.gif"
document.getElementById("sourceTab").src = deveditPath1 + "/de_images/status_source.gif"
document.getElementById("previewTab").src = deveditPath1 + "/de_images/status_preview_up.gif"
}
}
var Mode = "1";
var toggleWasOn
function SwitchMode () {
var scriptcode
if (Mode == "1") {
if (borderShown == "yes") {
toggleBorders()
toggleWasOn = "yes"
} else {
toggleWasOn = "no"
}
toolbar_full.className = "hide";
toolbar_code.className = "bevel3";
// Put HTML in editor
if (isEditingHTMLPage == "0") {
if (useXHTML == "1") {
code = getXHTML(document.frames('foo').document.body.innerHTML)
} else {
code = foo.document.body.innerHTML
}
} else {
if (useXHTML == "1") {
code = getXHTML(document.frames('foo').document.documentElement.outerHTML)
} else {
code = foo.document.documentElement.outerHTML
}
}
re = /&/g
code = code.replace(re,'&')
if (pathType == "1") {
// replaceHref = 'href="'
replaceImage = 'src="'
// code = code.replace(re2,replaceHref)
code = code.replace(re3,replaceImage)
}
code = ConvertSSLImages(code)
foo.document.body.innerText = code
foo.document.body.innerHTML = colourCode(foo.document.body.innerHTML);
// nice looking source editor
foo.document.body.runtimeStyle.fontFamily = "Verdana"
foo.document.body.runtimeStyle.fontSize = "11px"
foo.document.body.runtimeStyle.color = "#000000"
foo.document.body.runtimeStyle.bgColor = '#FFFFFF';
foo.document.body.runtimeStyle.text = '#000000';
foo.document.body.runtimeStyle.background = '';
foo.document.body.runtimeStyle.marginTop = '10px';
foo.document.body.runtimeStyle.marginLeft = '10px';
Mode = "2";
} else {
if (isEditingHTMLPage == "0") {
code = "<body>"
if (myBaseHref != "")
{
code = "<base href=" + myBaseHref + ">" + code
}
code = code + foo.document.body.innerText + "</body>"
} else
code = foo.document.body.innerText
if (myStyleSheet != "")
{
code = "<link rel='stylesheet' href='" + myStyleSheet + "' type='text/css'>" + code
}
code = RevertSSLImages(code)
foo.document.write(code);
foo.document.close()
foo.document.body.runtimeStyle.cssText = ""
toolbar_full.className = "bevel3";
toolbar_code.className = "hide";
Mode = "1";
if (toggleWasOn == "yes") {
toggleBorders()
toggleWasOn = "no"
}
}
}
function SaveHTMLPage() {
var code = ""
if (sourceModeView) {
code = foo.document.body.innerText;
}
if (editModeView || previewModeView)
{
if (isEditingHTMLPage == "0") {
if (useXHTML == "1") {
code = getXHTML(document.frames('foo').document.body.innerHTML)
} else {
code = foo.document.body.innerHTML
}
} else {
if (useXHTML == "1") {
code = getXHTML(document.frames('foo').document.documentElement.outerHTML)
} else {
code = foo.document.documentElement.outerHTML
}
}
}
re = /&/g
code = code.replace(re,'&')
if (pathType == "1")
{
// replaceHref = 'href="'
replaceImage = 'src="'
// code = code.replace(re2,replaceHref)
code = code.replace(re3,replaceImage)
}
code = ConvertSSLImages(code)
return code;
}
// convert src=https to just src=http
function ConvertSSLImages(code) {
replaceImage = 'src=\"http://' + URL
code = code.replace(re4,replaceImage)
return code;
}
function RevertSSLImages(code) {
replaceImage = 'src=\"' + HTTPStr + '://' + URL
code = code.replace(re5,replaceImage)
return code;
}
function button_over(eButton){
if (eButton.style.borderBottom != "buttonhighlight 1px solid")
{
// eButton.style.border = "ButtonShadow bevel 1px";
eButton.style.borderBottom = "ButtonShadow solid 1px";
eButton.style.borderLeft = "ButtonHighlight solid 1px";
eButton.style.borderRight = "ButtonShadow solid 1px";
eButton.style.borderTop = "ButtonHighlight solid 1px";
}
}
function button_out2(eButton){
if (eButton.style.borderBottom != "buttonhighlight 1px solid")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -