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

📄 edit.js

📁 可更新网上的一些新闻
💻 JS
📖 第 1 页 / 共 4 页
字号:
	event.cancelBubble = true;
}

function WBTB_BtnMouseOut()
{
	if (event.srcElement.tagName != "IMG") {
		event.cancelBubble = true;
		return false;
	}
	
	var image = event.srcElement;
	var element =	image.parentElement;
	yRaisedElement = null;
	
	element.className = "WBTB_Btn";
	image.className = "WBTB_Ico";
	
	event.cancelBubble = true;
}

function WBTB_BtnMouseDown()
{
	if (event.srcElement.tagName != "IMG") {
		event.cancelBubble = true;
		event.returnValue=false;
		return false;
	}
	
	var image = event.srcElement;
	var element = image.parentElement;
	
	element.className = "WBTB_BtnMouseOverDown";
	image.className = "WBTB_IcoDown";
	
	event.cancelBubble = true;
	event.returnValue=false;
	return false;
}

function WBTB_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 = "WBTB_BtnMouseOverUp";
	image.className = "WBTB_Ico";
	
	event.cancelBubble = true;
	return false;
}

function WBTB_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 "WBTB_Btn":
			if (element.YINITIALIZED == null) {
				if (! WBTB_InitBtn(element))
					return false;
			}
			
			element.style.posLeft = y.TBWidth;
			y.TBWidt += element.offsetWidth + 1;
			break;
		
		case "WBTB_BtnMenu":
			if (element.YINITIALIZED == null) {
				if (! WBTB_InitBtnMenu(element))
					return false;
			}
			
			element.style.posLeft = y.TBWidth;
			y.TBWidth += element.offsetWidth + 1;
			break;
		
		case "WBTB_TBGen":
			element.style.posLeft = y.TBWidth;
			y.TBWidth += element.offsetWidth + 1;
			break;
		
			//default:
			//  return false;
		}
	}
	
	y.TBWidth += 1;
	return true;
}

function WBTB_DebugObject(obj)
{
	var msg = "";
	for (var i in TB) {
		ans=prompt(i+"="+TB[i]+"\n");
		if (! ans) break;
	}
}


function WBTB_validateMode()
{
	if (!WBTB_bTextMode) return true;
	alert("请取消“查看HTML源代码”选项再使用系统编辑功能或者提交!");
	WBTB_Composition.focus();
	return false;
}

function WBTB_format1(what,opt)
{
	if (opt=="removeFormat")
	{
		what=opt;
		opt=null;
	}
	WBTB_Composition.focus();
	if (opt==null)
	{
		WBTB_Composition.document.execCommand(what);
	}else{
		WBTB_Composition.document.execCommand(what,"",opt);
	}
	WBTB_pureText = false;
	WBTB_Composition.focus();
}

function WBTB_format(what,opt)
{
	  if (!WBTB_validateMode()) return;
	
	  WBTB_format1(what,opt);
}

function WBTB_setMode()
{
	WBTB_bTextMode=!WBTB_bTextMode;
	WBTB_setTab();
	var cont;
	if (WBTB_bTextMode) {
		document.all.WBTB_Toolbars.style.display='none';
		WBTB_cleanHtml();
		cont=WBTB_Composition.document.body.innerHTML;
		cont=WBTB_correctUrl(cont);
		if (WBTB_filterScript)
			cont=WBTB_FilterScript(cont);
		WBTB_Composition.document.body.innerText=cont;
	} else {
		document.all.WBTB_Toolbars.style.display='';
		cont=WBTB_Composition.document.body.innerText;
		cont=WBTB_correctUrl(cont);
		if (WBTB_filterScript)
			cont=WBTB_FilterScript(cont);
		WBTB_Composition.document.body.innerHTML=cont;
	}
	WBTB_setStyle();
	WBTB_Composition.focus();
}

