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

📄 ubb.js

📁 一个不错的bbs论坛系统.对初学者很有帮助
💻 JS
字号:
helpstat = false;
stprompt = false;
basic = true;
function stringManage(strbegin,strend){
	if ((document.selection)&&(document.selection.type == "Text")) {
		var range = document.selection.createRange();
		var ch_text=range.text;
		range.text = strbegin + ch_text + strend;
	} else {
		document.forms[0].content.value=document.forms[0].content.value+strbegin+strend;
		document.forms[0].content.focus();
	}
}
function thelp(swtch){
	if (swtch == 1){
		basic = false;
		stprompt = false;
		helpstat = true;
	} else if (swtch == 0) {
		helpstat = false;
		stprompt = false;
		basic = true;
	} else if (swtch == 2) {
		helpstat = false;
		basic = false;
		stprompt = true;
	}
}
function AddText(NewCode) {
document.forms[0].content.value+=NewCode
}
function emailurl() {
var txt2, txt
	if (helpstat) {
		alert(" E_mail\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n [email]someone\@anywhere.com[/email] \n [email=someone\@anywhere.com]\u6211\u7684\u670b\u53cb[/email]");
		}
	else if (basic) {
		AddTxt="[email] [/email]";
		AddText(AddTxt);
		}
	else { 
		txt2=prompt("\u63d2\u5165\E_mail \u94fe\u63a5\u6587\u672c\u5185\u5bb9. ",""); 
		if (txt2!=null) {
			txt=prompt("E_mail \u5730\u5740.","mailto:");      
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[email]"+txt+"[/email]";
					AddText(AddTxt);
				} else {
					AddTxt="[email="+txt+"]"+txt2+"[/email]";
					AddText(AddTxt);
				}         
			} 
		}
	}
}
function showsize(size) {
	if (helpstat) {
		alert("\u5b57\u4f53\u5927\u5c0f\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n [size="+size+"]\u6211\u7684\u670b\u53cb[/size]");
	} else if (basic) {
		stringManage("[size="+size+"]","[/size]");
	} else {                       
		txt=prompt("\u6587\u5b57\u5927\u5c0f"+size,"\u4e0d\u80fd\u591f\u4e3a\u7a7a"); 
		if (txt!=null) {             
			AddTxt="[size="+size+"] "+txt+"[/size]";
			AddText(AddTxt);
		}        
	}
}

function bold() {
	if (helpstat) {
		alert("UBB\u6587\u5b57\u52a0\u7c97\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[B]\u6211\u7684\u670b\u53cb[/B]");
	} else if (basic) {
		stringManage("[B]","[/B]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a");     
		if (txt!=null) {           
			AddTxt="[B]"+txt+"[/B]";
			AddText(AddTxt);
		}       
	}
}

function italicize() {
	if (helpstat) {
		alert("UBB\u6587\u5b57\u503e\u659c\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n [I]\u6211\u7684\u670b\u53cb[/I]");
	} else if (basic) {
		stringManage("[I]","[/I]");
	} else {   
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a");
		if (txt!=null) {           
			AddTxt="[I]"+txt+"[/I]";
			AddText(AddTxt);
		}	        
	}
}
function quote() {
	if (helpstat){
		alert("UBB\u6587\u5b57\u5f15\u7528\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[quote]\u6211\u7684\u670b\u53cb[/quote]");
	} else if (basic) {
		stringManage("[quote]","[/quote]");
	} else {   
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a");  
		if(txt!=null) {          
			AddTxt="[quote]"+txt+" [/quote]";
			AddText(AddTxt);
		}	        
	}
}

function showcolor(color) {
	if (helpstat) {
		alert("UBB\u6587\u5b57\u989c\u8272\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n [color="+color+"]\u6211\u7684\u670b\u53cb[/color]");
	} else if (basic) {
		stringManage("[color="+color+"] ","[/color]");
	} else {  
     	txt=prompt("\u6587\u5b57\u989c\u8272"+color,"\u4e0d\u80fd\u591f\u4e3a\u7a7a");
		if(txt!=null) {
			AddTxt="[color="+color+"] "+txt+"[/color]";
			AddText(AddTxt);        
		} 
	}
}

function center() {
 	if (helpstat) {
		alert("UBB\u6587\u5b57\u5c45\u4e2d\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n [center]\u6211\u7684\u670b\u53cb[/center]");
	} else if (basic) {
		stringManage("[center]","[/center]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a"); 
		if (txt!=null) {          
			AddTxt="[center]"+txt+"[/center]";
			AddText(AddTxt);
		}	       
	}
}
function right() {
 	if (helpstat) {
		alert("UBB\u6587\u5b57\u5c45\u53f3\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[right]\u6211\u7684\u670b\u53cb[/right]");
	} else if (basic) {
		stringManage("[right] ","[/right]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a");     
		if (txt!=null) {          
			AddTxt="[right]"+txt+"[/right]";
			AddText(AddTxt);
		}	       
	}
}

function move() {
 	if (helpstat) {
		alert("UBB\u6587\u5b57\u79fb\u52a8\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[move]\u6211\u7684\u670b\u53cb[/move]");
	} else if (basic) {
		stringManage("[move]","[/move]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a");     
		if (txt!=null) {          
			AddTxt="[move]"+txt+"[/move]";
			AddText(AddTxt);
		}	       
	}
}
function fly() {
 	if (helpstat) {
		alert("UBB\u6587\u5b57\u98de\u884c\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[move]\u6211\u7684\u670b\u53cb[/move]");
	} else if (basic) {
		stringManage("[fly]","[/fly]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.","\u4e0d\u80fd\u591f\u4e3a\u7a7a");   
		if (txt!=null) {          
			AddTxt="[fly]"+txt+"[/fly]";
			AddText(AddTxt);
		}	       
	}
}

