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

📄 webhtmleditordialog.txt.exclude

📁 小孔子全站管理系统网站内容管理。相当于一个文章发布系统一个样
💻 EXCLUDE
📖 第 1 页 / 共 5 页
字号:
// 取通过URL传过来的参数 (格式如 ?Param1=Value1&Param2=Value2)
var URLParams = new Object() ;
var aParams = document.location.search.substr(1).split('&') ;
for (var i=0 ; i < aParams.length ; i++) {
	var aParam = aParams[i].split('=') ;
	URLParams[aParam[0]] = aParam[1] ;
}
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,"");}


function LTrim(text)
{
	return text.replace(/^\s+/ig,"");
}
function RTrim(text)
{
	return text.replace(/\s+$/ig,""); 
}
function Trim(text)
{
	return (LTrim(RTrim(text))); 
}
// 去空格,left,right,all可选
function BaseTrim(str)
{
      return Trim(str);
}


// 是否有效颜色值
function IsColor(color)
{
	var temp=color;
	if (temp=="") 
	{
	    return true;
	}
	if (temp.length!=7) 
	{
	    return false;
	}
	return (temp.search(/\#[a-fA-F0-9]{6}/) != -1);
}


// 转为数字型,并无前导0,不能转则返回""
function ToInt(str)
{
	str=BaseTrim(str);
	if (str!="")
	{
		var sTemp=parseFloat(str);
		if (isNaN(sTemp))
		{
			str="";
		}else
		{
			str=sTemp;
		}
	}
	return str;
}

// 是否有效的扩展名
function IsExt(url, opt)
{
	var sTemp;
	var b=false;
	var s=opt.toUpperCase().split("|");
	for (var i=0;i<s.length ;i++ )
	{
		sTemp=url.substr(url.length-s[i].length-1);
		sTemp=sTemp.toUpperCase();
		s[i]="."+s[i];
		if (s[i]==sTemp)
		{
			b=true;
			break;
		}
	}
	return b;
}

// 相对路径转为根形式路径
function relativePath2rootPath(url)
{
	if (url.substring(0,1)=="/")
	{
	    return url;
	}
	var sWebEditorPath = getWebEditorRootPath();
	while(url.substr(0,3)=="../")
	{
		url = url.substr(3);
		sWebEditorPath = sWebEditorPath.substring(0,sWebEditorPath.lastIndexOf("/"));
	}
	return sWebEditorPath + "/" + url;
}

// 相对路径按路径模式转为相应的格式
function relativePath2setPath(url)
{
	switch(config.BaseUrl)
	{
	    case "0":
		    return baseHref2editorPath(url);
		    break;
	    case "1":
		    return relativePath2rootPath(url);
		    break;
	    case "2":
		    return getSitePath() + relativePath2rootPath(url);
		    break;
	}
}

// 显示路径到编辑器路的相对形式
function baseHref2editorPath(url)
{
	var editorPath = getWebEditorRootPath() + "/";
	var baseHref = config.BaseHref;
	var editorLen = editorPath.length;
	var baseLen = baseHref.length;
	var nMinLen = 0;
	if (editorLen>baseLen)
	{
		nMinLen = baseLen;
	}
	else
	{
		nMinLen = editorLen;
	}
	var n = 0;
	for (var i=1; i<=nMinLen; i++)
	{
		n = i;
		if (editorPath.substr(0,i).toLowerCase()!=baseHref.substr(0,i).toLowerCase())
		{
			break;
		}
	}	
	var str = editorPath.substr(0, n);
	str = str.substring(0,str.lastIndexOf("/")+1);
	n = str.length;
	editorPath = editorPath.substr(n);
	baseHref = baseHref.substr(n);
	var arr = baseHref.split("/");
	var result = "";
	for (var i=1; i<=arr.length-1; i++)
	{
		result += "../";
	}
	result = result + editorPath + url;
	return result;
}

// 搜索下拉框值与指定值匹配,并选择匹配项
function SearchSelectValue(o_Select, s_Value)
{		
	for (var i=0;i<o_Select.length;i++)
	{
		if (o_Select.options[i].value == s_Value)
		{
			o_Select.selectedIndex = i;
			return true;
		}
	}
	return false;
}
//
function trim(str)
{
	return str.replace(/^\s{1,}/ig,"").replace(/\s{1,}$/ig,""); 
}
//
function GetOptionSelected(control)
{
    if(control.tagName!="SELECT")return;
    if(control.options.length<=0)
    {
		alert("isn`t find item");
		return null;
    }
    return control.options[control.selectedIndex].value ;
}

//Hides an HTML object.	
function hideObject(obj)
{
	try
	{
		obj.style.display = "none";
	}
	catch (exc) {}
}

//Shows an HTML object.	
function showObject(obj)
{
	try
	{
		obj.style.display = "";
	}
	catch (exc) {}
}

// 取编辑所在跟路径
function getWebEditorRootPath()
{
	var url = "/" + document.location.pathname;
	return url.substring(0,url.lastIndexOf("/dialog/"));
}

// 取站点路径
function getSitePath()
{
	var sSitePath = document.location.protocol + "//" + document.location.host;
	if (sSitePath.substr(sSitePath.length-3) == ":80")
	{
		sSitePath = sSitePath.substring(0,sSitePath.length-3);
	}
	return sSitePath;
}
function AccountUpLoadSize(allowUpLoadSize, useAllowUpLoadSize, spareAllowUpLoadSize, upLoadFileMaxSizeMaxSize)
{
	var _a = document.getElementById("UpLoadAllowUpLoadSize");	
	var _u = document.getElementById("UseUpLoadAllowUpLoadSize"); 
	var _s = document.getElementById("SpareUpLoadAllowUpLoadSize");   
	var _m = document.getElementById("UpLoadFileMaxSize");
	if(_a)
	{
	    _a.innerHTML = allowUpLoadSize;
	}
	if(_u)
	{
	    _u.innerHTML = useAllowUpLoadSize;
	}
	if(_s)
	{
	    _s.innerHTML = spareAllowUpLoadSize;
	}
	if(_m)
	{
	    _m.innerHTML = upLoadFileMaxSizeMaxSize;
	}
	var panel = document.getElementById("UpLoadAllowUpLoadSizePanel");
	panel.style.display = (allowUpLoadSize == "0"?"none":"");
}
function GetSrcElement(e)
{
	if (null == e)
	{
	    return null; 
	}
	if (e.srcElement)
	{
	    return e.srcElement; 
	}
	else if (e.target)
	{
	    return e.target;
	}
	else
	{
	    return null; 
	}
}
function Command_IfrmaeHandle(url)
{ 
	var uploadFormIframe = document.getElementById("Iframe_UpLoadFile");
	if(uploadFormIframe)
	{
		uploadFormIframe_Window = uploadFormIframe.contentWindow;		
		try
		{
			Process.Show();
			uploadFormIframe_Window.location.href = uploadFormIframe.src + url;
		}
		catch(e)
		{
			Process.Hide();
		}		
	}
	else
	{
		alert(LR["UPLOAD_FORM_NOT_FIND_ALERT"]);
	}
	return false;
}
if (!DropDownState)
{
    var DropDownState=null;
}
if (!DropDownFlag)
{
    var DropDownFlag= false;
}
function DropDownMenu(doc, id)
{ 
	this.Document = doc;
	this.Id = id;
	this.MenuButton = this.Document.getElementById(this.Id + "Menu_Button"); 
	this.MenuElem = this.Document.getElementById(this.Id + "Menu_Element"); 
	this.AlignmentControl=null; 
	var obj=this ; 
	if (!DropDownFlag)
	{
		if (this.Document.all)
		{
			this.Document.attachEvent("onclick",obj.DocumentOnClick); 
		}
		else 
		{
			this.Document.addEventListener("click",obj.DocumentOnClick, true); 
		}
	}
}
DropDownMenu.prototype.DocumentOnClick= function (e)
{
	if (!e)
	{
	    var e=window.event; 
	}
	if (null != DropDownState)
	{
		DropDownState.SetVisible( false); 
	}
};
DropDownMenu.prototype.SetDisabled= function (flag)
{
	if ((null != this.MenuButton)&&(null != this.MenuElem))
	{ 
		this.MenuButton.disabled=flag? false : true;
	}
};
DropDownMenu.prototype.IsVisible= function ()
{
	return (null != this.MenuButton)&&(null != this.MenuElem)&&"visible" == this.MenuElem.style.visibility; 
};
DropDownMenu.prototype.Toggle= function ()
{ 
	this.SetVisible(!this.IsVisible());
};
DropDownMenu.prototype.GetOffsetSize= function (elem)
{
	var coords=new Array(0,0); 
	if (elem.offsetParent)
	{
		while (elem.offsetParent)
		{
			coords[0]+=elem.offsetLeft; 
			coords[1]+=elem.offsetTop; 
			elem=elem.offsetParent; 
			if (elem == this.Document.body)
			{
				coords[0]-=elem.offsetLeft; 
				coords[1]-=elem.offsetTop;
			}
		}
	}
	return coords; 
};
DropDownMenu.prototype.SetVisible= function (visible)
{
	if ((null != this.MenuButton)&&(null != this.MenuElem))
	{
		if (visible)
		{
			if (DropDownState)
			{
				DropDownState.SetVisible( false); 
			}
			var coords=this.GetOffsetSize(this.MenuButton); 
			this.MenuElem.style.left=coords[0]+"px"; 
			this.MenuElem.style.top=(coords[1]+this.MenuButton.offsetHeight)+"px"; 
			this.MenuElem.style.zIndex=0144000; 
			this.MenuElem.style.overflow="hidden"; 
			this.MenuElem.style.position="absolute";
			this.MenuElem.style.visibility="visible";
		}
		else 
		{ 
			this.MenuElem.style.visibility="hidden"; 
		}
		DropDownState=visible?this :null; 
		if (null != this.AlignmentControl&&null != this.AlignmentControl.SetAlignmentVisible)
		{ 
			this.AlignmentControl.SetAlignmentVisible(visible); 
		}
	}
};
DropDownMenu.prototype.SetDropDownMenuContent= function (content)
{ 
	//this.MenuElem.innerHTML = ""//content; 
	//this.MenuElem.appendChild(content);
};


function TableWizard(doc, id, tableDesignControl, tablePropertiesControl, cellPropertiesControl, themePath)
{ 
	this.Document = doc;
	this.Id=id; 
	this.ThemePath = themePath;
	
	this.TableDesignControl=tableDesignControl; 
	this.TablePropertiesControl=tablePropertiesControl;
	this.CellPropertiesPreviewTableHolder = new TablePreView(this.Document.getElementById(this.Id+"CellPropertiesPreviewTableHolder"), this.Document); 
	this.Button_Ok = this.Document.getElementById(this.Id+"Ok");	   
	this.Button_Cancel = this.Document.getElementById(this.Id+"Cancel");
	this.CellPropertiesControl=cellPropertiesControl; 
	this.CellPropertiesSelectCell=null; 
	this.CssClasses=null; 
	this.CellCssClasses=null; 
	this.Editor=null;
}
TableWizard.prototype.Initialize= function (tableToModify, CssClasses ,CellCssClasses, editor, ColorsArray)
{ 
	this.ColorsArray=ColorsArray; 
	this.CssClasses=CssClasses; 
	this.CellCssClasses=CellCssClasses; 
	this.TableToModify=tableToModify; 
	this.PreviewViewTable_SelectCell=null; 
	this.SelectCellIndex=-1; 
	this.Editor=editor; 
	var obj = this;
	if(this.Button_Ok)
	{
	    this.Button_Ok.onclick = function(){obj.InsertTable();}; 
	}
	if(this.Button_Cancel)
	{
	    this.Button_Cancel.onclick = function(){CloseDlg();};
	}
	this.InitTableProperties(); 
} ; 
TableWizard.prototype.CellPropertiesPreviewTableHolderClientSelectCellOnClick= function ()
{
	if (this.CellPropertiesSelectCell)
	{ 
		this.CellPropertiesControl.Update(); 
	} 
	this.CheckSelectCell(); 
	if (this.PreviewViewTable_SelectCell)
	{ 
		this.CellPropertiesSelectCell=this.PreviewViewTable_SelectCell; 
		this.CellPropertiesControl.SetCellProperty(this.CellPropertiesSelectCell); 	 
	}
} ; 
TableWizard.prototype.CheckSelectCell= function ()
{
	var previewViewTable_SelectCell=this.CellPropertiesPreviewTableHolder.GetTablePreviewView_SelectCell();
	var previewViewTable=this.CellPropertiesPreviewTableHolder.GetPreviewViewTable(); 
	var previewViewTableRows=previewViewTable.rows; 
	this.PreviewViewTable_SelectCell=null;
	this.SelectCellIndex=-1; 
	for (var i=0; i<previewViewTableRows.length; i++)
	{
		var cells=previewViewTableRows[i].cells; 
		for (var j=0; j<cells.length; j++)
		{
			if (cells[j] == previewViewTable_SelectCell)
			{ 
				this.PreviewViewTable_SelectCell=this.TableToModify.rows[i].cells[j]; 
				this.SelectCellIndex=j; 
				return;
			}
		}
	}						  
} ; 
TableWizard.prototype.InitCellProperties= function ()
{
	var obj=this ; 
	this.CellPropertiesPreviewTableHolder.ClientSelectCellOnClick= function (){obj.CellPropertiesPreviewTableHolderClientSelectCellOnClick(); } ; 
	this.SetSelectCellIs0(); 
	this.CellPropertiesPreviewTableHolder.UpdateTable(this.TableToModify,this.PreviewViewTable_SelectCell); 
	this.CellPropertiesSelectCell=this.PreviewViewTable_SelectCell; 
	this.CellPropertiesControl.Initialize(this.CellPropertiesSelectCell,this.Editor,this.ColorsArray); 
} ; 

⌨️ 快捷键说明

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