⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor.js

📁 很经典的Blog程序,呵呵
💻 JS
📖 第 1 页 / 共 5 页
字号:

    //Add security='restricted' =>
    //Your current security settings prohibit running ActiveX controls on this page.
    //As a result, the page may not display correctly.
    sHTML+="<iframe style='width:100%;height:100%; margin-top:1px;border:solid 1px #cfcfcf' "+
            " name=idContent"+ this.oName + " id=idContent"+this.oName+ "></iframe>";

	document.write("<iframe style='width:1px;height:1px;overflow:auto;border:0px' id=\"myStyle"+this.oName+"\" name=\"myStyle"+this.oName+"\" src='"+this.scriptPath+"blank.gif'></iframe>");

	sHTML+="</td><td id=idStyles"+this.oName+" style='padding:0px;background:#E9E8F2'></td></tr></table>"//StyleSelect

    sHTML+="</td></tr>";
    sHTML+="<tr id=idTagSelBottomRow"+this.oName+"><td colspan=2 id=idTagSelBottom"+this.oName+" style='padding:0px;'></td></tr>";
    sHTML+="</table>";

    sHTML+=sHTMLDropMenus;//dropdown
    
    sHTML+="<input type=submit name=iwe_btnSubmit"+this.oName+" id=iwe_btnSubmit"+this.oName+" value=SUBMIT style='display:none' >";//hidden submit button

	document.getElementById("loadedit").innerHTML=sHTML;
    //document.write(sHTML);

    //Render Color Picker (forecolor)
    this.oColor1.url=this.scriptPath+"color_picker_fg.htm";
    this.oColor1.onShow = new Function(this.oName+".hide()");
    this.oColor1.onMoreColor = new Function(this.oName+".hide()");
    this.oColor1.onPickColor = new Function(this.oName+".applyColor('ForeColor', "+this.oName+".oColor1.color)");
    this.oColor1.onRemoveColor = new Function(this.oName+".applyColor('ForeColor','')");
    this.oColor1.txtCustomColors=getTxt("Custom Colors");
    this.oColor1.txtMoreColors=getTxt("More Colors...");
    this.oColor1.RENDER();
    
    //Render Color Picker (backcolor)
    this.oColor2.url=this.scriptPath+"color_picker_bg.htm";
    this.oColor2.onShow = new Function(this.oName+".hide()");
    this.oColor2.onMoreColor = new Function(this.oName+".hide()");
    this.oColor2.onPickColor = new Function(this.oName+".applyColor('hilitecolor', "+this.oName+".oColor2.color)");
    this.oColor2.onRemoveColor = new Function(this.oName+".applyColor('HiliteColor','')");
    this.oColor2.txtCustomColors=getTxt("Custom Colors");
    this.oColor2.txtMoreColors=getTxt("More Colors...");
    this.oColor2.RENDER();

    if(this.useTagSelector)
        {
        if(this.TagSelectorPosition=="bottom")this.TagSelectorPosition="top";
        else this.TagSelectorPosition="bottom";
        this.moveTagSelector()
        }
    
    var oEditor = document.getElementById("idContent"+this.oName).contentWindow;
    try { oEditor.document.designMode="on"; } catch (e) {}

    oUtil.oName=this.oName;//default active editor
    oUtil.oEditor=oEditor;
    oUtil.obj=this;

    oUtil.arrEditor.push(this.oName);

    var arrA = String(this.preloadHTML).match(/<HTML[^>]*>/ig);
    if(arrA)
        {//full html
        //this.putHTML(this.preloadHTML);
        this.loadHTMLFull(this.preloadHTML);
        }
    else
        {
        this.loadHTML(sPreloadHTML);
        }
	
	/***** Replace current body onload ******/
	if(!oUtil.bOnLoadReplaced)
		{
		if(window.onload)onload_original=window.onload;
		window.onload = new Function("onload_new()");
		oUtil.bOnLoadReplaced=true;
		}
	/****************************************/
    
    this.focus();

	if(this.btnTable)
		{
		this.arrElm[0]=this.getElm("btnTableEdit");
		this.arrElm[1]=this.getElm("mnuTableSize");
		this.arrElm[2]=this.getElm("mnuTableEdit");
		this.arrElm[3]=this.getElm("mnuCellEdit");
		}
	if(this.btnParagraph)this.arrElm[4]=this.getElm("btnParagraph");
	if(this.btnFontName)this.arrElm[5]=this.getElm("btnFontName");
	if(this.btnFontSize)this.arrElm[6]=this.getElm("btnFontSize");
	//if(this.btnCut)this.arrElm[7]=this.getElm("btnCut");
	//if(this.btnCopy)this.arrElm[8]=this.getElm("btnCopy");
	//if(this.btnPaste)this.arrElm[9]=this.getElm("btnPaste");
	//if(this.btnPasteWord)this.arrElm[10]=this.getElm("btnPasteWord");
	//if(this.btnPasteText)this.arrElm[11]=this.getElm("btnPasteText");
	if(this.btnUndo)this.arrElm[12]=this.getElm("btnUndo");
	if(this.btnRedo)this.arrElm[13]=this.getElm("btnRedo");
	if(this.btnBold)this.arrElm[14]=this.getElm("btnBold");
	if(this.btnItalic)this.arrElm[15]=this.getElm("btnItalic");
	if(this.btnUnderline)this.arrElm[16]=this.getElm("btnUnderline");
	if(this.btnStrikethrough)this.arrElm[17]=this.getElm("btnStrikethrough");
	if(this.btnSuperscript)this.arrElm[18]=this.getElm("btnSuperscript");
	if(this.btnSubscript)this.arrElm[19]=this.getElm("btnSubscript");
	if(this.btnNumbering)this.arrElm[20]=this.getElm("btnNumbering");
	if(this.btnBullets)this.arrElm[21]=this.getElm("btnBullets");
	if(this.btnJustifyLeft)this.arrElm[22]=this.getElm("btnJustifyLeft");
	if(this.btnJustifyCenter)this.arrElm[23]=this.getElm("btnJustifyCenter");
	if(this.btnJustifyRight)this.arrElm[24]=this.getElm("btnJustifyRight");
	if(this.btnJustifyFull)this.arrElm[25]=this.getElm("btnJustifyFull");
	if(this.btnIndent)this.arrElm[26]=this.getElm("btnIndent");
	if(this.btnOutdent)this.arrElm[27]=this.getElm("btnOutdent");
	if(this.btnLTR)this.arrElm[28]=this.getElm("btnLTR");
	if(this.btnRTL)this.arrElm[29]=this.getElm("btnRTL");
	if(this.btnForeColor)this.arrElm[30]=this.getElm("btnForeColor");
	if(this.btnBackColor)this.arrElm[31]=this.getElm("btnBackColor");
	if(this.btnLine)this.arrElm[32]=this.getElm("btnLine");
    }

