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

📄 editor.js

📁 hudong维客系统
💻 JS
字号:
var pb_blnCloseWindow = false;var pb_strConfirmCloseMessage ="您真的要离开本页吗?";var notSavedYet = "您的条目还没被保存,要放弃它们吗?";var pb_msg="是否放弃对该条目的创建?";var pb_url="doc.php?action=createdoc";var pb_state=1; //1创建条目 2编辑条目function initEditor() {	editor = new HTMLArea(document.form2.content);	editor.generate();}function ConfirmClose() {	window.event.returnValue = pb_strConfirmCloseMessage;	pb_blnCloseWindow = true;}function ShowConfirmClose() {	if(confirm(pb_msg)){		window.location = pb_url;	}}window.onbeforeunload =function(e){	if(document.body.clientWidth-event.clientX< 170&&event.clientY< 0||event.altKey){		return notSave(e);	}}var tagdiv=document.getElementById("tagdiv");function addTag() {	if(tagdiv.childNodes.length>=40)	{		alert("标签最多只允许填写20个!");		return ;	}	tagdiv.innerHTML= tagdiv.innerHTML+'<input class="button35" type="text" name="tag[]" size="8" style="height:12px"><a href="javascript:void(0)" onclick="removeTag(this)" class="bg12" title="删除">[X]</a>';}function removeTag(obj){	if(tagdiv.childNodes.length<=4)	{		alert("您至少需要填写两个标签!");		return ;	}	if(confirm("确认删除标签:"+obj.previousSibling.value+"?"))	{		tagdiv.removeChild(obj.previousSibling);		tagdiv.removeChild(obj);	}}function initTag(){	if(tagdiv==null)return ;	while(tagdiv.childNodes.length<16)	{		addTag();	}}function check2tag(){	if(tagdiv==null)return true;	var tags=document.getElementsByName("tag[]");	var tagnum=0;	for(i=0;i<tags.length;i++){		tag=tags[i].value.Trim();		if(tag=="")continue;		if(tag.indexOf(";")!=-1){			alert("标签中不能含有分号“;”!");			tags[i].focus();			return false;		}		if(tag.length>0){			for(k=0;k<i;k++){				if (tag.toLowerCase() == tags[k].value.Trim().toLowerCase()){					alert("该标签已经存在,请重新输入!");					tags[i].focus();					return false;				}			}		}		tagnum++;	}	if(tagnum<2)	{		alert("您至少需要填写两个标签!");		return false;	}	return true;}function mySubmit() {	if(editor.getHTML()=="" || editor.getHTML()=="<p />"){		alert("请输入条目内容再保存!");		return false;	}	if(pb_state==2){		if(document.getElementById("edit_reason").value.length>80){			alert("条目修改原因过长!");			document.getElementById("edit_reason").focus();			return false;		}	}	if(!check2tag())return false;	document.form2.ta.readonly=true;	document.form2.target="_self";	document.form2.onsubmit();	document.form2.submit();}function myPreview() {	document.form2.onsubmit();	window.open('editor/popups/preview.html');}function refreshLock(){	title=document.form2.title.value;	createXMLHttpRequest();	var url = "lock.php?action=lock&title="+encodeURI(title);	xmlHttp.open("GET",url,true);	xmlHttp.onreadystatechange =callback;	xmlHttp.send(null);}function callback(){	if (xmlHttp.readyState == 4) {		if (xmlHttp.status == 200) {			setTimeout("refreshLock()",60000);		}	}}initEditor();initTag();if(pb_state==2){	refreshLock();}

⌨️ 快捷键说明

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