function hyperlink() {
	if (helpstat) {
		alert("URL\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[url]http://www.yyhweb.com[/url]\n[url=http://www.yyhweb.com]\u6b22\u8fce\u8bbf\u95ee[/url]");
	} else if (basic) {
		stringManage("[url]","[/url]");
	} else { 
		txt2=prompt("\u8bf7\u8f93\u5165\u6587\u672c\u5185\u5bb9.",""); 
		if (txt2!=null) {
			txt=prompt("\u8bf7\u8f93\u5165URL\u94fe\u63a5.","http://");   
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[url]"+txt+"[/url]";
					AddText(AddTxt);
				} else {
					AddTxt="[url="+txt+"]"+txt2+"[/url]";
					AddText(AddTxt);
				}         
			} 
		}
	}
}

function image() {
	if (helpstat){
		alert("UBB\u56fe\u7247\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[img]http://www.yyhweb.com/images/test.gif[/img]");
	} else if (basic) {
		stringManage("[img]","[/img]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165URL\u94fe\u63a5.","http://");  
		if(txt!=null) {            
			AddTxt="[img]"+txt+"[/img]";
			AddText(AddTxt);
		}	
	}
}
function flash() {
	if (helpstat){
		alert("UBBFlash\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[swf=450,350]http://www.yyhweb.com/images/test.swf[/swf]\n[swf=450,350]http://www.yyhweb.com/images/test.swf[/swf]");
	} else if (basic) {
		stringManage("[swf]","[/swf]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165SWF\u94fe\u63a5.","http://");    
		if(txt!=null) {   
			var txt2 = prompt("SWF\u6587\u4ef6\u5c5e\u6027\u8bbe\u7f6e \u957f,\u5bbd450,350 ","450,350");
			if (txt2!=null) {
				var w = txt2.substring(0, txt2.indexOf(","));
				var h = txt2.substring(txt2.indexOf(","),txt2.length);
				AddTxt="[swf=" + w + h + "]" + txt + "[/swf]";
				AddText(AddTxt);
			}
		}	
	}
}
function codes() {
	if (helpstat) {
		alert("\u4ee3\u7801\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[code]public void test(){}[/code]");
	} else if (basic) {
		stringManage("[code]","[/code]");
	} else {   
		txt=prompt("\u8bf7\u8f93\u5165URL\u94fe\u63a5.","");    
		if (txt!=null) {          
			AddTxt="[code]"+txt+"[/code]";
			AddText(AddTxt);
		}	       
	}
}

function underline() {
  	if (helpstat) {
		alert("\u4e0b\u5212\u7ebf\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[U]\u6211\u7684\u670b\u53cb[/U]");
	} else if (basic) {
		stringManage("[U]","[/U]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165URL\u94fe\u63a5.","Text");     
		if (txt!=null) {           
			AddTxt="[U]"+txt+"[/U]";
			AddText(AddTxt);
		}	        
	}
}

function real() {
  	if (helpstat) {
		alert("Real\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[rm=450,350]real\u89c6\u9891\u6587\u4ef6\u5730\u5740[/rm]");
	} else if (basic) {
		stringManage("[rm]","[/rm]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165URL\u94fe\u63a5.","http://");     
		if (txt!=null) {
			var txt2 = prompt("Real\u6587\u4ef6\u5c5e\u6027\u8bbe\u7f6e \u957f,\u5bbd450,350","450,350");
			if (txt2!=null) {
				var w = txt2.substring(0, txt2.indexOf(","));
				var h = txt2.substring(txt2.indexOf(","),txt2.length);
				AddTxt="[rm=" + w + h + "]" + txt + "[/rm]";
				AddText(AddTxt);
			}
			
		}	        
	}
}
function win() {
  	if (helpstat) {
		alert("Win\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[mp==300,80]Win\u89c6\u9891\u6587\u4ef6\u5730\u5740[/mp]");
	} else if (basic) {
		stringManage("[mp]","[/mp]");
	} else {  
		txt=prompt("\u8bf7\u8f93\u5165URL\u94fe\u63a5.","http://");     
		if (txt!=null) {       
			var txt2 = prompt("Win\u6587\u4ef6\u5c5e\u6027\u8bbe\u7f6e \u957f,\u5bbd300,80","300,80");
			if (txt2!=null) {
				var w = txt2.substring(0, txt2.indexOf(","));
				var h = txt2.substring(txt2.indexOf(","),txt2.length);
				AddTxt="[mp=" + w + h + "]" + txt + "[/mp]";
				AddText(AddTxt);
			}
		}	        
	}
}
function showfont(font) {
 	if (helpstat){
		alert("\u5b57\u4f53\u6807\u7b7e\u4f7f\u7528\u65b9\u6cd5:\n[font="+font+"]\u6211\u7684\u670b\u53cb[/font]");
	} else if (basic) {
		stringManage("[font="+font+"]","[/font]");
	} else {                  
		txt=prompt("\u5b57\u4f53\."+font,"Text");
		if (txt!=null) {             
			AddTxt="[font="+font+"]"+txt+"[/font]";
			AddText(AddTxt);
		}        
	}  
}

⌨️ 快捷键说明

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