function iwe_getElm(s)
	{
	return document.getElementById(s+this.oName)
	}

/*** Replace current body onload ***/
function onload_new()
	{	
	onload_original();	
	//alert("setEdit here");
	oUtil.setEdit();
	}
function onload_original()
	{
	}

/*** Color Picker Object ***/
var arrColorPickerObjects=[];
function ColorPicker(sName,sParent)
    {
    this.oParent=sParent;
    if(sParent)
        {
        this.oName=sParent+"."+sName;
        this.oRenderName=sName+sParent;
        }
    else
        {
        this.oName=sName;
        this.oRenderName=sName;
        }
    arrColorPickerObjects.push(this.oName);

    this.url="color_picker.htm";
    this.onShow=function(){return true;};
    this.onHide=function(){return true;};
    this.onPickColor=function(){return true;};
    this.onRemoveColor=function(){return true;};
    this.onMoreColor=function(){return true;};  
    this.show=showColorPicker;
    this.hide=hideColorPicker;
    this.hideAll=hideColorPickerAll;
    this.color;
    this.customColors=[];
    this.refreshCustomColor=refreshCustomColor;
    this.isActive=false;
    this.txtCustomColors="Custom Colors";
    this.txtMoreColors="More Colors...";
    this.align="left";
    this.currColor="#ffffff";//default current color
    this.RENDER=drawColorPicker;
    }    
