2
* FCKeditor - The text editor for internet
3
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
* Licensed under the terms of the GNU Lesser General Public License:
6
* http://www.opensource.org/licenses/lgpl-license.php
8
* For further information visit:
9
* http://www.fckeditor.net/
11
* "Support Open Source software. What about a donation today?"
13
* File Name: fck_colorselector.html
14
* Color Selection dialog window.
17
* Frederico Caldeira Knabben (fredck@fckeditor.net)
19
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
22
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
23
<meta name="robots" content="noindex, nofollow" />
24
<style TYPE="text/css">
25
#ColorTable { cursor: pointer ; cursor: hand ; }
26
#hicolor { height: 74px ; width: 74px ; border-width: 1px ; border-style: solid ; }
27
#hicolortext { width: 75px ; text-align: right ; margin-bottom: 7px ; }
28
#selhicolor { height: 20px ; width: 74px ; border-width: 1px ; border-style: solid ; }
29
#selcolor { width: 75px ; height: 20px ; margin-top: 0px ; margin-bottom: 7px ; }
30
#btnClear { width: 75px ; height: 22px ; margin-bottom: 6px ; }
31
.ColorCell { height: 15px ; width: 15px ; }
33
<script type="text/javascript">
35
var oEditor = window.parent.InnerDialogLoaded() ;
39
// First of all, translate the dialog box texts
40
oEditor.FCKLanguageManager.TranslatePage(document) ;
44
window.parent.SetOkButton( true ) ;
45
window.parent.SetAutoSize( true ) ;
48
function CreateColorTable()
50
// Get the target table.
51
var oTable = document.getElementById('ColorTable') ;
53
// Create the base colors array.
54
var aColors = ['00','33','66','99','cc','ff'] ;
56
// This function combines two ranges of three values from the color array into a row.
57
function AppendColorRow( rangeA, rangeB )
59
for ( var i = rangeA ; i < rangeA + 3 ; i++ )
61
var oRow = oTable.insertRow(-1) ;
63
for ( var j = rangeB ; j < rangeB + 3 ; j++ )
65
for ( var n = 0 ; n < 6 ; n++ )
67
AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;
73
// This function create a single color cell in the color table.
74
function AppendColorCell( targetRow, color )
76
var oCell = targetRow.insertCell(-1) ;
77
oCell.className = 'ColorCell' ;
78
oCell.bgColor = color ;
80
oCell.onmouseover = function()
82
document.getElementById('hicolor').style.backgroundColor = this.bgColor ;
83
document.getElementById('hicolortext').innerHTML = this.bgColor ;
86
oCell.onclick = function()
88
document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;
89
document.getElementById('selcolor').value = this.bgColor ;
93
AppendColorRow( 0, 0 ) ;
94
AppendColorRow( 3, 0 ) ;
95
AppendColorRow( 0, 3 ) ;
96
AppendColorRow( 3, 3 ) ;
98
// Create the last row.
99
var oRow = oTable.insertRow(-1) ;
101
// Create the gray scale colors cells.
102
for ( var n = 0 ; n < 6 ; n++ )
104
AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;
107
// Fill the row with black cells.
108
for ( var i = 0 ; i < 12 ; i++ )
110
AppendColorCell( oRow, '#000000' ) ;
116
document.getElementById('selhicolor').style.backgroundColor = '' ;
117
document.getElementById('selcolor').value = '' ;
120
function ClearActual()
122
document.getElementById('hicolor').style.backgroundColor = '' ;
123
document.getElementById('hicolortext').innerHTML = ' ' ;
126
function UpdateColor()
128
try { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }
129
catch (e) { Clear() ; }
134
if ( typeof(window.parent.dialogArguments.CustomValue) == 'function' )
135
window.parent.dialogArguments.CustomValue( document.getElementById('selcolor').value ) ;
141
<body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
142
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
144
<td align="center" valign="middle">
145
<table border="0" cellspacing="5" cellpadding="0" width="100%">
147
<td valign="top" align="center" nowrap width="100%">
148
<table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">
151
<td valign="top" align="left" nowrap>
152
<span fckLang="DlgColorHighlight">Highlight</span>
153
<div id="hicolor"></div>
154
<div id="hicolortext"> </div>
155
<span fckLang="DlgColorSelected">Selected</span>
156
<div id="selhicolor"></div>
157
<input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">
159
<input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />