📄 rte.js
字号:
+ "ONCHANGE='_CPopup_InsertDatabound(this)' "
+ ">"
+ "<OPTION>"
+ "- " + L_TBDATABINDING_TEXT + " -"
+ "</OPTION>"
+ "</SELECT></NOBR></SPAN>"
document.write(sz + "<img src=image/img.gif onclick=insertImg() border=0 alt=插入图片></DIV>")
}
function _drawModeSelect() {
var sz = "<TABLE CELLSPACING=0 CELLPADDING=0 ID=idMode>"
+ "<TR><TD><INPUT TYPE=checkbox ID=cbMode ONCLICK=\"setMode(!this.checked)\"></TD>"
+ "<TD><LABEL FOR=cbMode TITLE=\""+L_MODETITLE_TEXT+"\">" + L_MODETITLE_TEXT + "</LABEL>" + L_MODEDESC_TEXT+ "</TD></TR></TABLE>"
document.write(sz)
cbMode.checked = false
}
// _CState
function _CState()
{
this.selection = null
this.bMode = true
this.customButtons = false
this.css = this.bgColor = ""
this.defaultSkin = document.styleSheets.skin.cssText
this.popupSkin = document.styleSheets.popupSkin.cssText
this.aLinks = new Array()
this.szSearch = location.search.substring(1)
this.aBindings = new Array()
this.aListPopups = new Object()
this.aCache = new Object()
this.bLoaded = false
this.oPhoto = null
this.RestoreSelection = _CState_RestoreSelection
this.GetSelection = _CState_GetSelection
this.SaveSelection = _CState_SaveSelection
var I = this.szSearch.indexOf(";");
if (I >= 0)
{
this.szSharedSubDomain = this.szSearch.substring(0, I);
this.szAppServerDomain = this.szSearch.substring(I+1);
}
else
{
this.szSharedSubDomain = this.szSearch;
this.szAppServerDomain = this.szSearch;
}
}
function _CState_RestoreSelection()
{
if (this.selection) this.selection.select()
}
function _CState_GetSelection()
{
var oSel = this.selection
if (!oSel) {
oSel = idEditbox.document.selection.createRange()
oSel.type = idEditbox.document.selection.type
}
return oSel
}
function _CState_SaveSelection()
{
g_state.selection = idEditbox.document.selection.createRange()
if (!g_state.selection ||
(g_state.selection.parentElement && g_state.selection.parentElement() &&
!(g_state.selection.parentElement() == idEditbox.document.body || idEditbox.document.body.contains(g_state.selection.parentElement()))))
{
g_state.selection = idEditbox.document.body.createTextRange()
g_state.selection.collapse(false)
g_state.selection.type = "None"
}
else
{
g_state.selection.type = idEditbox.document.selection.type
}
}
// POPUP (Link, table and image popup need to be worked on)
function displayIE4PhotoPage() {
if ((g_state.oPhoto) && (!g_state.oPhoto.closed))
g_state.oPhoto.close()
g_state.oPhoto = window.open(PHOTO_URL + "?" + ((g_state.szSearch!="") ? g_state.szSearch : "") + "&" + window.parent.g_cContext.StaticContentServer,"photos","location=no,menubar=no,resizable=no,toolbar=no,width=500,height=450")
}
function _CModal_Show(szType) {
_CPopup_Hide()
if (szType=="Image") {
if (isIE4) {
setTimeout("displayIE4PhotoPage()",0)
}
else {
var rValue = showModalDialog(PHOTO_URL + "?" + ((g_state.szSearch!="") ? g_state.szSearch : "") + "&" + window.parent.g_cContext.StaticContentServer,true,"scroll:no;center:yes;help:no;")
if (rValue!="")
insertHTML(rValue)
else
setFocus()
}
}
}
function IMAGESelect(w,sHTML) {
if (sHTML!="")
insertHTML(sHTML)
window.setFocus()
}
function _CPopup_Init()
{
var sz = ""
+ "<HTML ID=popup>"
+ "<STYLE>"
+ document.styleSheets.defPopupSkin.cssText
+ "\n"
+ document.styleSheets.popupSkin.cssText
+ "</STYLE>"
+ "<BODY "
+ "ONCONTEXTMENU=\"return false\" "
+ "ONSCROLL=\"return false\" SCROLL=no TABINDEX=-1 "
+ "ONSELECTSTART=\"return event.srcElement.tagName=='INPUT'\" "
+ "><DIV ID=puRegion>"
+ "<TABLE ID=header>"
+ "<TR>"
+ "<TH NOWRAP ID=caption></TH>"
+ "<TH VALIGN=middle ALIGN=RIGHT><DIV ID=close ONCLICK=\"parent._CPopup_Hide()\">"
+ L_CLOSEBUTTON_TEXT
+ "</DIV></TH>"
+ "</TR>"
+ "</TABLE>"
+ "<DIV ALIGN=CENTER ID=content></DIV>"
+ "</DIV></BODY>"
+ "</HTML>"
idPopup.document.open("text/html","replace")
idPopup.document.write(sz)
idPopup.document.close()
}
function _CPopup_InsertDatabound(eSelect)
{
if (eSelect.selectedIndex != 0)
{
var sElemName = eSelect.options[eSelect.selectedIndex].text;
var iLen = sElemName.length
sElemName = sElemName.replace(/"/g, '"')
insertHTML('<INPUT CLASS=DataBound SIZE=' + (iLen + 2) + ' NAME="' + sElemName +'" VALUE=" ' + sElemName + ' ">')
eSelect.selectedIndex = 0;
idEditbox.focus()
}
}
function _CPopup_Hide()
{
document.all.idPopup.style.zIndex=-1
document.all.idPopup.style.visibility = "hidden"
idPopup.document._type = ""
idPopup.document.onkeydown=idPopup.document.onmouseover=idPopup.document.onclick = null
idEditbox.focus()
}
function _CPopup_Show(szType)
{
var oRenderer, szCacheKey = "PopupRenderer." + szType
if (!isIE4)
g_state.SaveSelection()
if (idPopup.document._type == szType)
_CPopup_Hide()
else
{
document.all.idPopup.style.zIndex = -1
oRenderer = g_state.aCache[szCacheKey]
if ((!oRenderer) || ("Link"==szType))
g_state.aCache[szCacheKey] = oRenderer = new _CPopupRenderer(szType)
// Force Sizing
document.all.idPopup.style.visibility = ""
document.all.idPopup.style.pixelHeight = document.all.idPopup.style.pixelWidth = idPopup.document.all.puRegion.style.pixelHeight = idPopup.document.all.puRegion.style.pixelWidth = 50
idPopup.document._type = szType
idPopup.document._renderer = oRenderer
idPopup.document.all.caption.innerText = oRenderer.GetCaption()
idPopup.document.all.content.innerHTML = oRenderer.GetHTML()
idPopup.document.onkeydown = new Function("this._renderer.OnKeyDown()")
idPopup.document.onmouseover = new Function("this._renderer.OnMouseOver()")
idPopup.document.onclick = new Function("this._renderer.OnClick()")
oRenderer.ResetContext(idPopup.document)
setTimeout("_CPopupRenderer_Display('" + szType + "')",0)
}
}
function _CPopupRenderer_Display(szType) {
var oRenderer, szCacheKey = "PopupRenderer." + szType
oRenderer = g_state.aCache[szCacheKey]
if (oRenderer.autoSize) {
// alert(idPopup.document.all.puRegion.innerHTML)
idPopup.document.all.puRegion.style.pixelHeight = document.all.idPopup.style.pixelHeight = idPopup.document.all.puRegion.offsetHeight
idPopup.document.all.puRegion.style.pixelWidth = document.all.idPopup.style.pixelWidth = idPopup.document.all.puRegion.offsetWidth + 50
document.all.idPopup.style.pixelLeft = (document.body.clientWidth - idPopup.document.all.puRegion.offsetWidth) / 2
}
else {
idPopup.document.all.puRegion.style.pixelHeight = document.all.idPopup.style.pixelHeight = document.body.clientHeight - idToolbar.offsetHeight- document.all.idMode.offsetHeight-20
idPopup.document.all.puRegion.style.pixelWidth = document.all.idPopup.style.pixelWidth = document.body.clientWidth - 50
document.all.idPopup.style.pixelLeft = 25
}
document.all.idPopup.style.zIndex=2
idPopup.focus()
}
function _CPopupRenderer(szType)
{
this.szType = szType
this.elCurrent = this.oDocument = null
this.ResetContext = _CPopupRenderer_ResetContext
this.GetCaption = _CPopupRenderer_GetCaption
this.GetHTML = _CPopupRenderer_GetHTML
this.autoSize = true
this.OnMouseOver = new Function()
this.OnKeyDown = _CListPopupRenderer_GenericOnKeyDown
switch(szType)
{
case "formatblock":
case "font":
case "fontsize":
this.OnMouseOver= _CListPopupRenderer_OnMouseOver
this.OnKeyDown = _CListPopupRenderer_OnKeyDown
case "BackColor":
case "ForeColor":
this.OnClick = _CListPopupRenderer_OnClick
this.Highlight = _CListPopupRenderer_Highlight
this.Select = _CListPopupRenderer_Select
break
default:
this.OnClick = new Function()
break
}
switch(szType)
{
case "formatblock":
this.szCaption = L_PUTITLEPARAGRAPHSTYLE_TEXT
this.PrepareHTML = _CFormatBlockPopupRenderer_PrepareHTML
this.szHTML = this.PrepareHTML()
break
case "font":
this.szCaption = L_PUTITLEFONTFACE_TEXT
this.PrepareHTML = _CFontFacesPopupRenderer_PrepareHTML
this.szHTML = this.PrepareHTML()
break
case "fontsize":
this.szCaption = L_PUTITLEFONTSIZE_TEXT
this.PrepareHTML =_CFontSizesPopupRenderer_PrepareHTML
this.szHTML = this.PrepareHTML()
break
case "Link":
this.szCaption = L_PUTITLELINK_TEXT
this.PrepareHTML = _CLinkPopupRenderer_PrepareHTML
this.szHTML = this.PrepareHTML()
break
case "Table":
this.szCaption = L_PUTITLENEWTABLE_TEXT
this.PrepareHTML = _CTablePopupRenderer_PrepareHTML
this.szHTML = this.PrepareHTML()
break
case "BackColor":
this.szCaption = L_PUTITLEBGCOLOR_TEXT
this.szHTML = "<DIV ID=ColorPopup ALIGN=CENTER>" + _CUtil_BuildColorTable("") + "</DIV>"
break
case "ForeColor":
this.szCaption = L_PUTITLETEXTCOLOR_TEXT
this.szHTML = "<DIV ID=ColorPopup ALIGN=CENTER>" + _CUtil_BuildColorTable("") + "</DIV>"
break
case "Emoticon":
this.szCaption = L_PUTITLEEMOTICON_TEXT
this.PrepareHTML = _CEmoticonRenderer_PrepareHTML
this.szHTML = this.PrepareHTML()
break
default:
this.szCaption = ""
break
}
}
function _CPopupRenderer_ResetContext(oDoc)
{
this.oDocument = oDoc
this.elCurrent = null
if (this.szType=="Table") {
var oSel = idEditbox.document.selection.createRange()
var oBlock = (oSel.parentElement != null ? _CUtil_GetElement(oSel.parentElement(),"TABLE") : _CUtil_GetElement(oSel.item(0),"TABLE"))
if (oBlock!=null) {
oDoc.all.tabEdit.className=""
oDoc.all.tabEditBodytxtPadding.value = oBlock.cellPadding
oDoc.all.tabEditBodytxtSpacing.value = oBlock.cellSpacing
oDoc.all.tabEditBodytxtBorder.value = oBlock.border
oDoc.all.tabEditBodytxtBorderColor.value = oBlock.borderColor
oDoc.all.tabEditBodytxtBackgroundImage.value = oBlock.background
oDoc.all.tabEditBodytxtBackgroundColor.value = oBlock.bgColor
}
oDoc.elCurrent = oBlock
}
}
function _CPopupRenderer_GetCaption()
{
return this.szCaption
}
function _CPopupRenderer_GetHTML()
{
return this.szHTML
}
function _CEmoticonRenderer_PrepareHTML() {
var sz = "<TABLE><TR><TD>"
var emoticonpath = '';
if (window.parent.g_cContext.StaticContentServer != '')
emoticonpath = L_EMOTICONPATH_TEXT
else
emoticonpath = L_EMOTICONPATH_TEXT
for (var i=0; i < arEmoticons.length; i++)
{
sz += "<IMG TABINDEX=" + (i+1) + " ONCLICK=\"parent._CEmoticonRenderer_Select(this)\" CLASS=emoticon SRC=\"" + emoticonpath + arEmoticons[i] + "\" WIDTH=12 HEIGHT=12 HSPACE=3 VSPACE=3>"
if ((i+1)%8==0) sz+="<BR>"
}
if (i%8!=0) sz+="<BR>"
for (var i=0; i < arBigEmoticons.length; i++)
{
sz += "<IMG TABINDEX=" + (i+arEmoticons.length) + " ONCLICK=\"parent._CEmoticonRenderer_Select(this)\" CLASS=emoticon SRC=\"" + emoticonpath + arBigEmoticons[i] + "\" WIDTH=16 HEIGHT=16 HSPACE=4 VSPACE=4>"
if ((i+1)%6==0) sz+="<BR>"
}
return sz + "</TD></TR></TABLE>"
}
function _CEmoticonRenderer_Select(elImg) {
insertHTML("<IMG SRC=\"" + elImg.src + "\" WIDTH=" + elImg.width + " HEIGHT=" + elImg.height + ">")
g_state.RestoreSelection()
_CPopup_Hide()
}
function _CFontSizesPopupRenderer_PrepareHTML()
{
var sz = "<TABLE ALIGN=center ID=idList CELLSPACING=0 CELLPADDING=0>"
for (var i=1; i <= 7; i++)
{
sz += ""
+ "<TR>"
+ "<TD NOWRAP "
+ "_item=" + i + " "
+ "ALIGN=center "
+ "STYLE=\"margin:0pt;padding:0pt\""
+ ">"
+ "<FONT SIZE=" + i + ">"
+ L_STYLESAMPLE_TEXT + "(" + i + ")"
+ "</FONT>"
+ "</TD>"
+ "</TR>"
}
sz += "</TABLE>"
return sz
}
function _CFontFacesPopupRenderer_PrepareHTML()
{
var sz = "<TABLE ALIGN=center ID=idList CELLSPACING=0 CELLPADDING=0>"
for (var i=0; i < defaultFonts.length; i++)
{
sz += ""
+ "<TR>"
+ "<TD NOWRAP "
+ "_item=" + i + " "
+ "ALIGN=center "
+ "STYLE=\"margin:0pt;padding:0pt\""
+ ">"
+ "<FONT FACE=\"" + defaultFonts[i][0] + "\">"
+ defaultFonts[i][1]
+ "</FONT>"
+ (defaultFonts[i][2] ? ("(" + defaultFonts[i][1] + ")") : "")
+ "</TD>"
+ "</TR>"
}
sz += "<TR><TD ONCLICK=\"parent._CFontFacesPopupRenderer_InsertOther(this)\" ALIGN=center _item=\"custom\" STYLE=\"margin:0pt;padding:0pt\" NOWRAP ID=customFont>" + L_CUSTOMFONT_TEXT + "</TD></TR>"
sz += "</TABLE>"
return sz
}
function _CFontFacesPopupRenderer_InsertOther() {
var szFont = prompt(L_CUSTOMFONTENTRY_TEXT,L_SAMPLEFONTENTRY_TEXT)
if ((szFont!=null) && (szFont!=""))
_Format("FontName",szFont)
_CPopup_Hide()
}
function _CFormatBlockPopupRenderer_PrepareHTML()
{
var sz, defaultParagraphs = new Array()
defaultParagraphs[0] = new Array("<P>", L_STYLENORMAL_TEXT + " (P)")
for (var i=1; i <= 6; i++)
defaultParagraphs[i] = new Array("<H"+i+">", L_STYLEHEADING_TEXT + i + " (H" + i + ")")
defaultParagraphs[7] = new Array("<PRE>", L_STYLEFORMATTED_TEXT + "(PRE)")
sz = "<TABLE CLASS=block ALIGN=center ID=idList CELLSPACING=0 CELLPADDING=0>"
for (var i=0; i < defaultParagraphs.length; i++)
{
sz += ""
+ "<TR>"
+ "<TD NOWRAP "
+ "_item=" + i + " "
+ "ALIGN=center "
+ "STYLE=\"margin:0pt;padding:0pt\""
+ ">"
+ defaultParagraphs[i][0]
+ defaultParagraphs[i][1]
+ "</" + defaultParagraphs[i][0].substring(1)
+ "</TD>"
+ "</TR>"
}
sz += "</TABLE>"
return sz
}
function _CTablePopupRenderer_PrepareHTMLPage(szID,bDisplay) {
var sz=""
+ "<TABLE height=100% " + ((!bDisplay) ? " style=\"display: none\"" : "") + " width=100% CELLSPACING=0 CELLPADDING=0 ID=" + szID + ">"
+ "<TR ID=tableContents>"
+ "<TD ID=tableOptions VALIGN=TOP NOWRAP WIDTH=150 ROWSPAN=2>"
+ "<A HREF=\"javascript:parent._CTablePopupRenderer_Select(this,'" + szID + "','prop1')\">"
+ L_TABLEROWSANDCOLS_TEXT
+ "</A>"
+ "<BR>"
+ "<A HREF=\"javascript:parent._CTablePopupRenderer_Select(this,'" + szID + "','prop2')\">"
+ L_TABLEPADDINGANDSPACING_TEXT
+ "</A>"
+ "<BR>"
+ "<A HREF=\"javascript:parent._CTablePopupRenderer_Select(this,'" + szID + "','prop3')\">"
+ L_TABLEBORDERS_TEXT
+ "</A>"
+ "<BR>"
+ "<A HREF=\"javascript:parent._CTablePopupRenderer_Select(this,'" + szID + "','prop4')\">"
+ L_TABLEBG_TEXT
+ "</A>"
+ "<BR>"
+ "</TD>"
+ "<TD BGCOLOR=black ID=puDivider ROWSPAN=2>"
+ "</TD>"
+ "<TD ID=tableProps VALIGN=TOP>"
if (szID=="tabNewBody") {
sz+= "<DIV ID='" + szID + "prop1'>"
+ "<P CLASS=tablePropsTitle>" + L_TABLEROWSANDCOLS_TEXT + "</P>"
+ "<TABLE><TR><TD>"
+ L_TABLEINPUTROWS_TEXT
+ "</TD><TD><INPUT SIZE=2 MAXLENGTH=2 TYPE=text ID=" + szID + "txtRows VALUE=2 >"
+ "</TD></TR><TR><TD>"
+ L_TABLEINPUTCOLUMNS_TEXT
+ "</TD><TD><INPUT SIZE=2 MAXLENGTH=2 TYPE=text ID=" + szID + "txtColumns VALUE=2 >"
+ "</TD></TR></TABLE></DIV>"
}
else {
sz+= "<DIV ID='" + szID + "prop1'>"
+ "<P CLASS=tablePropsTitle>" + L_TABLEROWSANDCOLS_TEXT + "</P>"
+ "<INPUT type=button ID=" + szID + "txtRows VALUE=\"" + L_TABLEINSERTROW_TEXT + "\" ONCLICK=\"parent._CTablePopupRenderer_AddRow(this)\"><P>"
+ "<INPUT type=button ID=" + szID + "txtCells VALUE=\"" + L_TABLEINSERTCELL_TEXT + "\" ONCLICK=\"parent._CTablePopupRenderer_AddCell(this)\"><BR>"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -