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

📄 dialogs.js

📁 php 开发的内容管理系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
	//bg color
	previewItem.bgColor = cell["bgColor"];
	
	//bg image
	//previewItem.style.backgroundImage = 'url(' + cell["backgroundImage"] + ')';
	
	//borders style
	previewItem.style.borderLeftStyle 	= cell["borderLeftStyle"];
	previewItem.style.borderRightStyle 	= cell["borderRightStyle"];
	previewItem.style.borderTopStyle 	= cell["borderTopStyle"];
	previewItem.style.borderBottomStyle = cell["borderBottomStyle"];
			
	//borders Width
	previewItem.style.borderLeftWidth 	= cell["borderLeftWidth"];
	previewItem.style.borderRightWidth	= cell["borderRightWidth"];
	previewItem.style.borderTopWidth 	= cell["borderTopWidth"];
	previewItem.style.borderBottomWidth = cell["borderBottomWidth"];
			
	//borders Color
	previewItem.style.borderLeftColor 	= cell["borderLeftColor"];
	previewItem.style.borderRightColor 	= cell["borderRightColor"];
	previewItem.style.borderTopColor 	= cell["borderTopColor"];
	previewItem.style.borderBottomColor = cell["borderBottomColor"];
	
	//width and height
	previewItem.width 	= cell["width"];
	previewItem.height 	=cell["height"];
	
	//padding
	if(cell["paddingLeft"]||cell["paddingRight"]||cell["paddingTop"]||cell["paddingBottom"])
	{
		previewItem.style.paddingLeft=cell["paddingLeft"];
		previewItem.style.paddingRight=cell["paddingRight"];
		previewItem.style.paddingTop=cell["paddingTop"];
		previewItem.style.paddingBottom=["paddingBottom"];
	}

};	

function XK_CC(id, color)
{
	textfield=document.getElementById('coloroption').value;
	document.getElementById(textfield).value=color;
	document.getElementById('colorPalette'+id).style.display="none";
	cellPreview();
};

//image properties dialog
function imageValues() 
{
	var image					= 	new Object();
	
	image["alt"]				=	document.getElementById('alt').value;
	image["src"]				=	document.getElementById('src').value;
	image["align"]				=	document.getElementById('align').value;
	image["width"]				=	document.getElementById('width').value;
	image["height"]				=	document.getElementById('height').value;
	image["hspace"]				=	document.getElementById('hspace').value;
	image["vspace"]				=	document.getElementById('vspace').value;
	image["className"]			=	document.getElementById('className').value;
	
	//borders style
	image["borderLeftStyle"]	=	document.getElementById('borderLeftStyle').value;
	image["borderRightStyle"]	=	document.getElementById('borderRightStyle').value;
	image["borderTopStyle"]		=	document.getElementById('borderTopStyle').value;
	image["borderBottomStyle"]	=	document.getElementById('borderBottomStyle').value;
	
	//borders width
	image["borderLeftWidth"]	=	document.getElementById('borderLeftWidth').value?document.getElementById('borderLeftWidth').value+document.getElementById('borderLeftUnits').value:'';
	image["borderRightWidth"]	=	document.getElementById('borderRightWidth').value?document.getElementById('borderRightWidth').value+document.getElementById('borderRightUnits').value:'';
	image["borderTopWidth"]		=	document.getElementById('borderTopWidth').value?document.getElementById('borderTopWidth').value+document.getElementById('borderTopUnits').value:'';
	image["borderBottomWidth"]	=	document.getElementById('borderBottomWidth').value?document.getElementById('borderBottomWidth').value+document.getElementById('borderBottomUnits').value:'';
	
	//borders color
	image["borderLeftColor"]	=	document.getElementById('borderLeftColor').value;
	image["borderRightColor"]	=	document.getElementById('borderRightColor').value;
	image["borderTopColor"]		=	document.getElementById('borderTopColor').value;
	image["borderBottomColor"]	=	document.getElementById('borderBottomColor').value;
	
	//margins
	image["marginLeft"]			=	document.getElementById('marginLeft').value?document.getElementById('marginLeft').value+document.getElementById('marginLeftUnits').value:'';
	image["marginRight"]		=	document.getElementById('marginRight').value?document.getElementById('marginRight').value+document.getElementById('marginRightUnits').value:'';
	image["marginTop"]			=	document.getElementById('marginTop').value?document.getElementById('marginTop').value+document.getElementById('marginTopUnits').value:'';
	image["marginBottom"]		=	document.getElementById('marginBottom').value?document.getElementById('marginBottom').value+document.getElementById('marginBottomUnits').value:'';
	return(image);
};

