1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2010 Frederico Caldeira Knabben
8 * Licensed under the terms of any of the following licenses at your
11 * - GNU General Public License Version 2 or later (the "GPL")
12 * http://www.gnu.org/licenses/gpl.html
14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 * http://www.gnu.org/licenses/lgpl.html
17 * - Mozilla Public License Version 1.1 or later (the "MPL")
18 * http://www.mozilla.org/MPL/MPL-1.1.html
22 * Color Selection dialog window.
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 ; }
37 <script src="common/fck_dialog_common.js" type="text/javascript"></script>
38 <script type="text/javascript">
40 var oEditor = window.parent.InnerDialogLoaded() ;
44 // First of all, translate the dialog box texts
45 oEditor.FCKLanguageManager.TranslatePage(document) ;
49 window.parent.SetOkButton( true ) ;
50 window.parent.SetAutoSize( true ) ;
53 function CreateColorTable()
55 // Get the target table.
56 var oTable = document.getElementById('ColorTable') ;
58 // Create the base colors array.
59 var aColors = ['00','33','66','99','cc','ff'] ;
61 // This function combines two ranges of three values from the color array into a row.
62 function AppendColorRow( rangeA, rangeB )
64 for ( var i = rangeA ; i < rangeA + 3 ; i++ )
66 var oRow = oTable.insertRow(-1) ;
68 for ( var j = rangeB ; j < rangeB + 3 ; j++ )
70 for ( var n = 0 ; n < 6 ; n++ )
72 AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;
78 // This function create a single color cell in the color table.
79 function AppendColorCell( targetRow, color )
81 var oCell = targetRow.insertCell(-1) ;
82 oCell.className = 'ColorCell' ;
83 oCell.bgColor = color ;
85 oCell.onmouseover = function()
87 document.getElementById('hicolor').style.backgroundColor = this.bgColor ;
88 document.getElementById('hicolortext').innerHTML = this.bgColor ;
91 oCell.onclick = function()
93 document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;
94 document.getElementById('selcolor').value = this.bgColor ;
98 AppendColorRow( 0, 0 ) ;
99 AppendColorRow( 3, 0 ) ;
100 AppendColorRow( 0, 3 ) ;
101 AppendColorRow( 3, 3 ) ;
103 // Create the last row.
104 var oRow = oTable.insertRow(-1) ;
106 // Create the gray scale colors cells.
107 for ( var n = 0 ; n < 6 ; n++ )
109 AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;
112 // Fill the row with black cells.
113 for ( var i = 0 ; i < 12 ; i++ )
115 AppendColorCell( oRow, '#000000' ) ;
121 document.getElementById('selhicolor').style.backgroundColor = '' ;
122 document.getElementById('selcolor').value = '' ;
125 function ClearActual()
127 document.getElementById('hicolor').style.backgroundColor = '' ;
128 document.getElementById('hicolortext').innerHTML = ' ' ;
131 function UpdateColor()
133 try { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }
134 catch (e) { Clear() ; }
139 if ( typeof(window.parent.Args().CustomValue) == 'function' )
140 window.parent.Args().CustomValue( document.getElementById('selcolor').value ) ;
146 <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
147 <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
149 <td align="center" valign="middle">
150 <table border="0" cellspacing="5" cellpadding="0" width="100%">
152 <td valign="top" align="center" nowrap width="100%">
153 <table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">
156 <td valign="top" align="left" nowrap>
157 <span fckLang="DlgColorHighlight">Highlight</span>
158 <div id="hicolor"></div>
159 <div id="hicolortext"> </div>
160 <span fckLang="DlgColorSelected">Selected</span>
161 <div id="selhicolor"></div>
162 <input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">
164 <input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />