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-2007 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 type="text/javascript"> |
---|
38 | |
---|
39 | var oEditor = window.parent.InnerDialogLoaded() ; |
---|
40 | |
---|
41 | function OnLoad() |
---|
42 | { |
---|
43 | // First of all, translate the dialog box texts |
---|
44 | oEditor.FCKLanguageManager.TranslatePage(document) ; |
---|
45 | |
---|
46 | CreateColorTable() ; |
---|
47 | |
---|
48 | window.parent.SetOkButton( true ) ; |
---|
49 | window.parent.SetAutoSize( true ) ; |
---|
50 | } |
---|
51 | |
---|
52 | function CreateColorTable() |
---|
53 | { |
---|
54 | // Get the target table. |
---|
55 | var oTable = document.getElementById('ColorTable') ; |
---|
56 | |
---|
57 | // Create the base colors array. |
---|
58 | var aColors = ['00','33','66','99','cc','ff'] ; |
---|
59 | |
---|
60 | // This function combines two ranges of three values from the color array into a row. |
---|
61 | function AppendColorRow( rangeA, rangeB ) |
---|
62 | { |
---|
63 | for ( var i = rangeA ; i < rangeA + 3 ; i++ ) |
---|
64 | { |
---|
65 | var oRow = oTable.insertRow(-1) ; |
---|
66 | |
---|
67 | for ( var j = rangeB ; j < rangeB + 3 ; j++ ) |
---|
68 | { |
---|
69 | for ( var n = 0 ; n < 6 ; n++ ) |
---|
70 | { |
---|
71 | AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ; |
---|
72 | } |
---|
73 | } |
---|
74 | } |
---|
75 | } |
---|
76 | |
---|
77 | // This function create a single color cell in the color table. |
---|
78 | function AppendColorCell( targetRow, color ) |
---|
79 | { |
---|
80 | var oCell = targetRow.insertCell(-1) ; |
---|
81 | oCell.className = 'ColorCell' ; |
---|
82 | oCell.bgColor = color ; |
---|
83 | |
---|
84 | oCell.onmouseover = function() |
---|
85 | { |
---|
86 | document.getElementById('hicolor').style.backgroundColor = this.bgColor ; |
---|
87 | document.getElementById('hicolortext').innerHTML = this.bgColor ; |
---|
88 | } |
---|
89 | |
---|
90 | oCell.onclick = function() |
---|
91 | { |
---|
92 | document.getElementById('selhicolor').style.backgroundColor = this.bgColor ; |
---|
93 | document.getElementById('selcolor').value = this.bgColor ; |
---|
94 | } |
---|
95 | } |
---|
96 | |
---|
97 | AppendColorRow( 0, 0 ) ; |
---|
98 | AppendColorRow( 3, 0 ) ; |
---|
99 | AppendColorRow( 0, 3 ) ; |
---|
100 | AppendColorRow( 3, 3 ) ; |
---|
101 | |
---|
102 | // Create the last row. |
---|
103 | var oRow = oTable.insertRow(-1) ; |
---|
104 | |
---|
105 | // Create the gray scale colors cells. |
---|
106 | for ( var n = 0 ; n < 6 ; n++ ) |
---|
107 | { |
---|
108 | AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ; |
---|
109 | } |
---|
110 | |
---|
111 | // Fill the row with black cells. |
---|
112 | for ( var i = 0 ; i < 12 ; i++ ) |
---|
113 | { |
---|
114 | AppendColorCell( oRow, '#000000' ) ; |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | function Clear() |
---|
119 | { |
---|
120 | document.getElementById('selhicolor').style.backgroundColor = '' ; |
---|
121 | document.getElementById('selcolor').value = '' ; |
---|
122 | } |
---|
123 | |
---|
124 | function ClearActual() |
---|
125 | { |
---|
126 | document.getElementById('hicolor').style.backgroundColor = '' ; |
---|
127 | document.getElementById('hicolortext').innerHTML = ' ' ; |
---|
128 | } |
---|
129 | |
---|
130 | function UpdateColor() |
---|
131 | { |
---|
132 | try { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; } |
---|
133 | catch (e) { Clear() ; } |
---|
134 | } |
---|
135 | |
---|
136 | function Ok() |
---|
137 | { |
---|
138 | if ( typeof(window.parent.dialogArguments.CustomValue) == 'function' ) |
---|
139 | window.parent.dialogArguments.CustomValue( document.getElementById('selcolor').value ) ; |
---|
140 | |
---|
141 | return true ; |
---|
142 | } |
---|
143 | </script> |
---|
144 | </head> |
---|
145 | <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden"> |
---|
146 | <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"> |
---|
147 | <tr> |
---|
148 | <td align="center" valign="middle"> |
---|
149 | <table border="0" cellspacing="5" cellpadding="0" width="100%"> |
---|
150 | <tr> |
---|
151 | <td valign="top" align="center" nowrap width="100%"> |
---|
152 | <table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();"> |
---|
153 | </table> |
---|
154 | </td> |
---|
155 | <td valign="top" align="left" nowrap> |
---|
156 | <span fckLang="DlgColorHighlight">Highlight</span> |
---|
157 | <div id="hicolor"></div> |
---|
158 | <div id="hicolortext"> </div> |
---|
159 | <span fckLang="DlgColorSelected">Selected</span> |
---|
160 | <div id="selhicolor"></div> |
---|
161 | <input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();"> |
---|
162 | <br> |
---|
163 | <input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" /> |
---|
164 | </td> |
---|
165 | </tr> |
---|
166 | </table> |
---|
167 | </td> |
---|
168 | </tr> |
---|
169 | </table> |
---|
170 | </body> |
---|
171 | </html> |
---|