right-rails 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. data/README.rdoc +4 -4
  2. data/Rakefile +4 -4
  3. data/lib/right_rails.rb +1 -1
  4. data/public/javascripts/right/autocompleter-src.js +115 -106
  5. data/public/javascripts/right/autocompleter.js +3 -14
  6. data/public/javascripts/right/billboard-src.js +58 -38
  7. data/public/javascripts/right/billboard.js +3 -13
  8. data/public/javascripts/right/calendar-src.js +136 -133
  9. data/public/javascripts/right/calendar.js +4 -33
  10. data/public/javascripts/right/colorpicker-src.js +128 -125
  11. data/public/javascripts/right/colorpicker.js +4 -23
  12. data/public/javascripts/right/dialog-src.js +67 -37
  13. data/public/javascripts/right/dialog.js +3 -17
  14. data/public/javascripts/right/dnd-src.js +44 -43
  15. data/public/javascripts/right/dnd.js +3 -16
  16. data/public/javascripts/right/effects-src.js +125 -98
  17. data/public/javascripts/right/effects.js +3 -13
  18. data/public/javascripts/right/in-edit-src.js +54 -38
  19. data/public/javascripts/right/in-edit.js +4 -10
  20. data/public/javascripts/right/jquerysh-src.js +344 -20
  21. data/public/javascripts/right/jquerysh.js +3 -3
  22. data/public/javascripts/right/json-src.js +22 -35
  23. data/public/javascripts/right/json.js +4 -7
  24. data/public/javascripts/right/keys-src.js +87 -0
  25. data/public/javascripts/right/keys.js +7 -0
  26. data/public/javascripts/right/lightbox-src.js +76 -58
  27. data/public/javascripts/right/lightbox.js +3 -20
  28. data/public/javascripts/right/rails-src.js +108 -107
  29. data/public/javascripts/right/rails.js +4 -11
  30. data/public/javascripts/right/rater-src.js +47 -31
  31. data/public/javascripts/right/rater.js +3 -9
  32. data/public/javascripts/right/resizable-src.js +60 -33
  33. data/public/javascripts/right/resizable.js +3 -11
  34. data/public/javascripts/right/selectable-src.js +87 -51
  35. data/public/javascripts/right/selectable.js +3 -18
  36. data/public/javascripts/right/sizzle-src.js +15 -10
  37. data/public/javascripts/right/sizzle.js +4 -27
  38. data/public/javascripts/right/slider-src.js +49 -33
  39. data/public/javascripts/right/slider.js +3 -10
  40. data/public/javascripts/right/sortable-src.js +46 -32
  41. data/public/javascripts/right/sortable.js +4 -13
  42. data/public/javascripts/right/table-src.js +19 -10
  43. data/public/javascripts/right/table.js +4 -6
  44. data/public/javascripts/right/tabs-src.js +69 -47
  45. data/public/javascripts/right/tabs.js +4 -26
  46. data/public/javascripts/right/tooltips-src.js +78 -56
  47. data/public/javascripts/right/tooltips.js +4 -9
  48. data/public/javascripts/right/uploader-src.js +50 -34
  49. data/public/javascripts/right/uploader.js +3 -9
  50. data/public/javascripts/right-olds-src.js +528 -355
  51. data/public/javascripts/right-olds.js +4 -13
  52. data/public/javascripts/right-safe-src.js +4 -99
  53. data/public/javascripts/right-safe.js +3 -4
  54. data/public/javascripts/right-src.js +1618 -1245
  55. data/public/javascripts/right.js +4 -91
  56. metadata +8 -6
@@ -1,9 +1,8 @@
1
1
  /**
2
- * RightJS UI Colorpicker widget
2
+ * RightJS-UI Colorpicker v2.2.0
3
+ * http://rightjs.org/ui/colorpicker
3
4
  *
4
- * See http://rightjs.org/ui/colorpicker
5
- *
6
- * Copyright (C) 2010 Nikolay Nemshilov
5
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
7
6
  */
