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

📄 post.js

📁 wince 电池电源管理文件集 wince 电池电源管理文件集
💻 JS
📖 第 1 页 / 共 2 页
字号:

function class_post()
{
	this.myTextControl = null;
	this.PollItemLength = 0;
	this.PollItems = new class_datalist;
	this.PollIDs = new class_datalist;
	this.getXY = null;
	this.FixedZero = null;

	var colorshtml = "";

	var agt = "is msie";
	if ( navigator != null )
	{
		agt = navigator.userAgent.toLowerCase();
	}
	var noie = (agt.indexOf("msie") == -1);

	var colors = new Array(
		"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
		"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
		"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
		"#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033",
		"#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399",
		"#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff",
		"#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333",
		"#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399",
		"#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff",
		"#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633",
		"#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699",
		"#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff",
		"#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633",
		"#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999",
		"#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff",
		"#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933",
		"#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999",
		"#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff",
		"#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33",
		"#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99",
		"#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff",
		"#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33",
		"#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99",
		"#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff",
		"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
		"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
		"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
	);
	
	this.Bind = function ( objID )
	{
		this.myTextControl = document.getElementById(objID);
	} 

	this.setTextForFocus = function ( FormatS,FormatE )
	{
		if( DMFEditor != null && DMFEditor.Enabled )
		{
			if ((DMFEditor.EditObject.contentWindow.document.selection)&&(DMFEditor.EditObject.contentWindow.document.selection.type == "Text"))
			{
				var range = DMFEditor.EditObject.contentWindow.document.selection.createRange();
				var ch_text = range.text;
				range.text = FormatS + ch_text + FormatE;
			}else
			{
				//this.myTextControl.value = this.myTextControl.value + FormatS + FormatE;
				//this.myTextControl.focus();
				DMFEditor.insertText(FormatS + FormatE);
			}
		}else
		{
			if ((document.selection)&&(document.selection.type == "Text"))
			{
				var range = document.selection.createRange();
				var ch_text = range.text;
				range.text = FormatS + ch_text + FormatE;
			}else
			{
				this.myTextControl.value = this.myTextControl.value + FormatS + FormatE;
				this.myTextControl.focus();
			}			
		}
	}

	this.appendTextForFocus = function( text )
	{
		if( DMFEditor != null && DMFEditor.Enabled )
		{
			if ( DMFEditor.EditObject.contentWindow.document.createTextRange && DMFEditor.EditObject.contentWindow.document.caretPos )
			{      
				var caretPos = DMFEditor.EditObject.contentWindow.document.caretPos;      
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? text + " " : text;
			}
			else
			{
				DMFEditor.insertText(text);
			}
		}else
		{
		
			if ( document.createTextRange && document.caretPos )
			{      
				var caretPos = document.caretPos;      
				caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? text + " " : text;
			}
			else
			{
				this.myTextControl.value += text;
			}
			this.myTextControl.focus();
		}
	}

	this.appendEm = function ( emID )
	{
		this.appendTextForFocus("[em" + emID + "]");
	}

	this.appendLink = function ( obj )
	{
		var t = new Array("链接地址","链接文本");
		this.ShowInput(t,obj,2,"DMFPostx.appendLinkToEditor(document.getElementById(\"InputValue1\").value,document.getElementById(\"InputValue2\").value)");
	}

	this.appendLinkToEditor = function ( linkURL,linkText )
	{
		this.HiddenInput();
		if( linkURL != null && linkURL != "null" && linkURL != "" )
		{
			if ( linkText != null )
			{
				if ( linkText.length > 0 && linkText != "null" )
				{
					this.appendTextForFocus("<a href=\"" + linkURL + "\" target=\"_blank\">" + linkText + "</a>");
					return;
				}
			}
			this.appendTextForFocus("<a href=\"" + linkURL + "\" target=\"_blank\">" + linkURL + "</a>");
		}
	}

	this.appendImage = function ( obj )
	{
		var t = new Array("图片地址");
		//if( DMFEditor != null && DMFEditor.Enabled )
		//{
		//	var url = prompt("图片地址");
		//	DMFEditor.EditObject.contentWindow.document.focus();
		//	DMFEditor.EditObject.contentWindow.document.execCommand("InsertImage", false, url);
		//}else
		//{
		this.ShowInput(t,obj,1,"DMFPostx.appendImageToEditor(document.getElementById(\"InputValue1\").value)");
		//}

	}

	this.appendImageToEditor = function ( imageURL )
	{
		this.HiddenInput();
		
		if ( imageURL != null )
		{
			if( DMFEditor != null && DMFEditor.Enabled )
			{
				var text = "<img src=\"" + imageURL + "\" alt=\"\"/>";
				if ( DMFEditor.EditObject.contentWindow.document.createTextRange && DMFEditor.EditObject.contentWindow.document.caretPos )
				{      
					var caretPos = DMFEditor.EditObject.contentWindow.document.caretPos;      
					caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == " " ? text + " " : text;
				}
				else
				{
					DMFEditor.insertText(text);
				}
			}else
			{		
				if ( imageURL.length > 0 && imageURL != "null" ) this.appendTextForFocus("[img]" + imageURL + "[/img]");
			}
		}
	}
	
	this.appendCode = function ( obj )
	{
		var st = "c#|css|vbs|vb|js|sql|java|xml";
		var t = st.split("|");
		this.ShowSelect("请选择程序语言",t,obj,"DMFPostx.appendCodeToEditor(document.getElementById(\"customSelectValue\").value)");
	}

	this.appendCodeToEditor = function ( CodeLang )
	{
		this.HiddenInput();
		this.setTextForFocus("[code=" + CodeLang + "]","[/code]");
	}
	
	this.setFontSize = function ( obj )
	{
		var st = "6|7|8|9|10|11|12|13";
		if( DMFEditor != null && DMFEditor.Enabled ) st = "1|2|3|4|5|6|7|8";
		var t = st.split("|");
		this.ShowSelect("请选择文字大小",t,obj,"DMFPostx.setFontSizeToEditor(document.getElementById(\"customSelectValue\").value)");
	}

	this.setFontSizeToEditor = function ( Size )
	{
		this.HiddenInput();
		if( DMFEditor != null && DMFEditor.Enabled )
		{
			DMFEditor.EditObject.contentWindow.document.execCommand("FontSize", false, Size);
		}else
		{		
			this.setTextForFocus ( "[size=" + Size + "]", "[/size]" );
		}
	}
	
	this.appendHidden = function ( obj )
	{
		var st = "需要积分|需要发帖数|团队限制|门派限制|需要经验|需要购买|回复可见";
		var t = st.split("|");
		var stv = "1|2|3|4|5|6|7";
		var tv = stv.split("|");
		var tname = new Array("查看条件","需要的值","注意:<br/><span style='color:blue'>购买功能每帖只能使用一次<br/>多个购买部分出现在同一帖时将默认使用第一部分的购买金额作为总金额<br/>一旦用户购买后所有块都将可见<br/><br/>类型为回复可见只能在主题帖子里设置<br/>如果在回复帖子中使用,则其中的隐藏部分在任何条件下都不可见<br/>此类型不需要设定需要值</span>");
		this.ShowAdvBox(tname,t,tv,obj,"DMFPostx.appendHiddenToEditor(document.getElementById(\"customSelectValue\").value,document.getElementById(\"customInputValue\").value)");
	}

	this.appendHiddenToEditor = function ( HiddenEvent,HiddenValue )
	{
		this.HiddenInput();
		if ( HiddenValue == null || HiddenValue.length == 0 ) HiddenValue = 0;
		this.appendTextForFocus ( "[hidden=" + HiddenEvent + "," + HiddenValue + "]需隐藏的内容[/hidden]" );
	}
	
	this.setBold = function ()
	{
		this.setTextForFocus ( "[b]", "[/b]" );
	}

	this.setItaic = function ()
	{
		this.setTextForFocus ( "[i]", "[/i]" );
	}

	this.setUnderLine = function ()
	{
		this.setTextForFocus ( "[u]", "[/u]" );
	}

	this.setColor = function (reObj,command)
	{
		var obj = document.getElementById("InputLayer");
		obj.innerHTML = "<div class=\"message-title\" style=\"text-align:center\">loading...</div>";

		var p = this.getXY(reObj);
		var nowtop = p.y + reObj.height;
		var nowleft = p.x;
		obj.style.top = nowtop + "px";
		obj.style.left = nowleft + "px";
		obj.style.display = "block";

		colorshtml = renderColorMap("DMFPostx.AppletColorToEditor('" + command + "')");
		obj.innerHTML = "<div class=\"message-title\" style=\"text-align:center\">" + colorshtml + "</div>";
	}
	
	this.setObjColor = function (reObj,tObj)
	{
		var obj = document.getElementById("InputLayer");
		obj.innerHTML = "<div class=\"message-title\" style=\"text-align:center\">loading...</div>";

		var p = this.getXY(reObj);
		var nowtop = p.y + reObj.height;
		var nowleft = p.x;
		obj.style.top = nowtop + "px";
		obj.style.left = nowleft + "px";
		obj.style.display = "block";

		colorshtml = renderColorMap("DMFPostx.AppletColorToObj('" + tObj + "')");

		obj.innerHTML = "<div class=\"message-title\" style=\"text-align:center\">" + colorshtml + "</div>";
	}
	
	this.AppletColorToObj = function( tObj )
	{
		var color = document.getElementById("selectedColorBox").value;
		var tObject = document.getElementById(tObj);
		if( tObject ) tObject.value = color;
		try
		{
			tObject.style.color = color;
		}catch(e){}
		this.HiddenInput();
	}
	
	this.AppletColorToEditor = function(command)
	{
		var color = document.getElementById("selectedColorBox").value;
		this.HiddenInput();
		if( DMFEditor != null && DMFEditor.Enabled )
		{
			DMFEditor.EditObject.contentWindow.document.execCommand(command, false, color);
		}else
		{		
			this.setTextForFocus ( "[color=" + color + "]", "[/color]" );
		}
	}
	
	this.setPoll = function ( obj )
	{
		this.ShowPollInput("DMFPostx.BuildPolls()",obj);
	}
	
	this.getValues = function ( source,obj )
	{
		var temp = "";
		for ( var i = 0; i < obj.options.length; i ++ )
		{
			if ( obj.options[i].selected )
			{
				temp += obj.options[i].value;
				temp += "|";
			}
		}
		temp = temp.substring(0,temp.length - 1);
		source.value = temp;
	}
	
	this.ViewTeams = function ( text )

⌨️ 快捷键说明

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