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

📄 selcolor.htm

📁 官方最新的南方数据v12生成静态商业版。全站生成静态。
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script type="text/javascript" src="dialog.js"></script>

<script type="text/javascript">
document.write ("<link href='../skin/" + config.Skin + "/dialog.css' type='text/css' rel='stylesheet'>");

var sAction = URLParams['action'] ;
var sTitle = "";
var color = "" ;
var oSelection;
var oControl;
var sRangeType;

switch (sAction) {
	case "forecolor":
		sTitle = lang["DlgSelCorForecolor"];
		oSelection = dialogArguments.eWebEditor.document.selection.createRange();
		color = oSelection.queryCommandValue("ForeColor");
		if (color) color = N2Color(color);
		break;
	case "backcolor":
		sTitle = lang["DlgSelCorBackcolor"];
		oSelection = dialogArguments.eWebEditor.document.selection.createRange();
		color = oSelection.queryCommandValue("BackColor");
		if (color) color = N2Color(color);
		break;
	case "bgcolor":
		sTitle = lang["DlgSelCorBgcolor"];
		oSelection = dialogArguments.eWebEditor.document.selection.createRange();
		sRangeType = dialogArguments.eWebEditor.document.selection.type;
		if (sRangeType == "Control") {
			oControl = GetControl(oSelection, "TABLE");
		}else{
			oControl = GetParent(oSelection.parentElement());
		}
		if (oControl) {
			switch(oControl.tagName){
			case "TD":
				sTitle += " - " + lang["DlgComTableCell"];
				break;
			case "TR":
			case "TH":
				sTitle += " - " + lang["DlgComTableRow"];
				break;
			default:
				sTitle += " - " + lang["DlgComTable"];
				break;
			}
			color = oControl.style.backgroundColor;
		}else{
			sTitle += " - " + lang["DlgComBody"];
		}
		break;
	default:
		if (URLParams['color']){
			color = decodeURIComponent(URLParams['color']) ;
		}
		break;
}

document.write("<TITLE>" + lang["DlgSelCor"] + "(" + sTitle + ")</TITLE>");

if (!color) color = "#000000";


function GetParent(obj){
	while(obj!=null && obj.tagName!="TD" && obj.tagName!="TR" && obj.tagName!="TH" && obj.tagName!="TABLE")
		obj=obj.parentElement;
	return obj;
}

function GetControl(obj, sTag){
	obj=obj.item(0);
	if (obj.tagName==sTag){
		return obj;
	}
	return null;
}

function N2Color(s_Color){
	s_Color = s_Color.toString(16);
	switch (s_Color.length) {
	case 1:
		s_Color = "0" + s_Color + "0000"; 
		break;
	case 2:
		s_Color = s_Color + "0000";
		break;
	case 3:
		s_Color = s_Color.substring(1,3) + "0" + s_Color.substring(0,1) + "00" ;
		break;
	case 4:
		s_Color = s_Color.substring(2,4) + s_Color.substring(0,2) + "00" ;
		break;
	case 5:
		s_Color = s_Color.substring(3,5) + s_Color.substring(1,3) + "0" + s_Color.substring(0,1) ;
		break;
	case 6:
		s_Color = s_Color.substring(4,6) + s_Color.substring(2,4) + s_Color.substring(0,2) ;
		break;
	default:
		s_Color = "";
	}
	return '#' + s_Color;
}

function InitDocument(){
	lang.TranslatePage(document);
	ShowColor.bgColor = color;
	RGB.innerHTML = color;
	SelColor.value = color;

	var s_BoxID = "cbox_" + color.substr(1);
	var o_Box = document.all(s_BoxID);
	if (o_Box){
		BoxClick(o_Box);
	}

	adjustDialog();
}


var SelRGB = color;
var DrRGB = '';
var SelGRAY = '120';

var hexch = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');

function ToHex(n) {	
	var h, l;

	n = Math.round(n);
	l = n % 16;
	h = Math.floor((n / 16)) % 16;
	return (hexch[h] + hexch[l]);
}

function DoColor(c, l){
	var r, g, b;

	r = '0x' + c.substring(1, 3);
	g = '0x' + c.substring(3, 5);
	b = '0x' + c.substring(5, 7);

	if(l > 120){
		l = l - 120;

		r = (r * (120 - l) + 255 * l) / 120;
		g = (g * (120 - l) + 255 * l) / 120;
		b = (b * (120 - l) + 255 * l) / 120;
	}else{
		r = (r * l) / 120;
		g = (g * l) / 120;
		b = (b * l) / 120;
	}

	return '#' + ToHex(r) + ToHex(g) + ToHex(b);
}

function EndColor(){
	var i;

	if(DrRGB != SelRGB){
		DrRGB = SelRGB;
		for(i = 0; i <= 30; i ++)
		GrayTable.rows(i).bgColor = DoColor(SelRGB, 240 - i * 8);
	}

	var s_Color = DoColor(RGB.innerText, GRAY.innerText);
	SelColor.value = s_Color
	ShowColor.bgColor = s_Color;

	var s_BoxID = "cbox_" + s_Color.substr(1);
	var o_Box = document.all(s_BoxID);
	if (o_Box){
		BoxClick(o_Box, true);
	}else{
		if (s_CurrBoxID){
			document.all(s_CurrBoxID).className = "boxNormal";
			s_CurrBoxID = ""
		}
	}

}

var s_CurrBoxID = "";
function BoxMouseOut(obj){
	if (obj.id==s_CurrBoxID){
		obj.className = "boxSelected";
	}else{
		obj.className = "boxNormal";
	}
}

function BoxMouseOver(obj){
	if (obj.id==s_CurrBoxID){
		obj.className = "boxSelected";
	}else{
		obj.className = "boxOver";
	}
}

function BoxClick(obj, notSel){
	if (obj.id==s_CurrBoxID){
		return;
	}else{
		if (s_CurrBoxID){
			document.all(s_CurrBoxID).className = "boxNormal";
		}

		s_CurrBoxID = obj.id;
		obj.className = "boxSelected";

		var s_Color = "#" + s_CurrBoxID.substr(5);
		if (!notSel){

⌨️ 快捷键说明

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