function imagePreview() 
{
				
	var image		= new Object();
	image			= imageValues();	
	var previewItem = document.getElementById('previewimage');
				
	//borders style
	previewItem.style.borderLeftStyle 	= image["borderLeftStyle"];
	previewItem.style.borderRightStyle 	= image["borderRightStyle"];
	previewItem.style.borderTopStyle 	= image["borderTopStyle"];
	previewItem.style.borderBottomStyle = image["borderBottomStyle"];
			
	//borders Width
	previewItem.style.borderLeftWidth 	= image["borderLeftWidth"];
	previewItem.style.borderRightWidth	= image["borderRightWidth"];
	previewItem.style.borderTopWidth 	= image["borderTopWidth"];
	previewItem.style.borderBottomWidth = image["borderBottomWidth"];
			
	//borders Color
	previewItem.style.borderLeftColor 	= image["borderLeftColor"];
	previewItem.style.borderRightColor 	= image["borderRightColor"];
	previewItem.style.borderTopColor 	= image["borderTopColor"];
	previewItem.style.borderBottomColor = image["borderBottomColor"];
	
	//width and height
	if (image["width"])previewItem.width 	= image["width"];
	if (image["height"])previewItem.height 	= image["height"];
	
	//borders margin
	previewItem.style.marginLeft 	= image["marginLeft"];
	previewItem.style.marginRight 	= image["marginRight"];
	previewItem.style.marginTop 	= image["marginTop"];
	previewItem.style.marginBottom  = image["marginBottom"];
	
	//align
	previewItem.align= image["align"];
	previewItem.src= image["src"];	
};	

function XK_ImgPrev(id, color)
{
	textfield=document.getElementById('coloroption').value;
	document.getElementById(textfield).value=color;
	document.getElementById('colorPalette'+id).style.display="none";
	imagePreview();
};			
		

function sendImage(id) 
{
	var image = 	new Object();
	image	 =	imageValues();		
	window.opener.XK_imageProps(id,image);
	window.close();  
};
			