function WBTB_setStyle()
{
	bs = WBTB_Composition.document.body.runtimeStyle;
	//根据mode设置iframe样式表	
	if (WBTB_bTextMode) {
		bs.fontFamily="宋体,Arial";
		bs.fontSize="10pt";
	}else{
		bs.fontFamily="宋体,Arial";
		bs.fontSize="10.5pt";
	}
	bs.scrollbar3dLightColor= '#D4D0C8';
	bs.scrollbarArrowColor= '#000000';
	bs.scrollbarBaseColor= '#D4D0C8';
	bs.scrollbarDarkShadowColor= '#D4D0C8';
	bs.scrollbarFaceColor= '#D4D0C8';
	bs.scrollbarHighlightColor= '#808080';
	bs.scrollbarShadowColor= '#808080';
	bs.scrollbarTrackColor= '#D4D0C8';
	bs.border='0';
}

function WBTB_setTab()
{
	//html和design按钮的样式更改
	var mhtml=document.all.WBTB_TabHtml;
	var mdesign=document.all.WBTB_TabDesign;
	if (WBTB_bTextMode)
	{
		mhtml.className="WBTB_TabOn";
		mdesign.className="WBTB_TabOff";
	}else{
		mhtml.className="WBTB_TabOff";
		mdesign.className="WBTB_TabOn";
	}
}

function WBTB_getEl(sTag,start)
{
	while ((start!=null) && (start.tagName!=sTag)) start = start.parentElement;
	return start;
}

function WBTB_UserDialog(what)
{
	if (!WBTB_validateMode()) return;
	WBTB_Composition.focus();
	WBTB_Composition.document.execCommand(what, true);
	
	/*/去掉添加图片时的src="file://
	if(what=="InsertImage")
	{
		WBTB_Composition.document.body.innerHTML=(WBTB_Composition.document.body.innerHTML).replace("src=\"file://","src=\"");
	}
	*/
	WBTB_pureText = false;
	WBTB_Composition.focus();
}

