Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html>
3
    <head>
4
        <title>jQuery Colorpicker</title>
5
		<!-- jQuery/jQueryUI (hosted) -->
6
		<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
7
		<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
8
		<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/>
9
        <style>
10
			body {
11
				font-family:	'Segoe UI', Verdana, Arial, Helvetica, sans-serif;
12
				font-size:		62.5%;
13
			}
14
        </style>
15
		<script src="jquery.colorpicker.js"></script>
16
		<link href="jquery.colorpicker.css" rel="stylesheet" type="text/css"/>
17
		<script src="i18n/jquery.ui.colorpicker-nl.js"></script>
18
 
19
		<script>
20
			$(function() {
21
				$('#tabs').tabs();
22
			});
23
		</script>
24
    </head>
25
    <body>
26
		<h1>jQuery ColorPicker</h1>
27
 
28
		<div id="tabs">
29
			<ul>
30
			  <li><a href="#tab-input">Basic &lt;input&gt;</a></li>
31
			  <li><a href="#tab-element">Basic element</a></li>
32
			  <li><a href="#tab-full">All features</a></li>
33
			  <li><a href="#tab-i18n">Localization</a></li>
34
			  <li><a href="#tab-websafe">Websafe colors</a></li>
35
			  <li><a href="#tab-alt">Alternative display field</a></li>
36
			  <li><a href="#tab-events">Events</a></li>
37
			  <li><a href="#tab-input-format">Input formatting</a></li>
38
			  <li><a href="#tab-format">Output formatting</a></li>
39
			  <li><a href="#tab-format-list">Output format list</a></li>
40
			  <li><a href="#tab-dialog">In a dialog</a></li>
41
			  <li><a href="#tab-modal">Modal</a></li>
42
			  <li><a href="#tab-no-inline">Any element to popup</a></li>
43
			</ul>
44
 
45
			<div id="tab-input">
46
				<h2>Basic &lt;input&gt; example, without any options</h2>
47
				<input type="text" class="cp-basic" value="fe9810"/>
48
			</div>
49
 
50
			<div id="tab-element">