function initImageProps(id,url) 
{
	var image = window.opener.XK_imageProps(id,null);
		
	if(image==null)window.close();
		
	//Koivi anchor cant be edited
	if (image["src"]==url+"/skins/common/anchor.gif")window.close();
				
	document.getElementById('alt').value	=	image["alt"];
	document.getElementById('src').value	=	image["src"];
	document.getElementById('width').value	=	image["width"];
	document.getElementById('height').value	=	image["height"];
	document.getElementById('align').value	=	image["align"];
	if(image["hspace"]!=-1 && image["hspace"]!=0)document.getElementById('hspace').value	=	image["hspace"];
	if(image["vspace"]!=-1 && image["vspace"]!=0)document.getElementById('vspace').value	=	image["vspace"];
	document.getElementById('className').value	=	image["className"];
	
	document.getElementById('borderLeftStyle').value=image["borderLeftStyle"];
	document.getElementById('borderRightStyle').value = image["borderRightStyle"];
	document.getElementById('borderTopStyle').value = image["borderTopStyle"];
	document.getElementById('borderBottomStyle').value = image["borderBottomStyle"];
			
	document.getElementById('borderLeftWidth').value = image["borderLeftWidth"]?getWidth(image["borderLeftWidth"]):'';
	document.getElementById('borderRightWidth').value = image["borderRightWidth"]?getWidth(image["borderRightWidth"]):'';
	document.getElementById('borderTopWidth').value = image["borderTopWidth"]?getWidth(image["borderTopWidth"]):'';
	document.getElementById('borderBottomWidth').value = image["borderBottomWidth"]?getWidth(image["borderBottomWidth"]):'';

	document.getElementById('borderLeftUnits').value = image["borderLeftWidth"]?getUnits(image["borderLeftWidth"]):'px';
	document.getElementById('borderRightUnits').value = image["borderRightWidth"]?getUnits(image["borderRightWidth"]):'px';
	document.getElementById('borderTopUnits').value = image["borderTopWidth"]?getUnits(image["borderTopWidth"]):'px';
	document.getElementById('borderBottomUnits').value = image["borderBottomWidth"]?getUnits(image["borderBottomWidth"]):'px';	
						
	document.getElementById('borderLeftColor').value = image["borderLeftColor"];
	document.getElementById('borderRightColor').value = image["borderRightColor"];
	document.getElementById('borderTopColor').value = image["borderTopColor"];
	document.getElementById('borderBottomColor').value = image["borderBottomColor"];
	
	document.getElementById('marginLeft').value = getWidth(image["marginLeft"]);
	document.getElementById('marginRight').value = getWidth(image["marginRight"]);
	document.getElementById('marginTop').value = getWidth(image["marginTop"]);
	document.getElementById('marginBottom').value = getWidth(image["marginBottom"]);
	
	document.getElementById('marginLeftUnits').value = getUnits(image["marginLeft"]);
	document.getElementById('marginRightUnits').value = getUnits(image["marginRight"]);
	document.getElementById('marginTopUnits').value = getUnits(image["marginTop"]);
	document.getElementById('marginBottomUnits').value = getUnits(image["marginBottom"]);
	imagePreview();
	window.focus();
};

function getWidth(value)
{
	width=value.substring(0,value.length-2);
	return(width);

};

function getUnits(value)
{
	units=value.substring(value.length-2,value.length);
	return units;
};

//override functions
function XK_over(id,color)
{
	document.getElementById('colortextf'+id).style.backgroundColor =color;
	document.getElementById('showc'+id).value =color;
};

function XK_InsertImage(id,src,alt)
{
	document.getElementById('backgroundImage').value=src;
};

function XK_color(id)
{
	document.getElementById('coloroption').value=id+'Color';
	XK_showHideDiv(id,'colorPalette');
};

//Shows/Hides a Div Layer
function XK_showHideDiv(buttonId,divId)
{
	var divid=divId;
	buttonElement=document.getElementById(buttonId);
	document.getElementById(divid).style.left=window.opener.XK_getOffsetLeft(buttonElement) + "px";
	document.getElementById(divid).style.top=(window.opener.XK_getOffsetTop(buttonElement) + buttonElement.offsetHeight) + "px";
	if(document.getElementById(divid).style.display=="none")
	{
		document.getElementById(divid).style.display="";
	}
	else document.getElementById(divid).style.display="none";
};


function openWithSelfMain(url,name,width,height) 
{
	var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";
	new_window = window.open(url, name, options);
	window.self.name = "main";
	new_window.focus();
};

function onlyNumbers(e,id)
{
	var value=document.getElementById(id).value;
	e = e?e:event;
	var keyCode =e.keyCode?e.keyCode:e.charCode;
	return (( keyCode >= 48 && keyCode <= 57 )||keyCode ==8||(keyCode ==46 && value.indexOf('.')==-1)||(keyCode >= 37 && keyCode <= 40));
}

function onlyHexNumbers(e,id)
{
	var value=document.getElementById(id).value?document.getElementById(id).value:'';
	e = e?e:event;
	var keyCode =e.keyCode?e.keyCode:e.charCode;
	return (
	( keyCode >= 48 && keyCode <= 57 )||( keyCode >= 65 && keyCode <= 70 )||( keyCode >= 97 && keyCode <= 102)||keyCode ==8||(keyCode ==35 && value.indexOf("#")==-1)||(keyCode >= 37 && keyCode <= 40));
}

⌨️ 快捷键说明

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