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

📄 wind_editor.js

📁 jsp入门级代码
💻 JS
📖 第 1 页 / 共 2 页
字号:
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[rm]"+text+"[/rm]";
		AddText(AddTxt);
	} else {
		txt=prompt('URL 地址',"http://");
		if(txt!=null) {
			AddTxt="[rm]"+txt;
			AddText(AddTxt);
			AddTxt="[/rm]";
			AddText(AddTxt);
		}
	}
}

function image() {
	if (helpmode){
		alert('图片标记\n插入图片\n用法: [img]http://www.phpwind.net/image/php.gif[/img]');
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[img]"+text+"[/img]";
		AddText(AddTxt);
	} else {
		txt=prompt('URL 地址',"http://");
		if(txt!=null) {
			AddTxt="[img]"+txt;
			AddText(AddTxt);
			AddTxt="[/img]";
			AddText(AddTxt);
		}
	}
}

function wmv() {
	if (helpmode){
		alert('wmv标记\n插入wmv\n用法: [wmv]http://www.phpwind.net/wmv/php.wmv[/wmv]');
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[wmv]"+text+"[/wmv]";
		AddText(AddTxt);
	} else {
		txt=prompt('URL 地址',"http://");
		if(txt!=null) {
			AddTxt="[wmv]"+txt;
			AddText(AddTxt);
			AddTxt="[/wmv]";
			AddText(AddTxt);
		}
	}
}

function showurl() {
 	if (helpmode){
		alert('url标记\n使用url标记,可以使输入的url地址以超链接的形式在帖子中显示.\n使用方法:\n [url]url地址[/url]');
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[url="+text+"]"+text+"[/url]";
		AddText(AddTxt);
	} else {
			txt2=prompt('URL 名称: 比如 进入 phpwind 论坛(可以为空)',"");
		if (txt2!=null) {
			txt=prompt('URL 地址',"http://");
			if (txt2!=null) {
				if (txt2=="") {
					AddTxt="[url]"+txt;
					AddText(AddTxt);
					AddTxt="[/url]";
					AddText(AddTxt);
				} else {
					if(txt==""){
						AddTxt="[url]"+txt2;
						AddText(AddTxt);
						AddTxt="[/url]";
						AddText(AddTxt);
					} else{
						AddTxt="[url="+txt+"]"+txt2;
						AddText(AddTxt);
						AddTxt="[/url]";
						AddText(AddTxt);
					}
				}
			}
		}
	}
}

function showcode() {
	if (helpmode) {
		alert('代码标记\n使用代码标记,可以使你的程序代码里面的 html 等标志不会被破坏.\n使用方法:\n [code]这里是代码文字[/code]');
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[code]"+text+"[/code]";
		AddText(AddTxt);
	} else {
		txt=prompt('输入代码',"");
		if (txt!=null) { 
			AddTxt="[code]"+txt;
			AddText(AddTxt);
			AddTxt="[/code]";
			AddText(AddTxt);
		}
	}
}

function list() {
	if (helpmode) {
		alert('列表标记\n建造一个文字或则数字列表.\nUSE: [list]\n[*]item1\n[*]item2\n[*]item3\n[/list]');
	} else if (nomode) {
		AddTxt="[list][*][*][*][/list]";
		AddText(AddTxt);
	} else {
		txt=prompt('列表类型\n输入 ’a’ 表示字母列表, ’1’ 表示数字列表, 留空表示普通列表.',"");
		while ((txt!="") && (txt!="A") && (txt!="a") && (txt!="1") && (txt!=null)) {
			txt=prompt('错误!\n类型只能输入 ’a’、’A’ 、 ’1’ 或者留空.',"");
		}
		if (txt!=null) {
			if (txt==""){
				AddTxt="[list]";
			} else if (txt=="1") {
				AddTxt="[list=1]";
			} else if(txt=="a") {
				AddTxt="[list=a]";
			}
			ltxt="1";
			while ((ltxt!="") && (ltxt!=null)) {
				ltxt=prompt('列表项\n空白表示结束列表',"");
				if (ltxt!="") {
					AddTxt+="[*]"+ltxt+"";
				}
			}
			AddTxt+="[/list]";
			AddText(AddTxt);
		}
	}
}
function underline() {
  	if (helpmode) {
		alert('下划线标记\n给文字加下划线.\n用法: [u]要加下划线的文字[/u]');
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[u]"+text+"[/u]";
		AddText(AddTxt);
	} else {
		txt=prompt('下划线文字','文字');
		if (txt!=null) {
			AddTxt="[u]"+txt;
			AddText(AddTxt);
			AddTxt="[/u]";
			AddText(AddTxt);
		}
	}
}