8
7
  var Colorpicker = RightJS.Colorpicker = (function(document, Math, parseInt, RightJS) {
9
8
  /**
@@ -11,33 +10,9 @@ var Colorpicker = RightJS.Colorpicker = (function(document, Math, parseInt, Righ
11
10
  * it creates an abstract proxy with the common functionality
12
11
  * which then we reuse and override in the actual widgets
13
12
  *
14
- * Copyright (C) 2010 Nikolay Nemshilov
13
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
15
14
  */
16
15
 
17
- /**
18
- * The initialization files list
19
- *
20
- * Copyright (C) 2010 Nikolay Nemshilov
21
- */
22
-
23
- var R = RightJS,
24
- $ = RightJS.$,
25
- $w = RightJS.$w,
26
- $$ = RightJS.$$,
27
- $E = RightJS.$E,
28
- $A = RightJS.$A,
29
- isArray = RightJS.isArray,
30
- Wrapper = RightJS.Wrapper,
31
- Element = RightJS.Element,
32
- Input = RightJS.Input;
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
16
  /**
42
17
  * The widget units constructor
43
18
  *
@@ -56,7 +31,7 @@ function Widget(tag_name, methods) {
56
31
  *
57
32
  * Copyright (C) 2010 Nikolay Nemshilov
58
33
  */
59
- var AbstractWidget = new RightJS.Wrapper(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
34
+ var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
60
35
  /**
61
36
  * The common constructor
62
37
  *
@@ -88,7 +63,8 @@ function Widget(tag_name, methods) {
88
63
  options = {};
89
64
  }
90
65
  this.setOptions(options, this);
91
- return this;
66
+
67
+ return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
92
68
  },
93
69
 
94
70
  // protected
@@ -101,12 +77,16 @@ function Widget(tag_name, methods) {
101
77
  * @return void
102
78
  */
103
79
  setOptions: function(options, element) {
104
- element = element || this;
105
- RightJS.Options.setOptions.call(this,
106
- RightJS.Object.merge(options, eval("("+(
80
+ if (element) {
81
+ options = RightJS.Object.merge(options, new Function("return "+(
107
82
  element.get('data-'+ this.key) || '{}'
108
- )+")"))
109
- );
83
+ ))());
84
+ }
85
+
86
+ if (options) {
87
+ RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
88
+ }
89
+
110
90
  return this;
111
91
  }
112
92
  });
@@ -115,7 +95,7 @@ function Widget(tag_name, methods) {
115
95
  * Creating the actual widget class
116
96
  *
117
97
  */
118
- var Klass = new RightJS.Wrapper(AbstractWidget, methods);
98
+ var Klass = new RightJS.Class(AbstractWidget, methods);
119
99
 
120
100
  // creating the widget related shortcuts
121
101
  RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
@@ -130,9 +110,9 @@ function Widget(tag_name, methods) {
130
110
  * so those buttons didn't interfere with
131
111
  * the user's tab-index on his page
132
112
  *
133
- * Copyright (C) 2010 Nikolay Nemshilov
113
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
134
114
  */
135
- var Button = new RightJS.Wrapper(RightJS.Element, {
115
+ var Button = new RightJS.Class(RightJS.Element, {
136
116
  /**
137
117
  * Constructor
138
118
  *
@@ -202,30 +182,81 @@ var Button = new RightJS.Wrapper(RightJS.Element, {
202
182
  * A shared module that toggles a widget visibility status
203
183
  * in a uniformed way according to the options settings
204
184
  *
205
- * Copyright (C) 2010 Nikolay Nemshilov
185
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
206
186
  */
187
+ var Toggler = {
188
+ /**
189
+ * Shows the element
190
+ *
191
+ * @param String fx-name
192
+ * @param Object fx-options
193
+ * @return Element this
194
+ */
195
+ show: function(fx_name, fx_options) {
196
+ this.constructor.current = this;
197
+ return Toggler_toggle(this, 'show', fx_name, fx_options);
198
+ },
199
+
200
+ /**
201
+ * Hides the element
202
+ *
203
+ * @param String fx-name
204
+ * @param Object fx-options
205
+ * @return Element this
206
+ */
207
+ hide: function(fx_name, fx_options) {
208
+ this.constructor.current = null;
209
+ return Toggler_toggle(this, 'show', fx_name, fx_options);
210
+ },
211
+
212
+ /**
213
+ * Toggles the widget at the given element
214
+ *
215
+ * @param Element the related element
216
+ * @param String position right/bottom (bottom is the default)
217
+ * @param Boolean marker if the element should be resized to the element size
218
+ * @return Widget this
219
+ */
220
+ showAt: function(element, where, resize) {
221
+ this.hide(null).shownAt = element = RightJS.$(element);
222
+
223
+ // moves this element at the given one
224
+ Toggler_re_position.call(this, element, where, resize);
225
+
226
+ return this.show();
227
+ },
228
+
229
+ /**
230
+ * Toggles the widget at the given element
231
+ *
232
+ * @param Element the related element
233
+ * @param String position top/left/right/bottom (bottom is the default)
234
+ * @param Boolean marker if the element should be resized to the element size
235
+ * @return Widget this
236
+ */
237
+ toggleAt: function(element, where, resize) {
238
+ return this.hidden() ? this.showAt(element, where, resize) : this.hide();
239
+ }
240
+ };
241
+
207
242
 
208
243
  /**
209
- * The toggler's common functionality
244
+ * toggles the element's state according to the current settings
210
245
  *
211
- * NOTE: this function getting called in the context
212
- * of a widget
213
- *
214
- * @param Element the element to toggle
215
246
  * @param event String 'show' or 'hide' the event name
216
247
  * @param String an optional fx-name
217
248
  * @param Object an optional fx-options hash
218
249
  * @return void
219
250
  */
220
- function toggler(element, event, fx_name, fx_options) {
251
+ function Toggler_toggle(element, event, fx_name, fx_options) {
221
252
  if (RightJS.Fx) {
222
253
  if (fx_name === undefined) {
223
- fx_name = this.options.fxName;
254
+ fx_name = element.options.fxName;
224
255
 
225
256
  if (fx_options === undefined) {
226
257
  fx_options = {
227
- duration: this.options.fxDuration,
228
- onFinish: RightJS(this.fire).bind(this, event)
258
+ duration: element.options.fxDuration,
259
+ onFinish: RightJS(element.fire).bind(element, event)
229
260
  };
230
261
 
231
262
  // hide on double time
@@ -237,12 +268,10 @@ function toggler(element, event, fx_name, fx_options) {
237
268
  }
238
269
  }
239
270
 
240
- RightJS.Element.prototype[event].call(element, fx_name, fx_options);
241
-
242
271
  // manually trigger the event if no fx were specified
243
- if (!RightJS.Fx || !fx_name) { this.fire(event); }
272
+ if (!RightJS.Fx || !fx_name) { element.fire(event); }
244
273
 
245
- return this;
274
+ return element.$super(fx_name, fx_options);
246
275
  }
247
276
 
248
277
  /**
@@ -257,7 +286,7 @@ function toggler(element, event, fx_name, fx_options) {
257
286
  * @param Boolean if `true` then the element size will be adjusted
258
287
  * @return void
259
288
  */
260
- function re_position(element, where, resize) {
289
+ function Toggler_re_position(element, where, resize) {
261
290
  var anchor = this.reAnchor || (this.reAnchor =
262
291
  new RightJS.Element('div', {'class': 'rui-re-anchor'}))
263
292
  .insert(this),
@@ -287,7 +316,7 @@ function re_position(element, where, resize) {
287
316
  target.moveTo(left, top);
288
317
 
289
318
  if (resize) {
290
- if (['left', 'right'].include(where)) {
319
+ if (where === 'left' || where === 'right') {
291
320
  target.setHeight(height);
292
321
  } else {
293
322
  target.setWidth(width);
@@ -298,67 +327,6 @@ function re_position(element, where, resize) {
298
327
  target.setStyle('visibility:visible').hide(null);
299
328
  }
300
329
 
301
- /**
302
- * The actual shared module to be inserted in the widgets
303
- *
304
- * Copyright (C) 2010 Nikolay Nemshilov
305
- */
306
- var Toggler = {
307
- /**
308
- * Shows the element
309
- *
310
- * @param String fx-name
311
- * @param Object fx-options
312
- * @return Element this
313
- */
314
- show: function(fx_name, fx_options) {
315
- this.constructor.current = this;
316
- return toggler.call(this, this, 'show', fx_name, fx_options);
317
- },
318
-
319
- /**
320
- * Hides the element
321
- *
322
- * @param String fx-name
323
- * @param Object fx-options
324
- * @return Element this
325
- */
326
- hide: function(fx_name, fx_options) {
327
- this.constructor.current = null;
328
- return toggler.call(this, this, 'hide', fx_name, fx_options);
329
- },
330
-
331
- /**
332
- * Toggles the widget at the given element
333
- *
334
- * @param Element the related element
335
- * @param String position right/bottom (bottom is the default)
336
- * @param Boolean marker if the element should be resized to the element size
337
- * @return Widget this
338
- */
339
- showAt: function(element, where, resize) {
340
- this.hide(null).shownAt = element = RightJS.$(element);
341
-
342
- // moves this element at the given one
343
- re_position.call(this, element, where, resize);
344
-
345
- return this.show();
346
- },
347
-
348
- /**
349
- * Toggles the widget at the given element
350
- *
351
- * @param Element the related element
352
- * @param String position top/left/right/bottom (bottom is the default)
353
- * @param Boolean marker if the element should be resized to the element size
354
- * @return Widget this
355
- */
356
- toggleAt: function(element, where, resize) {
357
- return this.hidden() ? this.showAt(element, where, resize) : this.hide();
358
- }
359
- };
360
-
361
-
362
330
  /**
363
331
  * A shared module that provides for the widgets an ability
364
332
  * to be assigned to an input element and work in pair with it
@@ -414,15 +382,39 @@ var Assignable = {
414
382
 
415
383
 
416
384
  /**
417
- * The basic file for Colorpicker
385
+ * The initialization files list
418
386
  *
419
387
  * Copyright (C) 2010 Nikolay Nemshilov
420
388
  */
389
+
390
+ var R = RightJS,
391
+ $ = RightJS.$,
392
+ $w = RightJS.$w,
393
+ $$ = RightJS.$$,
394
+ $E = RightJS.$E,
395
+ $A = RightJS.$A,
396
+ isArray = RightJS.isArray,
397
+ Class = RightJS.Class,
398
+ Element = RightJS.Element,
399
+ Input = RightJS.Input;
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+ /**
409
+ * The basic file for Colorpicker
410
+ *
411
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
412
+ */
421
413
  var Colorpicker = new Widget({
422
414
  include: [Toggler, Assignable],
423
415
 
424
416
  extend: {
425
- version: '2.0.0',
417
+ version: '2.2.0',
426
418
 
427
419
  EVENTS: $w('change show hide done'),
428
420
 
@@ -748,9 +740,9 @@ var Colorpicker = new Widget({
748
740
  /**
749
741
  * The colors field element
750
742
  *
751
- * Copyright (C) 2010
743
+ * Copyright (C) 2010-2011
752
744
  */
753
- var Field = new Wrapper(Element, {
745
+ var Field = new Class(Element, {
754
746
  initialize: function(options) {
755
747
  this.$super('div', {'class': 'field'});
756
748
  this.insert(this.pointer = $E('div', {'class': 'pointer'}));
@@ -761,9 +753,9 @@ var Field = new Wrapper(Element, {
761
753
  /**
762
754
  * The tint picker block
763
755
  *
764
- * Copyright (C) 2010 Nikolay Nemshilov
756
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
765
757
  */
766
- var Colors = new Wrapper(Element, {
758
+ var Colors = new Class(Element, {
767
759
  initialize: function() {
768
760
  this.$super('div', {'class': 'colors'});
769
761
  this.insert(this.pointer = $E('div', {'class': 'pointer'}));
@@ -774,9 +766,9 @@ var Colors = new Wrapper(Element, {
774
766
  /**
775
767
  * The controls block unit
776
768
  *
777
- * Copyright (C) 2010 Nikolay Nemshilov
769
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
778
770
  */
779
- var Controls = new Wrapper(Element, {
771
+ var Controls = new Class(Element, {
780
772
  initialize: function() {
781
773
  this.$super('div', {'class': 'controls'});
782
774
  this.insert([
@@ -972,7 +964,18 @@ $(document).on({
972
964
  });
973
965
 
974
966
 
975
- document.write("<style type=\"text/css\"> *.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-panel{margin:0;padding:.5em;position:relative;background-color:#EEE;border:1px solid #BBB;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;box-shadow:.15em .3em .5em #BBB;-moz-box-shadow:.15em .3em .5em #BBB;-webkit-box-shadow:.15em .3em .5em #BBB;cursor:default}div.rui-colorpicker .field,div.rui-colorpicker .field *,div.rui-colorpicker .colors,div.rui-colorpicker .colors *{border:none;background:none;width:auto;height:auto;position:static;float:none;top:none;left:none;right:none;bottom:none;margin:0;padding:0;display:block;font-weight:normal;vertical-align:center}div.rui-colorpicker div.field,div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors,div.rui-colorpicker div.colors div.pointer{background:url(/images/rightjs-ui/colorpicker.png) no-repeat 0 0}div.rui-colorpicker div.field,div.rui-colorpicker div.colors,div.rui-colorpicker div.controls{display:inline-block; *display:inline; *zoom:1;position:relative;vertical-align:top;height:150px}div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors div.pointer{position:absolute;top:0px;left:0;width:9px;height:9px}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display,div.rui-colorpicker input.rui-ui-button{font-size:100%;display:block;width:auto;padding:0 .2em}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display input,div.rui-colorpicker input.rui-ui-button{border:1px solid #AAA;-moz-border-radius:.2em;-webkit-border-radius:.2em}div.rui-colorpicker div.field{width:150px;background-color:red;cursor:crosshair;margin-right:1.2em}div.rui-colorpicker div.field div.pointer{background-position:-170px 0;margin-left:-2px;margin-top:-2px}div.rui-colorpicker div.colors{width:16px;background-position:-150px 0;border-color:#EEE;cursor:pointer;margin-right:.6em}div.rui-colorpicker div.colors div.pointer{cursor:default;background-position:-170px -20px;margin-left:-8px;margin-top:-3px}div.rui-colorpicker div.controls{width:5em}div.rui-colorpicker div.preview{height:2em;background:white;border-color:#BBB}div.rui-colorpicker input.display{margin-top:.5em;background:#FFF;width:4.5em}div.rui-colorpicker div.rgb-display{padding:0;text-align:right;margin-top:.5em}div.rui-colorpicker div.rgb-display label{display:inline}div.rui-colorpicker div.rgb-display label:after{content:none}div.rui-colorpicker div.rgb-display input{vertical-align:top;font-size:100%;width:2em;text-align:right;margin-left:.2em;padding:0 .2em;background:#FFF;margin-bottom:1px;display:inline}div.rui-colorpicker div.rui-button{cursor:pointer;position:absolute;bottom:0;right:0;width:4em}div.rui-colorpicker-inline{display:inline-block; *display:inline; *zoom:1;position:relative;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;z-index:auto}</style>");
967
+ var embed_style = document.createElement('style'),
968
+ embed_rules = document.createTextNode("*.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-panel{margin:0;padding:.5em;position:relative;background-color:#EEE;border:1px solid #BBB;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;box-shadow:.15em .3em .5em #BBB;-moz-box-shadow:.15em .3em .5em #BBB;-webkit-box-shadow:.15em .3em .5em #BBB;cursor:default}div.rui-colorpicker .field,div.rui-colorpicker .field *,div.rui-colorpicker .colors,div.rui-colorpicker .colors *{border:none;background:none;width:auto;height:auto;position:static;float:none;top:none;left:none;right:none;bottom:none;margin:0;padding:0;display:block;font-weight:normal;vertical-align:center}div.rui-colorpicker div.field,div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors,div.rui-colorpicker div.colors div.pointer{background:url(/images/rightjs-ui/colorpicker.png) no-repeat 0 0}div.rui-colorpicker div.field,div.rui-colorpicker div.colors,div.rui-colorpicker div.controls{display:inline-block; *display:inline; *zoom:1;position:relative;vertical-align:top;height:150px}div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors div.pointer{position:absolute;top:0px;left:0;width:9px;height:9px}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display,div.rui-colorpicker input.rui-ui-button{font-size:100%;display:block;width:auto;padding:0 .2em}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display input,div.rui-colorpicker input.rui-ui-button{border:1px solid #AAA;-moz-border-radius:.2em;-webkit-border-radius:.2em}div.rui-colorpicker div.field{width:150px;background-color:red;cursor:crosshair;margin-right:1.2em}div.rui-colorpicker div.field div.pointer{background-position:-170px 0;margin-left:-2px;margin-top:-2px}div.rui-colorpicker div.colors{width:16px;background-position:-150px 0;border-color:#EEE;cursor:pointer;margin-right:.6em}div.rui-colorpicker div.colors div.pointer{cursor:default;background-position:-170px -20px;margin-left:-8px;margin-top:-3px}div.rui-colorpicker div.controls{width:5em}div.rui-colorpicker div.preview{height:2em;background:white;border-color:#BBB}div.rui-colorpicker input.display{margin-top:.5em;background:#FFF;width:4.5em}div.rui-colorpicker div.rgb-display{padding:0;text-align:right;margin-top:.5em}div.rui-colorpicker div.rgb-display label{display:inline}div.rui-colorpicker div.rgb-display label:after{content:none}div.rui-colorpicker div.rgb-display input{vertical-align:top;font-size:100%;width:2em;text-align:right;margin-left:.2em;padding:0 .2em;background:#FFF;margin-bottom:1px;display:inline}div.rui-colorpicker div.rui-button{cursor:pointer;position:absolute;bottom:0;right:0;width:4em}div.rui-colorpicker-inline{display:inline-block; *display:inline; *zoom:1;position:relative;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;z-index:auto}");
969
+
970
+ embed_style.type = 'text/css';
971
+ document.getElementsByTagName('head')[0].appendChild(embed_style);
972
+
973
+ if(embed_style.styleSheet) {
974
+ embed_style.styleSheet.cssText = embed_rules.nodeValue;
975
+ } else {
976
+ embed_style.appendChild(embed_rules);
977
+ }
978
+
976
979
 
977
980
  return Colorpicker;
978
981
  })(document, Math, parseInt, RightJS);
@@ -1,26 +1,7 @@
1
1
  /**
2
- * RightJS UI Colorpicker widget
2
+ * RightJS-UI Colorpicker v2.2.0
3
+ * http://rightjs.org/ui/colorpicker
3
4
  *
4
- * See http://rightjs.org/ui/colorpicker
5
- *
6
- * Copyright (C) 2010 Nikolay Nemshilov
5
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
7
6
  */
8
- var Colorpicker=RightJS.Colorpicker=function(p,q,i,e){function r(a,b,c,d){if(e.Fx)if(c===undefined){c=this.options.fxName;if(d===undefined){d={duration:this.options.fxDuration,onFinish:e(this.fire).bind(this,b)};if(b==="hide")d.duration=(e.Fx.Durations[d.duration]||d.duration)/2}}e.Element.prototype[b].call(a,c,d);if(!e.Fx||!c)this.fire(b);return this}var j=e,n=e.$,u=e.$w,v=e.$$,h=e.$E,s=e.$A,w=e.isArray,o=e.Wrapper,m=e.Element,t=e.Input,x=new e.Wrapper(e.Element,{initialize:function(a,b){this.$super("div",
9
- b);this._.innerHTML=a;this.addClass("rui-button");this.on("selectstart","stopEvent")},disable:function(){return this.addClass("rui-button-disabled")},enable:function(){return this.removeClass("rui-button-disabled")},disabled:function(){return this.hasClass("rui-button-disabled")},enabled:function(){return!this.disabled()},fire:function(){this.enabled()&&this.$super.apply(this,arguments);return this}}),g=new (function(a,b){if(!b){b=a;a="DIV"}var c=new e.Wrapper(e.Element.Wrappers[a]||e.Element,{initialize:function(d,
10
- f){this.key=d;var k=[{"class":"rui-"+d}];this instanceof e.Input||this instanceof e.Form||k.unshift(a);this.$super.apply(this,k);if(e.isString(f))f=e.$(f);if(f instanceof e.Element){this._=f._;if("$listeners"in f)f.$listeners=f.$listeners;f={}}this.setOptions(f,this);return this},setOptions:function(d,f){f=f||this;e.Options.setOptions.call(this,e.Object.merge(d,eval("("+(f.get("data-"+this.key)||"{}")+")")));return this}});c=new e.Wrapper(c,b);e.Observer.createShortcuts(c.prototype,c.EVENTS||[]);
11
- return c})({include:[{show:function(a,b){this.constructor.current=this;return r.call(this,this,"show",a,b)},hide:function(a,b){this.constructor.current=null;return r.call(this,this,"hide",a,b)},showAt:function(a,b,c){var d=this.hide(null).shownAt=a=e.$(a),f=(this.reAnchor||(this.reAnchor=new e.Element("div",{"class":"rui-re-anchor"})).insert(this)).insertTo(d,"after").position();a=d.dimensions();var k=i(d.getStyle("borderTopWidth")),l=i(d.getStyle("borderLeftWidth")),y=i(d.getStyle("borderRightWidth")),
12
- z=i(d.getStyle("borderBottomWidth"));d=a.top-f.y+k;f=a.left-f.x+l;l=a.width-l-y;a=a.height-k-z;this.setStyle("visibility:hidden").show(null);if(b==="right")f+=l-this.size().x;else d+=a;this.moveTo(f,d);if(c)["left","right"].include(b)?this.setHeight(a):this.setWidth(l);this.setStyle("visibility:visible").hide(null);return this.show()},toggleAt:function(a,b,c){return this.hidden()?this.showAt(a,b,c):this.hide()}},{assignTo:function(a,b){a=e.$(a);if(b=e.$(b)){b[this.key]=this;b.assignedInput=a}else a[this.key]=
13
- this;var c=e(function(){if(this.visible()&&(!this.showAt||this.shownAt===a))this.setValue(a.value())}).bind(this);a.on({keyup:c,change:c});this.onChange(function(){if(!this.showAt||this.shownAt===a)a.setValue(this.getValue())});return this}}],extend:{version:"2.0.0",EVENTS:u("change show hide done"),Options:{format:"hex",update:null,updateBg:null,trigger:null,fxName:"fade",fxDuration:"short",cssRule:"*[data-colorpicker]"},i18n:{Done:"Done"},hideAll:function(){v("div.rui-colorpicker").each(function(a){a instanceof
14
- g&&!a.inlined()&&a.hide()})}},initialize:function(a){this.$super("colorpicker",a).addClass("rui-panel").insert([this.field=new A,this.colors=new B,this.controls=new C]).on({mousedown:this.startTrack,keyup:this.recalc,blur:this.update,focus:this.cancelTimer,done:this.done});this.options.update&&this.assignTo(this.options.update,this.options.trigger);this.options.updateBg&&this.updateBg(this.options.updateBg);this.tint=j([1,0,0]);this.satur=0;this.bright=1;this.color=j([255,255,255]);this.recalc().update()},
15
- setValue:function(a){if((a=w(a)?a:this.toColor(a))&&a.length===3){this.color=a=a.map(function(b){return this.bound(i(""+b),0,255)},this);this.color2tint().update();this.colors.size().y||this.update.bind(this).delay(20)}return this},getValue:function(a){return a?this.color:this[this.options.format==="rgb"?"toRgb":"toHex"]()},updateBg:function(a){var b=n(a);b&&this.onChange(j(function(){b._.style.backgroundColor=this.toRgb()}).bind(this));return this},insertTo:function(a,b){return this.$super(a,b).addClass("rui-colorpicker-inline")},
16
- inlined:function(){return this.hasClass("rui-colorpicker-inline")},done:function(){this.inlined()||this.hide();return this},setOptions:function(a){a=a||{};this.$super(a,n(a.trigger||a.update))},update:function(){this.field._.style.backgroundColor="rgb("+this.tint.map(function(d){return q.round(d*255)})+")";var a=this.color,b=this.controls;b.preview._.style.backgroundColor=b.display._.value=this.toHex();b.rDisplay._.value=a[0];b.gDisplay._.value=a[1];b.bDisplay._.value=a[2];b=this.field.pointer._.style;
17
- a=this.field.size();var c=this.satur*a.x-2;b.top=this.bound(a.y-this.bright*a.y-2,0,a.y-5)+"px";b.left=this.bound(c,0,a.x-5)+"px";b=this.tint;a=this.colors.size();b=b[1]==0?b[0]==1?b[2]:2-b[0]:b[0]==0?2+(b[2]==1?b[1]:2-b[2]):4+(b[1]==1?b[0]:2-b[1]);b=b/6*a.y;this.colors.pointer._.style.top=this.bound(b,0,a.y-4)+"px";if(this.prevColor!==""+this.color){this.fire("change",{value:this.color});this.prevColor=""+this.color}return this},recalc:function(a){if(a){a=a.target;var b=a._.value,c=s(this.color),
18
- d=false;if(a===this.controls.display&&/#\w{6}/.test(b))d=c=this.toColor(b);else if(/^\d+$/.test(b)){c[a._.cIndex]=b;d=true}d&&this.setValue(c)}else this.tint2color();return this},startTrack:function(a){this.stopTrack();this.cancelTimer();if(a.target===this.field.pointer)a.target=this.field;else if(a.target===this.colors.pointer)a.target=this.colors;if(a.target===this.field||a.target===this.colors){a.stop();g.tracking=this;a.target.tracking=true;this.trackMove(a)}},stopTrack:function(){g.tracking=
19
- false;this.field.tracking=false;this.colors.tracking=false},trackMove:function(a){var b,c=a.position();if(this.field.tracking)b=this.field.dimensions();else if(this.colors.tracking)b=this.colors.dimensions();if(b){a=this.bound(c.y-b.top,0,b.height);c=this.bound(c.x-b.left,0,b.width);if(this.field.tracking){this.satur=c/b.width;this.bright=1-a/b.height}else if(this.colors.tracking){if(a==b.height)a=b.height-0.1;b=b.height/6;c=this.tint=[0,0,0];var d=a%b/b,f=1-d;if(a<b){c[0]=1;c[2]=d}else if(a<b*2){c[0]=
20
- f;c[2]=1}else if(a<b*3){c[2]=1;c[1]=d}else if(a<b*4){c[2]=f;c[1]=1}else if(a<b*5){c[1]=1;c[0]=d}else{c[1]=f;c[0]=1}}this.recalc().update()}},cancelTimer:function(){j(function(){if(this._hide_delay){this._hide_delay.cancel();this._hide_delay=null}}).bind(this).delay(10)}}),A=new o(m,{initialize:function(){this.$super("div",{"class":"field"});this.insert(this.pointer=h("div",{"class":"pointer"}))}}),B=new o(m,{initialize:function(){this.$super("div",{"class":"colors"});this.insert(this.pointer=h("div",
21
- {"class":"pointer"}))}}),C=new o(m,{initialize:function(){this.$super("div",{"class":"controls"});this.insert([this.preview=h("div",{"class":"preview",html:"&nbsp;"}),this.display=h("input",{type:"text","class":"display",maxlength:7}),h("div",{"class":"rgb-display"}).insert([h("div").insert([h("label",{html:"R:"}),this.rDisplay=h("input",{maxlength:3,cIndex:0})]),h("div").insert([h("label",{html:"G:"}),this.gDisplay=h("input",{maxlength:3,cIndex:1})]),h("div").insert([h("label",{html:"B:"}),this.bDisplay=
22
- h("input",{maxlength:3,cIndex:2})])]),this.button=(new x(g.i18n.Done)).onClick("fire","done")])}});g.include({toRgb:function(){return"rgb("+this.color.join(",")+")"},toHex:function(){return"#"+this.color.map(function(a){return(a<16?"0":"")+a.toString(16)}).join("")},toColor:function(a){a=a.toLowerCase();var b;if(b=/rgb\((\d+),(\d+),(\d+)\)/.exec(a))return[b[1],b[2],b[3]].map(i);else if(/#[\da-f]+/.test(a)){if(b=/^#([\da-f])([\da-f])([\da-f])$/.exec(a))a="#"+b[1]+b[1]+b[2]+b[2]+b[3]+b[3];if(b=/#([\da-f]{2})([\da-f]{2})([\da-f]{2})/.exec(a))return[b[1],
23
- b[2],b[3]].map(function(c){return i(c,16)})}},color2tint:function(){var a=s(this.color).sort(function(d,f){return d-f}),b=a[0],c=a[2];this.bright=c/255;this.satur=1-b/(c||1);this.tint.each(function(d,f){this.tint[f]=!b&&!c||b==c?f==0?1:0:(this.color[f]-b)/(c-b);return this.tint[f]},this);return this},tint2color:function(){for(var a=this.tint,b=this.color,c=0;c<3;c++){b[c]=1+this.satur*(a[c]-1);b[c]=q.round(255*b[c]*this.bright)}return this},bound:function(a,b,c){a=a;if(b<c)a=a<b?b:a>c?c:a;else{if(a>
24
- c)a=c;if(a<b)a=b}return a}});n(p).on({mouseup:function(){g.tracking&&g.tracking.stopTrack()},mousemove:function(a){g.tracking&&g.tracking.trackMove(a)},focus:function(a){a=a.target instanceof t?a.target:null;g.hideAll();if(a&&(a.colorpicker||a.match(g.Options.cssRule)))(a.colorpicker||new g({update:a})).setValue(a.value()).showAt(a)},blur:function(a){var b=a.target.colorpicker;if(b)b._hide_delay=j(function(){b.hide()}).delay(200)},click:function(a){var b=a.target instanceof m?a.target:null;if(b&&
25
- (b.colorpicker||b.match(g.Options.cssRule))){if(!(b instanceof t)){a.stop();(b.colorpicker||new g({trigger:b})).hide(null).toggleAt(b.assignedInput)}}else a.find("div.rui-colorpicker")||g.hideAll()},keydown:function(a){var b=g.current,c={27:"hide",13:"done"}[a.keyCode];if(c&&b&&b.visible()){a.stop();b[c]()}}});p.write('<style type="text/css"> *.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-panel{margin:0;padding:.5em;position:relative;background-color:#EEE;border:1px solid #BBB;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;box-shadow:.15em .3em .5em #BBB;-moz-box-shadow:.15em .3em .5em #BBB;-webkit-box-shadow:.15em .3em .5em #BBB;cursor:default}div.rui-colorpicker .field,div.rui-colorpicker .field *,div.rui-colorpicker .colors,div.rui-colorpicker .colors *{border:none;background:none;width:auto;height:auto;position:static;float:none;top:none;left:none;right:none;bottom:none;margin:0;padding:0;display:block;font-weight:normal;vertical-align:center}div.rui-colorpicker div.field,div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors,div.rui-colorpicker div.colors div.pointer{background:url(/images/rightjs-ui/colorpicker.png) no-repeat 0 0}div.rui-colorpicker div.field,div.rui-colorpicker div.colors,div.rui-colorpicker div.controls{display:inline-block; *display:inline; *zoom:1;position:relative;vertical-align:top;height:150px}div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors div.pointer{position:absolute;top:0px;left:0;width:9px;height:9px}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display,div.rui-colorpicker input.rui-ui-button{font-size:100%;display:block;width:auto;padding:0 .2em}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display input,div.rui-colorpicker input.rui-ui-button{border:1px solid #AAA;-moz-border-radius:.2em;-webkit-border-radius:.2em}div.rui-colorpicker div.field{width:150px;background-color:red;cursor:crosshair;margin-right:1.2em}div.rui-colorpicker div.field div.pointer{background-position:-170px 0;margin-left:-2px;margin-top:-2px}div.rui-colorpicker div.colors{width:16px;background-position:-150px 0;border-color:#EEE;cursor:pointer;margin-right:.6em}div.rui-colorpicker div.colors div.pointer{cursor:default;background-position:-170px -20px;margin-left:-8px;margin-top:-3px}div.rui-colorpicker div.controls{width:5em}div.rui-colorpicker div.preview{height:2em;background:white;border-color:#BBB}div.rui-colorpicker input.display{margin-top:.5em;background:#FFF;width:4.5em}div.rui-colorpicker div.rgb-display{padding:0;text-align:right;margin-top:.5em}div.rui-colorpicker div.rgb-display label{display:inline}div.rui-colorpicker div.rgb-display label:after{content:none}div.rui-colorpicker div.rgb-display input{vertical-align:top;font-size:100%;width:2em;text-align:right;margin-left:.2em;padding:0 .2em;background:#FFF;margin-bottom:1px;display:inline}div.rui-colorpicker div.rui-button{cursor:pointer;position:absolute;bottom:0;right:0;width:4em}div.rui-colorpicker-inline{display:inline-block; *display:inline; *zoom:1;position:relative;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;z-index:auto}</style>');
26
- return g}(document,Math,parseInt,RightJS);
7
+ var Colorpicker=RightJS.Colorpicker=function(a,b,c,d){function i(a,b,e){var f=this.reAnchor||(this.reAnchor=new d.Element("div",{"class":"rui-re-anchor"})).insert(this),g=f.insertTo(a,"after").position(),h=a.dimensions(),i=this,j=c(a.getStyle("borderTopWidth")),k=c(a.getStyle("borderLeftWidth")),l=c(a.getStyle("borderRightWidth")),m=c(a.getStyle("borderBottomWidth")),n=h.top-g.y+j,o=h.left-g.x+k,p=h.width-k-l,q=h.height-j-m;i.setStyle("visibility:hidden").show(null),b==="right"?o+=p-i.size().x:n+=q,i.moveTo(o,n),e&&(b==="left"||b==="right"?i.setHeight(q):i.setWidth(p)),i.setStyle("visibility:visible").hide(null)}function h(a,b,c,e){d.Fx&&(c===undefined&&(c=a.options.fxName,e===undefined&&(e={duration:a.options.fxDuration,onFinish:d(a.fire).bind(a,b)},b==="hide"&&(e.duration=(d.Fx.Durations[e.duration]||e.duration)/2)))),(!d.Fx||!c)&&a.fire(b);return a.$super(c,e)}function e(a,b){b||(b=a,a="DIV");var c=new d.Class(d.Element.Wrappers[a]||d.Element,{initialize:function(b,c){this.key=b;var e=[{"class":"rui-"+b}];this instanceof d.Input||this instanceof d.Form||e.unshift(a),this.$super.apply(this,e),d.isString(c)&&(c=d.$(c)),c instanceof d.Element&&(this._=c._,"$listeners"in c&&(c.$listeners=c.$listeners),c={}),this.setOptions(c,this);return d.Wrapper.Cache[d.$uid(this._)]=this},setOptions:function(a,b){b&&(a=d.Object.merge(a,(new Function("return "+(b.get("data-"+this.key)||"{}")))())),a&&d.Options.setOptions.call(this,d.Object.merge(this.options,a));return this}}),e=new d.Class(c,b);d.Observer.createShortcuts(e.prototype,e.EVENTS||[]);return e}var f=new d.Class(d.Element,{initialize:function(a,b){this.$super("div",b),this._.innerHTML=a,this.addClass("rui-button"),this.on("selectstart","stopEvent")},disable:function(){return this.addClass("rui-button-disabled")},enable:function(){return this.removeClass("rui-button-disabled")},disabled:function(){return this.hasClass("rui-button-disabled")},enabled:function(){return!this.disabled()},fire:function(){this.enabled()&&this.$super.apply(this,arguments);return this}}),g={show:function(a,b){this.constructor.current=this;return h(this,"show",a,b)},hide:function(a,b){this.constructor.current=null;return h(this,"show",a,b)},showAt:function(a,b,c){this.hide(null).shownAt=a=d.$(a),i.call(this,a,b,c);return this.show()},toggleAt:function(a,b,c){return this.hidden()?this.showAt(a,b,c):this.hide()}},j={assignTo:function(a,b){a=d.$(a),b=d.$(b),b?(b[this.key]=this,b.assignedInput=a):a[this.key]=this;var c=d(function(){this.visible()&&(!this.showAt||this.shownAt===a)&&this.setValue(a.value())}).bind(this);a.on({keyup:c,change:c}),this.onChange(function(){(!this.showAt||this.shownAt===a)&&a.setValue(this.getValue())});return this}},k=d,l=d.$,m=d.$w,n=d.$$,o=d.$E,p=d.$A,q=d.isArray,r=d.Class,s=d.Element,t=d.Input,u=new e({include:[g,j],extend:{version:"2.2.0",EVENTS:m("change show hide done"),Options:{format:"hex",update:null,updateBg:null,trigger:null,fxName:"fade",fxDuration:"short",cssRule:"*[data-colorpicker]"},i18n:{Done:"Done"},hideAll:function(){n("div.rui-colorpicker").each(function(a){a instanceof u&&!a.inlined()&&a.hide()})}},initialize:function(a){this.$super("colorpicker",a).addClass("rui-panel").insert([this.field=new v,this.colors=new w,this.controls=new x]).on({mousedown:this.startTrack,keyup:this.recalc,blur:this.update,focus:this.cancelTimer,done:this.done}),this.options.update&&this.assignTo(this.options.update,this.options.trigger),this.options.updateBg&&this.updateBg(this.options.updateBg),this.tint=k([1,0,0]),this.satur=0,this.bright=1,this.color=k([255,255,255]),this.recalc().update()},setValue:function(a){var b=q(a)?a:this.toColor(a);b&&b.length===3&&(b=b.map(function(a){return this.bound(c(""+a),0,255)},this),this.color=b,this.color2tint().update(),this.colors.size().y||this.update.bind(this).delay(20));return this},getValue:function(a){return a?this.color:this[this.options.format==="rgb"?"toRgb":"toHex"]()},updateBg:function(a){var b=l(a);b&&this.onChange(k(function(a){b._.style.backgroundColor=this.toRgb()}).bind(this));return this},insertTo:function(a,b){return this.$super(a,b).addClass("rui-colorpicker-inline")},inlined:function(){return this.hasClass("rui-colorpicker-inline")},done:function(){this.inlined()||this.hide();return this},setOptions:function(a){a=a||{},this.$super(a,l(a.trigger||a.update))},update:function(){this.field._.style.backgroundColor="rgb("+this.tint.map(function(a){return b.round(a*255)})+")";var a=this.color,c=this.controls;c.preview._.style.backgroundColor=c.display._.value=this.toHex(),c.rDisplay._.value=a[0],c.gDisplay._.value=a[1],c.bDisplay._.value=a[2];var d=this.field.pointer._.style,e=this.field.size(),f=e.y-this.bright*e.y-2,g=this.satur*e.x-2;d.top=this.bound(f,0,e.y-5)+"px",d.left=this.bound(g,0,e.x-5)+"px";var h=this.tint,i;e=this.colors.size(),h[1]==0?i=h[0]==1?h[2]:2-h[0]:h[0]==0?i=2+(h[2]==1?h[1]:2-h[2]):i=4+(h[1]==1?h[0]:2-h[1]),i=i/6*e.y,this.colors.pointer._.style.top=this.bound(i,0,e.y-4)+"px",this.prevColor!==""+this.color&&(this.fire("change",{value:this.color}),this.prevColor=""+this.color);return this},recalc:function(a){if(a){var b=a.target,c=b._.value,d=p(this.color),e=!1;b===this.controls.display&&/#\w{6}/.test(c)?e=d=this.toColor(c):/^\d+$/.test(c)&&(d[b._.cIndex]=c,e=!0),e&&this.setValue(d)}else this.tint2color();return this},startTrack:function(a){this.stopTrack(),this.cancelTimer(),a.target===this.field.pointer?a.target=this.field:a.target===this.colors.pointer&&(a.target=this.colors);if(a.target===this.field||a.target===this.colors)a.stop(),u.tracking=this,a.target.tracking=!0,this.trackMove(a)},stopTrack:function(){u.tracking=!1,this.field.tracking=!1,this.colors.tracking=!1},trackMove:function(a){var b,c=a.position(),d,e;this.field.tracking?b=this.field.dimensions():this.colors.tracking&&(b=this.colors.dimensions());if(b){d=this.bound(c.y-b.top,0,b.height),e=this.bound(c.x-b.left,0,b.width);if(this.field.tracking)this.satur=e/b.width,this.bright=1-d/b.height;else if(this.colors.tracking){d==b.height&&(d=b.height-.1);var f=b.height/6,g=this.tint=[0,0,0],h=d%f/f,i=1-h;d<f?(g[0]=1,g[2]=h):d<f*2?(g[0]=i,g[2]=1):d<f*3?(g[2]=1,g[1]=h):d<f*4?(g[2]=i,g[1]=1):d<f*5?(g[1]=1,g[0]=h):(g[1]=i,g[0]=1)}this.recalc().update()}},cancelTimer:function(a){k(function(){this._hide_delay&&(this._hide_delay.cancel(),this._hide_delay=null)}).bind(this).delay(10)}}),v=new r(s,{initialize:function(a){this.$super("div",{"class":"field"}),this.insert(this.pointer=o("div",{"class":"pointer"}))}}),w=new r(s,{initialize:function(){this.$super("div",{"class":"colors"}),this.insert(this.pointer=o("div",{"class":"pointer"}))}}),x=new r(s,{initialize:function(){this.$super("div",{"class":"controls"}),this.insert([this.preview=o("div",{"class":"preview",html:"&nbsp;"}),this.display=o("input",{type:"text","class":"display",maxlength:7}),o("div",{"class":"rgb-display"}).insert([o("div").insert([o("label",{html:"R:"}),this.rDisplay=o("input",{maxlength:3,cIndex:0})]),o("div").insert([o("label",{html:"G:"}),this.gDisplay=o("input",{maxlength:3,cIndex:1})]),o("div").insert([o("label",{html:"B:"}),this.bDisplay=o("input",{maxlength:3,cIndex:2})])]),this.button=(new f(u.i18n.Done)).onClick("fire","done")])}});u.include({toRgb:function(a){return"rgb("+this.color.join(",")+")"},toHex:function(a){return"#"+this.color.map(function(a){return(a<16?"0":"")+a.toString(16)}).join("")},toColor:function(a){var b=a.toLowerCase(),d;if(d=/rgb\((\d+),(\d+),(\d+)\)/.exec(b))return[d[1],d[2],d[3]].map(c);if(/#[\da-f]+/.test(b)){if(d=/^#([\da-f])([\da-f])([\da-f])$/.exec(b))b="#"+d[1]+d[1]+d[2]+d[2]+d[3]+d[3];if(d=/#([\da-f]{2})([\da-f]{2})([\da-f]{2})/.exec(b))return[d[1],d[2],d[3]].map(function(a){return c(a,16)})}},color2tint:function(){var a=p(this.color).sort(function(a,b){return a-b}),b=a[0],c=a[2];this.bright=c/255,this.satur=1-b/(c||1),this.tint.each(function(a,d){this.tint[d]=!b&&!c||b==c?d==0?1:0:(this.color[d]-b)/(c-b);return this.tint[d]},this);return this},tint2color:function(){var a=this.tint,c=this.color;for(var d=0;d<3;d++)c[d]=1+this.satur*(a[d]-1),c[d]=b.round(255*c[d]*this.bright);return this},bound:function(a,b,c){var d=a;b<c?d=d<b?b:d>c?c:d:(d>c&&(d=c),d<b&&(d=b));return d}}),l(a).on({mouseup:function(){u.tracking&&u.tracking.stopTrack()},mousemove:function(a){u.tracking&&u.tracking.trackMove(a)},focus:function(a){var b=a.target instanceof t?a.target:null;u.hideAll(),b&&(b.colorpicker||b.match(u.Options.cssRule))&&(b.colorpicker||new u({update:b})).setValue(b.value()).showAt(b)},blur:function(a){var b=a.target,c=b.colorpicker;c&&(c._hide_delay=k(function(){c.hide()}).delay(200))},click:function(a){var b=a.target instanceof s?a.target:null;b&&(b.colorpicker||b.match(u.Options.cssRule))?b instanceof t||(a.stop(),(b.colorpicker||new u({trigger:b})).hide(null).toggleAt(b.assignedInput)):a.find("div.rui-colorpicker")||u.hideAll()},keydown:function(a){var b=u.current,c=({27:"hide",13:"done"})[a.keyCode];c&&b&&b.visible()&&(a.stop(),b[c]())}});var y=a.createElement("style"),z=a.createTextNode("*.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-panel{margin:0;padding:.5em;position:relative;background-color:#EEE;border:1px solid #BBB;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;box-shadow:.15em .3em .5em #BBB;-moz-box-shadow:.15em .3em .5em #BBB;-webkit-box-shadow:.15em .3em .5em #BBB;cursor:default}div.rui-colorpicker .field,div.rui-colorpicker .field *,div.rui-colorpicker .colors,div.rui-colorpicker .colors *{border:none;background:none;width:auto;height:auto;position:static;float:none;top:none;left:none;right:none;bottom:none;margin:0;padding:0;display:block;font-weight:normal;vertical-align:center}div.rui-colorpicker div.field,div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors,div.rui-colorpicker div.colors div.pointer{background:url(/images/rightjs-ui/colorpicker.png) no-repeat 0 0}div.rui-colorpicker div.field,div.rui-colorpicker div.colors,div.rui-colorpicker div.controls{display:inline-block; *display:inline; *zoom:1;position:relative;vertical-align:top;height:150px}div.rui-colorpicker div.field div.pointer,div.rui-colorpicker div.colors div.pointer{position:absolute;top:0px;left:0;width:9px;height:9px}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display,div.rui-colorpicker input.rui-ui-button{font-size:100%;display:block;width:auto;padding:0 .2em}div.rui-colorpicker input.display,div.rui-colorpicker div.preview,div.rui-colorpicker div.rgb-display input,div.rui-colorpicker input.rui-ui-button{border:1px solid #AAA;-moz-border-radius:.2em;-webkit-border-radius:.2em}div.rui-colorpicker div.field{width:150px;background-color:red;cursor:crosshair;margin-right:1.2em}div.rui-colorpicker div.field div.pointer{background-position:-170px 0;margin-left:-2px;margin-top:-2px}div.rui-colorpicker div.colors{width:16px;background-position:-150px 0;border-color:#EEE;cursor:pointer;margin-right:.6em}div.rui-colorpicker div.colors div.pointer{cursor:default;background-position:-170px -20px;margin-left:-8px;margin-top:-3px}div.rui-colorpicker div.controls{width:5em}div.rui-colorpicker div.preview{height:2em;background:white;border-color:#BBB}div.rui-colorpicker input.display{margin-top:.5em;background:#FFF;width:4.5em}div.rui-colorpicker div.rgb-display{padding:0;text-align:right;margin-top:.5em}div.rui-colorpicker div.rgb-display label{display:inline}div.rui-colorpicker div.rgb-display label:after{content:none}div.rui-colorpicker div.rgb-display input{vertical-align:top;font-size:100%;width:2em;text-align:right;margin-left:.2em;padding:0 .2em;background:#FFF;margin-bottom:1px;display:inline}div.rui-colorpicker div.rui-button{cursor:pointer;position:absolute;bottom:0;right:0;width:4em}div.rui-colorpicker-inline{display:inline-block; *display:inline; *zoom:1;position:relative;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;z-index:auto}");y.type="text/css",a.getElementsByTagName("head")[0].appendChild(y),y.styleSheet?y.styleSheet.cssText=z.nodeValue:y.appendChild(z);return u}(document,Math,parseInt,RightJS)