51
				<h2>Basic element (&lt;span&gt;> example, without any options</h2>
52
				<span class="cp-basic" style="display: inline-block; vertical-align: top;"></span>
53
			</div>
54
 
55
			<div id="tab-full">
56
				<h2>Fully-featured example</h2>
57
				<input type="text" class="cp-full" value="186aa7"/>
58
			</div>
59
 
60
			<div id="tab-i18n">
61
				<h2>Localized to Dutch (nl)</h2>
62
				<input type="text" class="cp-i18n" value="ccea73"/>
63
			</div>
64
 
65
			<div id="tab-websafe">
66
				<h2>Limit to websafe colors</h2>
67
				<input type="text" class="cp-websafe" value="0fa7c2"/>
68
			</div>
69
 
70
			<div id="tab-alt">
71
				<h2>Alternative field class</h2>
72
				<input type="text" class="cp-alt" value="b762ae"/>
73
				<span class="cp-alt-target" style="display: inline-block; border: thin solid black; padding: .5em 4em;">
74
					<div style=" background-color: white; border: thin solid black; padding: .25em 2em; font-size: 1.25em; font-weight: bold;">Background-color on outside, text color here</div>
75
				</span>
76
			</div>
77
 
78
			<div id="tab-events">
79
				<h2>Events</h2>
80
				<input type="text" class="cp-events" value="92b64a"/>
81
				<div class="cp-events-log" style="vertical-align: top; display: inline-block; border: thin solid black; height: 10em; overflow-y: scroll; width: 50em;"></div>
82
			</div>
83
 
84
			<div id="tab-format">
85
				<h2>Output formatting HSLA</h2>
86
				<input type="text" class="cp-format" value="918237"/>
87
				<span class="cp-format-output"></span>
88
			</div>
89
 
90
			<div id="tab-format-list">
91
				<h2>Output format list</h2>
92
				You can specify a list of output formats, the first perfect match for the color is output.
93
				<input type="text" class="cp-name" value="a92fb4"/>
94
				<span class="cp-name-output"></span>
95
			</div>
96
 
97
			<div id="tab-dialog">
98
				<h2>Dialog with Colorpicker popup (demonstrates z-index)</h2>
99
				<button id="cp-dialog-open">Open dialog</button>
100
				<div id="cp-dialog-modal" title="Basic modal dialog">
101
					Basic &lt;input&gt; example, without any options: <input type="text" class="cp-basic" value="fe9810"/>
102
					<br/>
103
					Basic element example, without any options: <span class="cp-basic" style="display: inline-block; vertical-align: top;"></span>
104
				</div>
105
			</div>
106
 
107
			<div id="tab-modal">
108
				<h2>Modal (and showCancelButton, closeOnEscape, showCloseButton)</h2>
109
				<input type="text" class="cp-modal" value="9ba73f"/>
110
			</div>
111
 
112
			<div id="tab-input-format">
113
				<h2>Input formatting</h2>
114
				Demonstrates the ability to parse common color formats as input.
115
				<input type="text" class="cp-input" value="rgb(123,42,87)"/>
116
			</div>
117
 
118
			<div id="tab-no-inline">
119
				<h2>Popup from any element (&lt;em&gt;)</h2>
120
				Just click on this <em>Emphasized</em> word to show the colorpicker.
121
			</div>
122
		</div>
123
 
124
		<script>
125
           	$( function() {
126
                $('.cp-basic').colorpicker();
127
 
128
				$('.cp-full').colorpicker({
129
					parts: 'full',
130
					showOn: 'both',
131
					buttonColorize: true,
132
					showNoneButton: true,
133
					alpha: true
134
				});
135
 
136
				$('.cp-i18n').colorpicker({
137
					regional: 'nl',
138
					showNoneButton: true,
139
					alpha: true
140
				});
141
 
142
                $('.cp-websafe').colorpicker({
143
					limit: 'websafe'
144
				});
145
 
146
                $('.cp-alt').colorpicker({
147
					altField: '.cp-alt-target',
148
					altProperties: 'background-color,color',
149
					altAlpha: true,
150
					alpha: true
151
				});
152
 
153
				{	// event log
154
					var count = 0;
155
 
156
					function addToEventLog(label, message) {
157
						var line = '<div>#'+(++count)+' '+label+': '+message+'</div>';
158
						var log = $('.cp-events-log');
159
						log.append(line).scrollTop(log[0].scrollHeight);
160
					}
161
 
162
					$('.cp-events').colorpicker({
163
						init:			function(event, color) {
164
											addToEventLog('Init', color.formatted);
165
										},
166
						select:			function(event, color) {
167
											addToEventLog('Select', color.formatted);
168
										},
169
						close:			function(event, color) {
170
											addToEventLog('Close', color.formatted + ' r:' + color.rgb.r + ' g:' + color.rgb.g + ' b:' + color.rgb.b + ' a:' + color.a);
171
										}
172
					});
173
				}
174
 
175
                $('.cp-format').colorpicker({
176
					colorFormat: 'HSLA',
177
					alpha: true,
178
					init: function(event, color) {
179
								$('.cp-format-output').text(color.formatted);
180
							},
181
					select: function(event, color) {
182
								$('.cp-format-output').text(color.formatted);
183
							}
184
				});
185
 
186
                $('.cp-name').colorpicker({
187
					parts: 'full',
188
					colorFormat: ['EXACT', '#HEX3', 'RGB', 'RGBA'],
189
					init: function(event, color) {
190
								$('.cp-name-output').text(color.formatted);
191
							},
192
					select: function(event, color) {
193
								$('.cp-name-output').text(color.formatted);
194
							}
195
				});
196
 
197
				var dialog = $('#cp-dialog-modal').dialog({
198
					autoOpen:	false,
199
					minWidth:	500,
200
					modal:		true,
201
					buttons:	{	'Close': function() {
202
										$(this).dialog('close');
203
									}
204
								}
205
				});
206
 
207
				$('#cp-dialog-open').click(function() {
208
					dialog.dialog('open');
209
				});
210
 
211
                $('.cp-modal').colorpicker({
212
					parts:				'draggable',
213
					showCloseButton:	false,
214
					modal:				true,
215
					showCancelButton:	false,
216
					closeOnEscape:		false
217
				});
218
 
219
                $('.cp-input').colorpicker({
220
					colorFormat: ['RGBA']
221
				});
222
 
223
                $('em').colorpicker({
224
					inline: false
225
				});
226
			});
227
		</script>
228
    </body>
229
</html>