function WBTB_foreColor()
{
	if (!WBTB_validateMode()) return;
	var arr = showModalDialog("wbTextBox/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
	if (arr != null) WBTB_format('forecolor', arr);
	else WBTB_Composition.focus();
}

function WBTB_backColor()
{
	if (!WBTB_validateMode()) return;
	var arr = showModalDialog("wbTextBox/selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
	if (arr != null) WBTB_format('backcolor', arr);
	else WBTB_Composition.focus();
}

function WBTB_img()
{
	if (!WBTB_validateMode()) return;
	showModalDialog("wbTextBox/img.html", window, "dialogWidth:22em; dialogHeight:19em; status:0; help:0; scroll:no");
	WBTB_Composition.focus();
}

function WBTB_href()
{
	if (!WBTB_validateMode()) return;
	
	showModalDialog("wbTextBox/href.html", window, "dialogWidth:17em; dialogHeight:10em; status:0; help:0; scroll:no");
	WBTB_Composition.focus();
}

function WBTB_insertTable()
{
	if (! WBTB_validateMode())	return;
	WBTB_Composition.focus();
	var range = WBTB_Composition.document.selection.createRange();
	var arr = showModalDialog("wbTextBox/inserttable.html", "", "dialogWidth:20em;dialogHeight:18em;help: no; scroll: no; status: no");
	
	if (arr != null){
	range.pasteHTML(arr);
	}
	WBTB_Composition.focus();
}

function WBTB_tableProp(){
	var tableflag=false;
	WBTB_Composition.focus();
	var xsel=WBTB_Composition.document.selection;
	var xobj=WBTB_Composition.document.selection.createRange();
	if(xsel.type=="None"||xsel.type=="Text"){
		xsel=xobj.parentElement();
		while(xsel.tagName!="BODY"&&tableflag==false){
			if(xsel.tagName=="TABLE"){tableflag=true;}
			if(tableflag==false){xsel=xsel.parentElement;}
		}
	}else if(xsel.type=="Control"){
		xsel=xobj.item(0);
		if(xsel.tagName=="TABLE"){
			tableflag=true;
		}else{
			while(xsel.tagName!="BODY"&&tableflag==false){
				if(xsel.tagName=="TABLE"){tableflag=true;}
				if(tableflag==false){xsel=xsel.parentElement;}
			}
		}
	}
	if(tableflag==true){
		if(xsel.className!=""&&xsel.className!=null){tableclass=xsel.className;}else{tableclass="";}
		if(xsel.width!=""&&xsel.width!=null){tablewidthspecified="yes";tablewidth=xsel.width;}else{tablewidthspecified="no";tablewith="";}
		if(xsel.align!=""&&xsel.align!=null){tablealign=xsel.align;}else{tablealign="";}
		if(xsel.border!=""&&xsel.border!=null){tablebordersize=xsel.border;}else{tablebordersize="";}
		if(xsel.cellPadding!=""&&xsel.cellPadding!=null){tablecellpadding=xsel.cellPadding;}else{tablecellpadding="";}
		if(xsel.cellSpacing!=""&&xsel.cellSpacing!=null){tablecellspacing=xsel.cellSpacing;}else{tablecellspacing="";}
		if(xsel.borderColor!=""&&xsel.borderColor!=null){tablebordercolor=xsel.borderColor;}else{tablebordercolor="";}
		if(xsel.bgColor!=""&&xsel.bgColor!=null){tablebackgroundcolor=xsel.bgColor;}else{tablebackgroundcolor="";}
		tableiscancel="";
		window.showModalDialog("wbTextBox/tableprops.html",window," dialogWidth: 20em; dialogHeight: 16em; help: no;scroll: no; status: no");
		if(tableiscancel=="no"){
			if(tablewidthspecified=="yes"){
				var tw1="";
				if(tablewidthtype=="percentage"){
					tw1=tablewidth+"%";
				}else{
					tw1=tablewidth;
				}
				xsel.width=tw1;
			}else{
				xsel.removeAttribute("width",0);
			}
			if(tablealign!=""&&tablealign!="Default"){xsel.align=tablealign;}else{xsel.removeAttribute("align",0);}
			if(tableclass!=""&&tableclass!="Default"){xsel.className=tableclass;}else{xsel.removeAttribute("className",0);}
			if(tablebordersize!=""&&tablebordersize!=null){xsel.border=tablebordersize;}else{xsel.removeAttribute("border",0);}
			if(tablecellpadding!=""&&tablecellpadding!=null){xsel.cellPadding=tablecellpadding;}else{xsel.removeAttribute("cellPadding",0);}
			if(tablecellspacing!=""&&tablecellspacing!=null){xsel.cellSpacing=tablecellspacing;}else{xsel.removeAttribute("cellSpacing",0);}
			if(tablebordercolor!=""&&tablebordercolor!="Default"){xsel.borderColor=tablebordercolor;}else{xsel.removeAttribute("borderColor",0);}
			if(tablebackgroundcolor!=""&&tablebackgroundcolor!="Default"){xsel.bgColor=tablebackgroundcolor;}else{xsel.removeAttribute("bgColor",0);}
		}
	}
}

function WBTB_cellProp(){
	var cellflag=false;
	WBTB_Composition.focus();
	var xsel=WBTB_Composition.document.selection;
	var xobj=WBTB_Composition.document.selection.createRange();
	if(xsel.type=="None"||xsel.type=="Text"){
		xsel=xobj.parentElement();
		while(xsel.tagName!="BODY"&&cellflag==false){
			if(xsel.tagName=="TD"){cellflag=true;}
			if(cellflag==false){xsel=xsel.parentElement;}
		}
	}else if(xsel.type=="Control"){
		xsel=xobj.item(0);
		if(xsel.tagName=="TD"){
			cellflag=true;
		}else{
			while(xsel.tagName!="BODY"&&cellflag==false){
				if(xsel.tagName=="TD"){cellflag=true;}
				if(cellflag==false){xsel=xsel.parentElement;}
			}
		}
	}
	if(cellflag==true){
		if(xsel.width!=""&&xsel.width!=null){tablewidthspecified="yes";tablewidth=xsel.width;}else{tablewidthspecified="no";tablewith="";}
		if(xsel.align!=""&&xsel.align!=null){tablealign=xsel.align;}else{tablealign="";}
		if(xsel.className!=""&&xsel.className!=null){tablecellclass=xsel.className;}else{tablecellclass="";}
		if(xsel.vAlign!=""&&xsel.vAlign!=null){tablevalign=xsel.vAlign;}else{tablevalign="";}
		if(xsel.borderColor!=""&&xsel.borderColor!=null){tablebordercolor=xsel.borderColor;}else{tablebordercolor="";}

⌨️ 快捷键说明

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