PageRenderTime 42ms CodeModel.GetById 8ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 0ms

/pigeoncms/Plugins/fckeditor/editor/dialog/fck_colorselector.html

http://pigeoncms.googlecode.com/
HTML | 172 lines | 130 code | 20 blank | 22 comment | 0 complexity | 120eb6cb683bb6bda2fc3c4584b19426 MD5 | raw file
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  2<!--
  3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
  5 *
  6 * == BEGIN LICENSE ==
  7 *
  8 * Licensed under the terms of any of the following licenses at your
  9 * choice:
 10 *
 11 *  - GNU General Public License Version 2 or later (the "GPL")
 12 *    http://www.gnu.org/licenses/gpl.html
 13 *
 14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 15 *    http://www.gnu.org/licenses/lgpl.html
 16 *
 17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 18 *    http://www.mozilla.org/MPL/MPL-1.1.html
 19 *
 20 * == END LICENSE ==
 21 *
 22 * Color Selection dialog window.
 23-->
 24<html>
 25	<head>
 26		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 27		<meta name="robots" content="noindex, nofollow" />
 28		<style TYPE="text/css">
 29			#ColorTable		{ cursor: pointer ; cursor: hand ; }
 30			#hicolor		{ height: 74px ; width: 74px ; border-width: 1px ; border-style: solid ; }
 31			#hicolortext	{ width: 75px ; text-align: right ; margin-bottom: 7px ; }
 32			#selhicolor		{ height: 20px ; width: 74px ; border-width: 1px ; border-style: solid ; }
 33			#selcolor		{ width: 75px ; height: 20px ; margin-top: 0px ; margin-bottom: 7px ; }
 34			#btnClear		{ width: 75px ; height: 22px ; margin-bottom: 6px ; }
 35			.ColorCell		{ height: 15px ; width: 15px ; }
 36		</style>
 37		<script src="common/fck_dialog_common.js" type="text/javascript"></script>
 38		<script type="text/javascript">
 39
 40var oEditor = window.parent.InnerDialogLoaded() ;
 41
 42function OnLoad()
 43{
 44	// First of all, translate the dialog box texts
 45	oEditor.FCKLanguageManager.TranslatePage(document) ;
 46
 47	CreateColorTable() ;
 48
 49	window.parent.SetOkButton( true ) ;
 50	window.parent.SetAutoSize( true ) ;
 51}
 52
 53function CreateColorTable()
 54{
 55	// Get the target table.
 56	var oTable = document.getElementById('ColorTable') ;
 57
 58	// Create the base colors array.
 59	var aColors = ['00','33','66','99','cc','ff'] ;
 60
 61	// This function combines two ranges of three values from the color array into a row.
 62	function AppendColorRow( rangeA, rangeB )
 63	{
 64		for ( var i = rangeA ; i < rangeA + 3 ; i++ )
 65		{
 66			var oRow = oTable.insertRow(-1) ;
 67
 68			for ( var j = rangeB ; j < rangeB + 3 ; j++ )
 69			{
 70				for ( var n = 0 ; n < 6 ; n++ )
 71				{
 72					AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;
 73				}
 74			}
 75		}
 76	}
 77
 78	// This function create a single color cell in the color table.
 79	function AppendColorCell( targetRow, color )
 80	{
 81		var oCell = targetRow.insertCell(-1) ;
 82		oCell.className = 'ColorCell' ;
 83		oCell.bgColor = color ;
 84
 85		oCell.onmouseover = function()
 86		{
 87			document.getElementById('hicolor').style.backgroundColor = this.bgColor ;
 88			document.getElementById('hicolortext').innerHTML = this.bgColor ;
 89		}
 90
 91		oCell.onclick = function()
 92		{
 93			document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;
 94			document.getElementById('selcolor').value = this.bgColor ;
 95		}
 96	}
 97
 98	AppendColorRow( 0, 0 ) ;
 99	AppendColorRow( 3, 0 ) ;
100	AppendColorRow( 0, 3 ) ;
101	AppendColorRow( 3, 3 ) ;
102
103	// Create the last row.
104	var oRow = oTable.insertRow(-1) ;
105
106	// Create the gray scale colors cells.
107	for ( var n = 0 ; n < 6 ; n++ )
108	{
109		AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;
110	}
111
112	// Fill the row with black cells.
113	for ( var i = 0 ; i < 12 ; i++ )
114	{
115		AppendColorCell( oRow, '#000000' ) ;
116	}
117}
118
119function Clear()
120{
121	document.getElementById('selhicolor').style.backgroundColor = '' ;
122	document.getElementById('selcolor').value = '' ;
123}
124
125function ClearActual()
126{
127	document.getElementById('hicolor').style.backgroundColor = '' ;
128	document.getElementById('hicolortext').innerHTML = '&nbsp;' ;
129}
130
131function UpdateColor()
132{
133	try		  { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }
134	catch (e) { Clear() ; }
135}
136
137function Ok()
138{
139	if ( typeof(window.parent.Args().CustomValue) == 'function' )
140		window.parent.Args().CustomValue( document.getElementById('selcolor').value ) ;
141
142	return true ;
143}
144		</script>
145	</head>
146	<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
147		<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
148			<tr>
149				<td align="center" valign="middle">
150					<table border="0" cellspacing="5" cellpadding="0" width="100%">
151						<tr>
152							<td valign="top" align="center" nowrap width="100%">
153								<table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">
154								</table>
155							</td>
156							<td valign="top" align="left" nowrap>
157								<span fckLang="DlgColorHighlight">Highlight</span>
158								<div id="hicolor"></div>
159								<div id="hicolortext">&nbsp;</div>
160								<span fckLang="DlgColorSelected">Selected</span>
161								<div id="selhicolor"></div>
162								<input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">
163								<br>
164								<input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />
165							</td>
166						</tr>
167					</table>
168				</td>
169			</tr>
170		</table>
171	</body>
172</html>