function setswf() {
 	if (helpmode){
		alert('Flash 动画\n插入 Flash 动画.\n用法: [flash=宽度,高度]Flash 文件的地址[/flash]');
	} else if (nomode || document.selection && document.selection.type == "Text") {
		AddTxt="[flash=400,300]"+text+"[/flash]";
		AddText(AddTxt);
	} else {
			txt2=prompt('宽度,高度',"400,300");
		if (txt2!=null) {
			txt=prompt('URL 地址',"http://");
			if (txt!=null) {
				if (txt2=="") {
					AddTxt="[flash=400,300]"+txt;
					AddText(AddTxt);
					AddTxt="[/flash]";
					AddText(AddTxt);
				} else {
					AddTxt="[flash="+txt2+"]"+txt;
					AddText(AddTxt);
					AddTxt="[/flash]";
					AddText(AddTxt);
				}
			}
		}
	}
}

function add_title(addTitle)
{ 
	var revisedTitle; 
	var currentTitle = document.FORM.atc_title.value; 
	revisedTitle =addTitle+ currentTitle; 
	document.FORM.atc_title.value=revisedTitle; 
	document.FORM.atc_title.focus(); 
	return;
}
function Addaction(addTitle)
{ 
	var revisedTitle; 
	var currentTitle = document.FORM.atc_content.value; 
	revisedTitle = currentTitle+addTitle; 
	document.FORM.atc_content.value=revisedTitle; 
	document.FORM.atc_content.focus(); 
	return; 
}

function copytext(theField) 
{
	var tempval=eval("document."+theField);
	tempval.focus();
	tempval.select();
	therange=tempval.createTextRange();
	therange.execCommand("Copy");
}

function replac()
{
	if (helpmode)
	{
		alert('替换关键字');
	}
	else
	{
		txt2=prompt('请输入搜寻目标关键字',"");
		if (txt2 != null)
		{
			if (txt2 != "") 
			{
				txt=prompt('关键字替换为:',txt2);
			}
			else
			{
				replac();
			}
			var Rtext = txt2; var Itext = txt;
			Rtext = new RegExp(Rtext,"g");
			document.FORM.atc_content.value =document.FORM.atc_content.value.replace(Rtext,Itext);
		}
	}
}
function addattach(aid){
    AddTxt=' [attachment='+aid+'] ';
	AddText(AddTxt);
}
function addsmile(NewCode) {
    document.FORM.atc_content.value += ' '+NewCode+' '; 
}
cnt = 0;
function quickpost(event){
	if((event.ctrlKey && event.keyCode == 13)||(event.altKey && event.keyCode == 83))
	{
		 cnt++;
		 if(cnt==1){
			 this.document.FORM.submit();
		 }else{
			 alert('Submission Processing. Please Wait');
		 }
	}
}
function Dialog(url, action, init) {
	if (typeof init == "undefined") {
		init = window;
	}
	Dialog._geckoOpenModal(url, action, init);
};
Dialog._parentEvent = function(ev) {
	if (Dialog._modal && !Dialog._modal.closed) {
		Dialog._modal.focus();
		WYSIWYD._stopEvent(ev);
	}
};
Dialog._return = null;
Dialog._modal = null;
Dialog._arguments = null;

Dialog._geckoOpenModal = function(url, action, init) {
	var dlg = window.open(url, "hadialog",
			      "toolbar=no,menubar=no,personalbar=no,top=200,left=300,width=10,height=10," +
			      "scrollbars=no,resizable=yes");
	Dialog._modal = dlg;
	Dialog._arguments = init;
	Dialog._return = function (val) {
		if (val && action) {
			action(val);
		}
		Dialog._modal = null;
	};
};
function saletable(url) {
	Dialog(url, function(param) {
		AddText(param);
		return true;
	}, null);
}
function softtable(url){
	Dialog(url, function(param) {
		AddText(param);
		return true;
	}, null);
}

⌨️ 快捷键说明

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