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

📄 editor.js

📁 YxBBs是由Y网出品的一套ASP论坛系统,拥有小巧、高速、简捷、易用等特点。在YxBBs1.X刚起步的时候经过了大量的版本测试,现在YxBBs完善了技术
💻 JS
📖 第 1 页 / 共 2 页
字号:
      }

      sel.addRange(range);
  };

function color(str){
	if(ns6){
	parent.command = str;
	if(str=="backcolor"){parent.command = "hilitecolor";};
    buttonElement = document.getElementById(str);
    document.getElementById("colorpalette").style.left = getOffsetLeft(buttonElement)+"px";
    document.getElementById("colorpalette").style.top = getOffsetTop(buttonElement) + buttonElement.offsetHeight+"px";
    document.getElementById("colorpalette").style.visibility="visible";
	}
else{
	var arr = showModalDialog("images/edit/selcolor.htm", "", "dialogWidth:18em; dialogHeight:19em; status:0;help:0;scroll:no;");
  if (arr != null) FormatText(str, arr);
  else IframeID.focus();
	}
	
	}

function FormatText(command,option){
	if(command == "createLink"){if(ns6)option = prompt("请输入网址 URL:", "http://");}
	IframeID.focus();
	IframeID.document.execCommand(command,false,option);
	}


function DoTitle(addTitle){
document.getElementById("caption").value=addTitle+document.getElementById("caption").value;
document.getElementById("caption").focus();
document.getElementById("caption").value+="";
}

function checkform(maxnum){
contentLength=IframeID.document.body.innerHTML.length;
if(contentLength<1){alert("您还没有填写内容!");IframeID.focus();return false;}
if(document.getElementById("caption").value.length<1){alert("呵呵,您忘了填写标题啦!");document.getElementById("caption").focus();return false;};
document.getElementById("sayb").disabled=true;
document.getElementById("sayb").value="正在发送"
document.getElementById("content").value=IframeID.document.body.innerHTML; 
document.getElementById("content").value=cleanHtml(); 
CopyBody();
document.say.submit()
}

function Goreset(){IframeID.document.body.innerHTML=document.say.content.value;}

function Gopreview()
{
document.preview.content.value=cleanHtml()
document.preview.caption.value=document.say.caption.value;
//openwin('preview',750,450);
document.preview.submit()
}

//---替换内容
function replace()
{
if(ns6)return false;
  var arr = showModalDialog("images/edit/replace.html", "", "dialogWidth:22em;dialogHeight:13em;status:0;help:0;scroll:no;");
	if (arr != null){
		var ss;
		ss = arr.split("*")
		a = ss[0];
		b = ss[1];
		i = ss[2];
		con = IframeID.document.body.innerHTML;
		if (i == 1)
		{
			con = Yx_rCode(con,a,b,true);
		}else{
			con = Yx_rCode(con,a,b);
		}
		IframeID.document.body.innerHTML = con;
	}
	else IframeID.focus();
}
function Yx_rCode(s,a,b,i){
	a = a.replace("?","\\?");
	if (i==null)
	{
		var r = new RegExp(a,"gi");
	}else if (i) {
		var r = new RegExp(a,"g");
	}
	else{
		var r = new RegExp(a,"gi");
	}
	return s.replace(r,b); 
}

function img(){
url=prompt("请输入图片文件地址:","http://");
if(!url || url=="http://") return;
FormatText('InsertImage',url)
}

function RealPlay(){
if(ns6){
var enter = prompt("请输入网上RealPlay播放文件的地址","http://");
if (!enter || enter=="http://")return;
Insert("[RM]"+enter+"[/RM]")
}else{	
var arr = showModalDialog("images/edit/RealPlay.htm", "", "dialogWidth:22em; dialogHeight:11em;status:0;help:0;scroll:no;");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}
}
function MediaPlayer(){
if(ns6){
var enter = prompt("请输入网上MediaPlayer文件的地址","http://");
if (!enter || enter=="http://")return;
Insert("[MP]"+enter+"[/MP]")
}else{
var arr = showModalDialog("images/edit/MediaPlayer.htm", "", "dialogWidth:22em; dialogHeight:11em; status:0;help:0;scroll:no;");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}
}

function flash(){
if(ns6){
var enter = prompt("请输入网上 Flash 文件的地址","http://");
if (!enter || enter=="http://")return;
Insert("[FLASH]"+enter+"[/FLASH]")
}else{
var arr = showModalDialog("images/edit/flash.htm", "", "dialogWidth:22em; dialogHeight:11em; status:0;help:0;scroll:no;");
if (arr != null){
IframeID.focus()
sel=IframeID.document.selection.createRange();
sel.pasteHTML(arr);
}
}
}

//投票...>>>
function SetNum(obj){
	str = '';
	if(!obj.value){
		obj.value = 1;
	}
	for(i=1;i<=obj.value;i++){
		str += '<div>选项'+i+':<input type="text" name="votes'+i+'" style="width:70%" \/><\/div>';
	}
	document.getElementById("optionid").innerHTML=str+'<input type="hidden" name="autovalue" value="'+obj.value+'" \/>';
}
//..<<

//控制文本框
function textarea_Size(num,obj)
{
	if (parseInt(obj.height)+num>=250) {
		obj.height = parseInt(obj.height) + num;	
	}
	if (num>0)
	{
		obj.width="99%";	
	}
}
function CheckLength(maxnum){alert("最大字符为 "+maxnum+ " 字节\n您的内容已有 "+IframeID.document.body.innerHTML.length+" 字节");}


function Especial(A,B){
fontbegin=A
fontend=B
fontchuli();
}
function fontchuli(){
if(ns6){
	sel=IframeID.getSelection()
	var html = IframeID.document.body.innerHTML;
	if (sel!=""){
		html = html.replace(sel,fontbegin + sel + fontend);
		IframeID.document.body.innerHTML=html}
	else
		{IframeID.document.body.innerHTML+=(fontbegin +"" +  fontend)}
	IframeID.focus()
}else{
	IframeID.focus()
	sel=IframeID.document.selection.createRange();
	if (sel.text!=""){sel.pasteHTML(fontbegin + sel.text + fontend);}
	else{sel.pasteHTML(fontbegin + "" + fontend);}
}
}
function openwin()
{document.preview.caption.value=document.yimxu.caption.value;
document.preview.content.value=document.yimxu.content.value;
var popupWin = window.open('See.Asp?Action=preview', 'preview', 'left=0,width=600,height=400,resizable=1,scrollbars=yes,menubar=no,status=yes');
document.preview.submit()
}

var y=0;function presskey(eventobject){if(event.ctrlKey && window.event.keyCode==13){y++;if (y>1) {alert('帖子正在发出,请耐心等待!');return false;}this.document.yimxu.submit();this.document.yimxu.BtnPost.disabled=true;}}

function textarea_Size1(num,obj)
{
 if (parseInt(obj.rows)+num>=5) {
  obj.rows = parseInt(obj.rows) + num; 
 }
 if (num>0)
 {
  obj.width="90%";
 }
}
function CopyBody()
{
IframeID.focus();
IframeID.document.execCommand('selectAll');
IframeID.document.execCommand('copy');
}

⌨️ 快捷键说明

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