source: trunk/admin/inc/FCKeditor/editor/dialog/fck_colorselector.html@ 2

Last change on this file since 2 was 2, checked in by root, 15 years ago

importo il progetto

File size: 4.8 KB
Line 
1<!--
2 * FCKeditor - The text editor for internet
3 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
4 *
5 * Licensed under the terms of the GNU Lesser General Public License:
6 * http://www.opensource.org/licenses/lgpl-license.php
7 *
8 * For further information visit:
9 * http://www.fckeditor.net/
10 *
11 * "Support Open Source software. What about a donation today?"
12 *
13 * File Name: fck_colorselector.html
14 * Color Selection dialog window.
15 *
16 * File Authors:
17 * Frederico Caldeira Knabben (fredck@fckeditor.net)
18-->
19<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
20<html>
21 <head>
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 ; }
32 </style>
33 <script type="text/javascript">
34
35var oEditor = window.parent.InnerDialogLoaded() ;
36
37function OnLoad()
38{
39 // First of all, translate the dialog box texts
40 oEditor.FCKLanguageManager.TranslatePage(document) ;
41
42 CreateColorTable() ;
43
44 window.parent.SetOkButton( true ) ;
45 window.parent.SetAutoSize( true ) ;
46}
47
48function CreateColorTable()
49{
50 // Get the target table.
51 var oTable = document.getElementById('ColorTable') ;
52
53 // Create the base colors array.
54 var aColors = ['00','33','66','99','cc','ff'] ;
55
56 // This function combines two ranges of three values from the color array into a row.
57 function AppendColorRow( rangeA, rangeB )
58 {
59 for ( var i = rangeA ; i < rangeA + 3 ; i++ )
60 {
61 var oRow = oTable.insertRow(-1) ;
62
63 for ( var j = rangeB ; j < rangeB + 3 ; j++ )
64 {
65 for ( var n = 0 ; n < 6 ; n++ )
66 {
67 AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ;
68 }
69 }
70 }
71 }
72
73 // This function create a single color cell in the color table.
74 function AppendColorCell( targetRow, color )
75 {
76 var oCell = targetRow.insertCell(-1) ;
77 oCell.className = 'ColorCell' ;
78 oCell.bgColor = color ;
79
80 oCell.onmouseover = function()
81 {
82 document.getElementById('hicolor').style.backgroundColor = this.bgColor ;
83 document.getElementById('hicolortext').innerHTML = this.bgColor ;
84 }
85
86 oCell.onclick = function()
87 {
88 document.getElementById('selhicolor').style.backgroundColor = this.bgColor ;
89 document.getElementById('selcolor').value = this.bgColor ;
90 }
91 }
92
93 AppendColorRow( 0, 0 ) ;
94 AppendColorRow( 3, 0 ) ;
95 AppendColorRow( 0, 3 ) ;
96 AppendColorRow( 3, 3 ) ;
97
98 // Create the last row.
99 var oRow = oTable.insertRow(-1) ;
100
101 // Create the gray scale colors cells.
102 for ( var n = 0 ; n < 6 ; n++ )
103 {
104 AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ;
105 }
106
107 // Fill the row with black cells.
108 for ( var i = 0 ; i < 12 ; i++ )
109 {
110 AppendColorCell( oRow, '#000000' ) ;
111 }
112}
113
114function Clear()
115{
116 document.getElementById('selhicolor').style.backgroundColor = '' ;
117 document.getElementById('selcolor').value = '' ;
118}
119
120function ClearActual()
121{
122 document.getElementById('hicolor').style.backgroundColor = '' ;
123 document.getElementById('hicolortext').innerHTML = '&nbsp;' ;
124}
125
126function UpdateColor()
127{
128 try { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; }
129 catch (e) { Clear() ; }
130}
131
132function Ok()
133{
134 if ( typeof(window.parent.dialogArguments.CustomValue) == 'function' )
135 window.parent.dialogArguments.CustomValue( document.getElementById('selcolor').value ) ;
136
137 return true ;
138}
139 </script>
140 </head>
141 <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden">
142 <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
143 <tr>
144 <td align="center" valign="middle">
145 <table border="0" cellspacing="5" cellpadding="0" width="100%">
146 <tr>
147 <td valign="top" align="center" nowrap width="100%">
148 <table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();">
149 </table>
150 </td>
151 <td valign="top" align="left" nowrap>
152 <span fckLang="DlgColorHighlight">Highlight</span>
153 <div id="hicolor"></div>
154 <div id="hicolortext">&nbsp;</div>
155 <span fckLang="DlgColorSelected">Selected</span>
156 <div id="selhicolor"></div>
157 <input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();">
158 <br>
159 <input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" />
160 </td>
161 </tr>
162 </table>
163 </td>
164 </tr>
165 </table>
166 </body>
167</html>
Note: See TracBrowser for help on using the repository browser.