function drawColorPicker()
    {   
    var arrColors=[["#800000","#8b4513","#006400","#2f4f4f","#000080","#4b0082","#800080","#000000"],
                ["#ff0000","#daa520","#6b8e23","#708090","#0000cd","#483d8b","#c71585","#696969"],
                ["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"],
                ["#ff6347","#ffd700","#32cd32","#87ceeb","#00bfff","#9370db","#ff69b4","#dcdcdc"],
                ["#ffdab9","#ffffe0","#98fb98","#e0ffff","#87cefa","#e6e6fa","#dda0dd","#ffffff"]];
    var sHTMLColor="<table id=dropColor"+this.oRenderName+" style=\"z-index:1;display:none;position:absolute;border:#9b95a6 1px solid;cursor:default;background-color:#E9E8F2;padding:2px\" unselectable=on cellpadding=0 cellspacing=0 width=145px><tr><td unselectable=on style='padding:0px;'>";
    sHTMLColor+="<table align=center cellpadding=0 cellspacing=0 border=0 unselectable=on>";
    for(var i=0;i<arrColors.length;i++)
        {
        sHTMLColor+="<tr>";
        for(var j=0;j<arrColors[i].length;j++)
            sHTMLColor+="<td onclick=\""+this.oName+".color='"+arrColors[i][j]+"';"+this.oName+".onPickColor();"+this.oName+".currColor='"+arrColors[i][j]+"';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#E9E8F2 1px solid'\" style=\"padding:0px;cursor:default;padding:1px;border:#E9E8F2 1px solid;\" unselectable=on>"+
                "<table style='margin:0px;width:13px;height:13px;background:"+arrColors[i][j]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
                "<tr><td unselectable=on style='padding:0px;'></td></tr>"+
                "</table></td>";
        sHTMLColor+="</tr>";        
        }
    
    //~~~ custom colors ~~~~
    sHTMLColor+="<tr><td colspan=8 id=idCustomColor"+this.oRenderName+" style='padding:0px;'></td></tr>";
    
    //~~~ remove color & more colors ~~~~
    sHTMLColor+= "<tr>";
    sHTMLColor+= "<td unselectable=on style='padding:0px;'>"+
        "<table style='padding:0px;margin-left:1px;width:14px;height:14px;background:#E9E8F2;' cellpadding=0 cellspacing=0 unselectable=on>"+
        "<tr><td onclick=\""+this.oName+".onRemoveColor();"+this.oName+".currColor='';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='white 1px solid'\" style=\"cursor:default;padding:1px;border:white 1px solid;font-family:verdana;font-size:10px;font-color:black;line-height:9px;\" align=center valign=top unselectable=on>x</td></tr>"+
        "</table></td>";
    sHTMLColor+= "<td colspan=7 unselectable=on style='padding:0px;'>"+
        "<table style='padding:0px;margin:1px;width:117px;height:16px;background:#E9E8F2;border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
        "<tr><td id=\""+this.oName+"moreColTd\" onclick=\""+this.oName+".onMoreColor();"+this.oName+".hideAll();modalDialogShow('"+this.url+"?" +this.oName+ "', 442, 380)\" onmouseover=\"this.style.border='#777777 1px solid';this.style.background='#8d9aa7';this.style.color='#ffffff'\" onmouseout=\"this.style.border='#E9E8F2 1px solid';this.style.background='#E9E8F2';this.style.color='#000000'\" style=\"cursor:default;font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1px\" align=center valign=top nowrap unselectable=on>"+this.txtMoreColors+"</td></tr>"+
        "</table></td>";
    sHTMLColor+= "</tr>";
    
    sHTMLColor+= "</table>";            
    sHTMLColor+="</td></tr></table>";
    document.write(sHTMLColor);
    }    
function refreshCustomColor()
    {
    this.customColors=eval(this.oParent).customColors;//[CUSTOM] (Get from public definition)
    
    if(this.customColors.length==0)
        {
        document.getElementById("idCustomColor"+this.oRenderName).innerHTML="";
        return;
        }
    sHTML="<table cellpadding=0 cellspacing=0 width=100%><tr><td colspan=8 style=\"font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1px\">"+this.txtCustomColors+":</td></tr></table>";
    sHTML+="<table cellpadding=0 cellspacing=0><tr>";   
    for(var i=0;i<this.customColors.length;i++)
        {
        if(i<22)
            {
            if(i==8||i==16||i==24||i==32)sHTML+="</tr></table><table cellpadding=0 cellspacing=0><tr>"  
            sHTML+="<td onclick=\""+this.oName+".color='"+this.customColors[i]+"';"+this.oName+".onPickColor()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#E9E8F2 1px solid'\" style=\"cursor:default;padding:1px;border:#E9E8F2 1px solid;\" unselectable=on>"+
                "   <table  style='margin:0px;width:13px;height:13px;background:"+this.customColors[i]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
                "   <tr><td unselectable=on></td></tr>"+
                "   </table>"+
                "</td>";
            }           
        }
    sHTML+="</tr></table>";
    document.getElementById("idCustomColor"+this.oRenderName).innerHTML=sHTML;
    }    
function showColorPicker(oEl)
    {
    this.onShow();
    
    this.hideAll();

    var box=document.getElementById("dropColor"+this.oRenderName);

    //remove hilite
    var allTds = box.getElementsByTagName("TD");
    for 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -