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
data/README.rdoc CHANGED
@@ -32,7 +32,7 @@ Or you can install it as a rails plugin
32
32
  script/plugin install git://github.com/MadRabbit/right-rails.git
33
33
 
34
34
  In case of ruby-gem and Rails 3, add the following into your +Gemfile+
35
-
35
+
36
36
  gem 'right-rails'
37
37
 
38
38
  If you on Rails 2, add the following code into your +environment.rb+
@@ -56,16 +56,16 @@ Enjoy!
56
56
 
57
57
  See the wiki-pages for the documentation
58
58
 
59
- http://wiki.github.com/MadRabbit/right-rails
59
+ https://github.com/MadRabbit/right-rails/wiki
60
60
 
61
61
  See also the demo application for examples
62
62
 
63
63
  http://github.com/MadRabbit/right-rails-demo
64
64
 
65
-
65
+
66
66
 
67
67
 
68
68
 
69
69
  == Copyright
70
70
 
71
- Copyright (c) 2009-2010 Nikolay Nemshilov, released under the MIT license
71
+ Copyright (c) 2009-2011 Nikolay Nemshilov, released under the MIT license
data/Rakefile CHANGED
@@ -89,9 +89,9 @@ namespace :rjs do
89
89
 
90
90
  system(%Q{
91
91
  cd #{RIGHTJS_CORE_DIR};
92
- rake build OPTIONS=no-olds;
92
+ nake build OPTIONS=no-olds;
93
93
  cp build/*.js #{OUTPUT_JSS_DIR};
94
- rake build OPTIONS=safe;
94
+ nake build OPTIONS=safe;
95
95
  cp build/right-safe*.js #{OUTPUT_JSS_DIR};
96
96
  })
97
97
 
@@ -104,7 +104,7 @@ namespace :rjs do
104
104
 
105
105
  system(%Q{
106
106
  cd #{RIGHTJS_PLUGINS_DIR};
107
- rake build;
107
+ nake build;
108
108
  cp build/*.js #{OUTPUT_JSS_DIR}/right;
109
109
  })
110
110
 
@@ -117,7 +117,7 @@ namespace :rjs do
117
117
 
118
118
  system(%Q{
119
119
  cd #{RIGHTJS_UI_DIR};
120
- rake build;
120
+ nake build;
121
121
  cp build/*.js #{OUTPUT_JSS_DIR}/right;
122
122
  })
123
123
 
data/lib/right_rails.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # The RightRails module. Just a namespace
3
3
  #
4
4
  module RightRails
5
- VERSION = '1.0.8'
5
+ VERSION = '1.0.11'
6
6
 
7
7
  autoload :Config, 'right_rails/config'
8
8
  autoload :JavaScriptGenerator, 'right_rails/java_script_generator'
@@ -1,8 +1,8 @@
1
1
  /**
2
- * RightJS-UI: Autocompleter
2
+ * RightJS-UI Autocompleter v2.2.1
3
3
  * http://rightjs.org/ui/autocompleter
4
4
  *
5
- * Copyright (C) 2010 Nikolay Nemshilov
5
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
6
6
  */
7
7
  var Autocompleter = RightJS.Autocompleter = (function(document, RightJS) {
8
8
  /**
@@ -10,29 +10,9 @@ var Autocompleter = RightJS.Autocompleter = (function(document, RightJS) {
10
10
  * it creates an abstract proxy with the common functionality
11
11
  * which then we reuse and override in the actual widgets
12
12
  *
13
- * Copyright (C) 2010 Nikolay Nemshilov
13
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
14
14
  */
15
15
 
16
- /**
17
- * Autocompleter initializer
18
- *
19
- * Copyright (C) 2010 Nikolay Nemshilov
20
- */
21
- var R = RightJS,
22
- $ = RightJS.$,
23
- $w = RightJS.$w,
24
- $E = RightJS.$E,
25
- Xhr = RightJS.Xhr,
26
- RegExp = RightJS.RegExp,
27
- isArray = RightJS.isArray;
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
16
  /**
37
17
  * The widget units constructor
38
18
  *
@@ -51,7 +31,7 @@ function Widget(tag_name, methods) {
51
31
  *
52
32
  * Copyright (C) 2010 Nikolay Nemshilov
53
33
  */
54
- 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, {
55
35
  /**
56
36
  * The common constructor
57
37
  *
@@ -83,7 +63,8 @@ function Widget(tag_name, methods) {
83
63
  options = {};
84
64
  }
85
65
  this.setOptions(options, this);
86
- return this;
66
+
67
+ return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
87
68
  },
88
69
 
89
70
  // protected
@@ -96,12 +77,16 @@ function Widget(tag_name, methods) {
96
77
  * @return void
97
78
  */
98
79
  setOptions: function(options, element) {
99
- element = element || this;
100
- RightJS.Options.setOptions.call(this,
101
- RightJS.Object.merge(options, eval("("+(
80
+ if (element) {
81
+ options = RightJS.Object.merge(options, new Function("return "+(
102
82
  element.get('data-'+ this.key) || '{}'
103
- )+")"))
104
- );
83
+ ))());
84
+ }
85
+
86
+ if (options) {
87
+ RightJS.Options.setOptions.call(this, RightJS.Object.merge(this.options, options));
88
+ }
89
+
105
90
  return this;
106
91
  }
107
92
  });
@@ -110,7 +95,7 @@ function Widget(tag_name, methods) {
110
95
  * Creating the actual widget class
111
96
  *
112
97
  */
113
- var Klass = new RightJS.Wrapper(AbstractWidget, methods);
98
+ var Klass = new RightJS.Class(AbstractWidget, methods);
114
99
 
115
100
  // creating the widget related shortcuts
116
101
  RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
@@ -122,9 +107,9 @@ function Widget(tag_name, methods) {
122
107
  /**
123
108
  * A shared module to create textual spinners
124
109
  *
125
- * Copyright (C) 2010 Nikolay Nemshilov
110
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
126
111
  */
127
- var Spinner = new RightJS.Wrapper(RightJS.Element, {
112
+ var Spinner = new RightJS.Class(RightJS.Element, {
128
113
  /**
129
114
  * Constructor
130
115
  *
@@ -163,30 +148,81 @@ var Spinner = new RightJS.Wrapper(RightJS.Element, {
163
148
  * A shared module that toggles a widget visibility status
164
149
  * in a uniformed way according to the options settings
165
150
  *
166
- * Copyright (C) 2010 Nikolay Nemshilov
151
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
167
152
  */
153
+ var Toggler = {
154
+ /**
155
+ * Shows the element
156
+ *
157
+ * @param String fx-name
158
+ * @param Object fx-options
159
+ * @return Element this
160
+ */
161
+ show: function(fx_name, fx_options) {
162
+ this.constructor.current = this;
163
+ return Toggler_toggle(this, 'show', fx_name, fx_options);
164
+ },
165
+
166
+ /**
167
+ * Hides the element
168
+ *
169
+ * @param String fx-name
170
+ * @param Object fx-options
171
+ * @return Element this
172
+ */
173
+ hide: function(fx_name, fx_options) {
174
+ this.constructor.current = null;
175
+ return Toggler_toggle(this, 'show', fx_name, fx_options);
176
+ },
177
+
178
+ /**
179
+ * Toggles the widget at the given element
180
+ *
181
+ * @param Element the related element
182
+ * @param String position right/bottom (bottom is the default)
183
+ * @param Boolean marker if the element should be resized to the element size
184
+ * @return Widget this
185
+ */
186
+ showAt: function(element, where, resize) {
187
+ this.hide(null).shownAt = element = RightJS.$(element);
188
+
189
+ // moves this element at the given one
190
+ Toggler_re_position.call(this, element, where, resize);
191
+
192
+ return this.show();
193
+ },
194
+
195
+ /**
196
+ * Toggles the widget at the given element
197
+ *
198
+ * @param Element the related element
199
+ * @param String position top/left/right/bottom (bottom is the default)
200
+ * @param Boolean marker if the element should be resized to the element size
201
+ * @return Widget this
202
+ */
203
+ toggleAt: function(element, where, resize) {
204
+ return this.hidden() ? this.showAt(element, where, resize) : this.hide();
205
+ }
206
+ };
207
+
168
208
 
169
209
  /**
170
- * The toggler's common functionality
171
- *
172
- * NOTE: this function getting called in the context
173
- * of a widget
210
+ * toggles the element's state according to the current settings
174
211
  *
175
- * @param Element the element to toggle
176
212
  * @param event String 'show' or 'hide' the event name
177
213
  * @param String an optional fx-name
178
214
  * @param Object an optional fx-options hash
179
215
  * @return void
180
216
  */
181
- function toggler(element, event, fx_name, fx_options) {
217
+ function Toggler_toggle(element, event, fx_name, fx_options) {
182
218
  if (RightJS.Fx) {
183
219
  if (fx_name === undefined) {
184
- fx_name = this.options.fxName;
220
+ fx_name = element.options.fxName;
185
221
 
186
222
  if (fx_options === undefined) {
187
223
  fx_options = {
188
- duration: this.options.fxDuration,
189
- onFinish: RightJS(this.fire).bind(this, event)
224
+ duration: element.options.fxDuration,
225
+ onFinish: RightJS(element.fire).bind(element, event)
190
226
  };
191
227
 
192
228
  // hide on double time
@@ -198,12 +234,10 @@ function toggler(element, event, fx_name, fx_options) {
198
234
  }
199
235
  }
200
236
 
201
- RightJS.Element.prototype[event].call(element, fx_name, fx_options);
202
-
203
237
  // manually trigger the event if no fx were specified
204
- if (!RightJS.Fx || !fx_name) { this.fire(event); }
238
+ if (!RightJS.Fx || !fx_name) { element.fire(event); }
205
239
 
206
- return this;
240
+ return element.$super(fx_name, fx_options);
207
241
  }
208
242
 
209
243
  /**
@@ -218,7 +252,7 @@ function toggler(element, event, fx_name, fx_options) {
218
252
  * @param Boolean if `true` then the element size will be adjusted
219
253
  * @return void
220
254
  */
221
- function re_position(element, where, resize) {
255
+ function Toggler_re_position(element, where, resize) {
222
256
  var anchor = this.reAnchor || (this.reAnchor =
223
257
  new RightJS.Element('div', {'class': 'rui-re-anchor'}))
224
258
  .insert(this),
@@ -248,7 +282,7 @@ function re_position(element, where, resize) {
248
282
  target.moveTo(left, top);
249
283
 
250
284
  if (resize) {
251
- if (['left', 'right'].include(where)) {
285
+ if (where === 'left' || where === 'right') {
252
286
  target.setHeight(height);
253
287
  } else {
254
288
  target.setWidth(width);
@@ -260,76 +294,35 @@ function re_position(element, where, resize) {
260
294
  }
261
295
 
262
296
  /**
263
- * The actual shared module to be inserted in the widgets
297
+ * Autocompleter initializer
264
298
  *
265
299
  * Copyright (C) 2010 Nikolay Nemshilov
266
300
  */
267
- var Toggler = {
268
- /**
269
- * Shows the element
270
- *
271
- * @param String fx-name
272
- * @param Object fx-options
273
- * @return Element this
274
- */
275
- show: function(fx_name, fx_options) {
276
- this.constructor.current = this;
277
- return toggler.call(this, this, 'show', fx_name, fx_options);
278
- },
301
+ var R = RightJS,
302
+ $ = RightJS.$,
303
+ $w = RightJS.$w,
304
+ $E = RightJS.$E,
305
+ Xhr = RightJS.Xhr,
306
+ RegExp = RightJS.RegExp,
307
+ isArray = RightJS.isArray;
308
+
279
309
 
280
- /**
281
- * Hides the element
282
- *
283
- * @param String fx-name
284
- * @param Object fx-options
285
- * @return Element this
286
- */
287
- hide: function(fx_name, fx_options) {
288
- this.constructor.current = null;
289
- return toggler.call(this, this, 'hide', fx_name, fx_options);
290
- },
291
310
 
292
- /**
293
- * Toggles the widget at the given element
294
- *
295
- * @param Element the related element
296
- * @param String position right/bottom (bottom is the default)
297
- * @param Boolean marker if the element should be resized to the element size
298
- * @return Widget this
299
- */
300
- showAt: function(element, where, resize) {
301
- this.hide(null).shownAt = element = RightJS.$(element);
302
311
 
303
- // moves this element at the given one
304
- re_position.call(this, element, where, resize);
305
312
 
306
- return this.show();
307
- },
308
313
 
309
- /**
310
- * Toggles the widget at the given element
311
- *
312
- * @param Element the related element
313
- * @param String position top/left/right/bottom (bottom is the default)
314
- * @param Boolean marker if the element should be resized to the element size
315
- * @return Widget this
316
- */
317
- toggleAt: function(element, where, resize) {
318
- return this.hidden() ? this.showAt(element, where, resize) : this.hide();
319
- }
320
- };
321
314
 
322
315
 
323
316
  /**
324
317
  * The RightJS UI Autocompleter unit base class
325
318
  *
326
- * Copyright (C) 2009-2010 Nikolay Nemshilov
319
+ * Copyright (C) 2009-2011 Nikolay Nemshilov
327
320
  */
328
321
  var Autocompleter = new Widget('UL', {
329
322
  include: Toggler,
330
323
 
331
324
  extend: {
332
- version: '2.0.0',
325
+ version: '2.2.1',
333
326
 
334
327
  EVENTS: $w('show hide update load select done'),
335
328
 
@@ -407,7 +400,8 @@ var Autocompleter = new Widget('UL', {
407
400
  current = current || this.first('li.current');
408
401
 
409
402
  if (current) {
410
- this.input.setValue(R(current.html()).stripTags());
403
+ current.radioClass('current');
404
+ this.input.setValue(current._.textContent || current._.innerText);
411
405
  this.fire('done');
412
406
  }
413
407
 
@@ -492,9 +486,13 @@ var Autocompleter = new Widget('UL', {
492
486
  this.cache[search] = result_text;
493
487
  }
494
488
 
495
- if (!(result_text).blank()) {
489
+ if (!R(result_text).blank()) {
496
490
  this.update(result_text.replace(/<ul[^>]*>|<\/ul>/im, ''));
497
- this.fire('update').showAt(this.input, 'bottom', 'resize');
491
+ this.fire('update');
492
+ if (!this._connected || this.hidden()) {
493
+ this.showAt(this.input, 'bottom', 'resize');
494
+ this._connected = true;
495
+ }
498
496
  } else {
499
497
  this.hide();
500
498
  }
@@ -524,7 +522,7 @@ var Autocompleter = new Widget('UL', {
524
522
 
525
523
  // positioning the native spinner
526
524
  if (spinner instanceof Spinner) {
527
- re_position.call(spinner, this.input, 'right', 'resize');
525
+ Toggler_re_position.call(spinner, this.input, 'right', 'resize');
528
526
  }
529
527
 
530
528
  return spinner;
@@ -610,7 +608,18 @@ $(document).on({
610
608
  });
611
609
 
612
610
 
613
- document.write("<style type=\"text/css\"> *.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}</style>");
611
+ var embed_style = document.createElement('style'),
612
+ embed_rules = document.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}");
613
+
614
+ embed_style.type = 'text/css';
615
+ document.getElementsByTagName('head')[0].appendChild(embed_style);
616
+
617
+ if(embed_style.styleSheet) {
618
+ embed_style.styleSheet.cssText = embed_rules.nodeValue;
619
+ } else {
620
+ embed_style.appendChild(embed_rules);
621
+ }
622
+
614
623
 
615
624
  return Autocompleter;
616
625
  })(document, RightJS);
@@ -1,18 +1,7 @@
1
1
  /**
2
- * RightJS-UI: Autocompleter
2
+ * RightJS-UI Autocompleter v2.2.1
3
3
  * http://rightjs.org/ui/autocompleter
4
4
  *
5
- * Copyright (C) 2010 Nikolay Nemshilov
5
+ * Copyright (C) 2010-2011 Nikolay Nemshilov
6
6
  */
7
- var Autocompleter=RightJS.Autocompleter=function(j,c){function l(a,b,d,e){if(c.Fx)if(d===undefined){d=this.options.fxName;if(e===undefined){e={duration:this.options.fxDuration,onFinish:c(this.fire).bind(this,b)};if(b==="hide")e.duration=(c.Fx.Durations[e.duration]||e.duration)/2}}c.Element.prototype[b].call(a,d,e);if(!c.Fx||!d)this.fire(b);return this}function m(a,b,d){var e=(this.reAnchor||(this.reAnchor=new c.Element("div",{"class":"rui-re-anchor"})).insert(this)).insertTo(a,"after").position(),
8
- f=a.dimensions(),h=parseInt(a.getStyle("borderTopWidth")),i=parseInt(a.getStyle("borderLeftWidth")),q=parseInt(a.getStyle("borderRightWidth")),r=parseInt(a.getStyle("borderBottomWidth"));a=f.top-e.y+h;e=f.left-e.x+i;i=f.width-i-q;f=f.height-h-r;this.setStyle("visibility:hidden").show(null);if(b==="right")e+=i-this.size().x;else a+=f;this.moveTo(e,a);if(d)["left","right"].include(b)?this.setHeight(f):this.setWidth(i);this.setStyle("visibility:visible").hide(null)}var g=c,n=c.$,s=c.$w,t=c.Xhr,o=c.RegExp,
9
- u=c.isArray,p=new c.Wrapper(c.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"});this.dots=[];for(var b=0;b<(a||4);b++)this.dots.push(new c.Element("div"));this.dots[0].addClass("glowing");this.insert(this.dots);c(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a);this.insert(a,"top")}}}),k=new (function(a,b){if(!b){b=a;a="DIV"}var d=new c.Wrapper(c.Element.Wrappers[a]||c.Element,{initialize:function(e,f){this.key=
10
- e;var h=[{"class":"rui-"+e}];this instanceof c.Input||this instanceof c.Form||h.unshift(a);this.$super.apply(this,h);if(c.isString(f))f=c.$(f);if(f instanceof c.Element){this._=f._;if("$listeners"in f)f.$listeners=f.$listeners;f={}}this.setOptions(f,this);return this},setOptions:function(e,f){f=f||this;c.Options.setOptions.call(this,c.Object.merge(e,eval("("+(f.get("data-"+this.key)||"{}")+")")));return this}});d=new c.Wrapper(d,b);c.Observer.createShortcuts(d.prototype,d.EVENTS||[]);return d})("UL",
11
- {include:{show:function(a,b){this.constructor.current=this;return l.call(this,this,"show",a,b)},hide:function(a,b){this.constructor.current=null;return l.call(this,this,"hide",a,b)},showAt:function(a,b,d){this.hide(null).shownAt=a=c.$(a);m.call(this,a,b,d);return this.show()},toggleAt:function(a,b,d){return this.hidden()?this.showAt(a,b,d):this.hide()}},extend:{version:"2.0.0",EVENTS:s("show hide update load select done"),Options:{url:j.location.href,param:"search",method:"get",minLength:1,threshold:200,
12
- cache:true,local:null,fxName:"slide",fxDuration:"short",spinner:"native",cssRule:"input[data-autocompleter]"}},initialize:function(a,b){this.input=n(a);this.$super("autocompleter",b).addClass("rui-dd-menu").onMousedown(this.clicked);this.input.autocompleter=this},destroy:function(){delete this.input.autocompleter;return this},prev:function(){return this.pick("prev")},next:function(){return this.pick("next")},done:function(a){if(a=a||this.first("li.current")){this.input.setValue(g(a.html()).stripTags());
13
- this.fire("done")}return this.hide()},setOptions:function(a){this.$super(a,this.input);a=this.options;g(a.url).includes("%{search}")||(a.url+=(g(a.url).includes("?")?"&":"?")+a.param+"=%{search}")},pick:function(a){var b=this.children(),d=b.first("hasClass","current"),e=b.indexOf(d);if(a=="prev")d=e<1?b.last():b[e<0?0:e-1];else if(a=="next")d=e<0||e==b.length-1?b.first():b[e+1];return this.fire("select",{item:d.radioClass("current")})},clicked:function(a){this.done(a.stop().find("li"))},keypressed:function(){if(this.input.value().length>=
14
- this.options.minLength){this.timeout&&this.timeout.cancel();this.timeout=g(this.trigger).bind(this).delay(this.options.threshold)}else return this.hide()},trigger:function(){this.timeout=null;this.cache=this.cache||{};var a=this.input.value(),b=this.options;if(a.length<b.minLength)return this.hide();if(this.cache[a])this.suggest(this.cache[a],a);else if(u(b.local))this.suggest(this.findLocal(a),a);else this.request=t.load(b.url.replace("%{search}",encodeURIComponent(a)),{method:b.method,spinner:this.getSpinner(),
15
- onComplete:g(function(d){this.fire("load").suggest(d.text,a)}).bind(this)})},suggest:function(a,b){if(this.options.cache)this.cache[b]=a;if(a.blank())this.hide();else{this.update(a.replace(/<ul[^>]*>|<\/ul>/im,""));this.fire("update").showAt(this.input,"bottom","resize")}return this},findLocal:function(a){var b=new o("("+o.escape(a)+")","ig");return g(this.options.local).map(function(d){if(d.match(b))return"<li>"+d.replace(b,"<strong>$1</strong>")+"</li>"}).compact().join("")},getSpinner:function(){var a=
16
- this.options,b=a.spinner;if(b=="native"){b=a.spinner=(new p(3)).insertTo(this);b.addClass("rui-autocompleter-spinner")}b instanceof p&&m.call(b,this.input,"right","resize");return b}});n(j).on({focus:function(a){if((a=a.target)&&a instanceof c.Element&&(a.autocompleter||a.match(k.Options.cssRule)))a.autocompleter||new k(a)},blur:function(a){(a=a.target?a.target.autocompleter:null)&&a.visible()&&a.hide()},keydown:function(a){var b=a.target?a.target.autocompleter:null;if(b&&b.visible()){var d={27:"hide",
17
- 38:"prev",40:"next",13:"done"}[a.keyCode];if(d){a.stop();b[d]()}}},keyup:function(a){var b=a.target?a.target.autocompleter:null;b&&!g([9,27,37,38,39,40,13]).include(a.keyCode)&&b.keypressed(a)}});j.write('<style type="text/css"> *.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}</style>');
18
- return k}(document,RightJS);
7
+ var Autocompleter=RightJS.Autocompleter=function(a,b){function g(a,c,d){var e=this.reAnchor||(this.reAnchor=new b.Element("div",{"class":"rui-re-anchor"})).insert(this),f=e.insertTo(a,"after").position(),g=a.dimensions(),h=this,i=parseInt(a.getStyle("borderTopWidth")),j=parseInt(a.getStyle("borderLeftWidth")),k=parseInt(a.getStyle("borderRightWidth")),l=parseInt(a.getStyle("borderBottomWidth")),m=g.top-f.y+i,n=g.left-f.x+j,o=g.width-j-k,p=g.height-i-l;h.setStyle("visibility:hidden").show(null),c==="right"?n+=o-h.size().x:m+=p,h.moveTo(n,m),d&&(c==="left"||c==="right"?h.setHeight(p):h.setWidth(o)),h.setStyle("visibility:visible").hide(null)}function f(a,c,d,e){b.Fx&&(d===undefined&&(d=a.options.fxName,e===undefined&&(e={duration:a.options.fxDuration,onFinish:b(a.fire).bind(a,c)},c==="hide"&&(e.duration=(b.Fx.Durations[e.duration]||e.duration)/2)))),(!b.Fx||!d)&&a.fire(c);return a.$super(d,e)}function c(a,c){c||(c=a,a="DIV");var d=new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(c,d){this.key=c;var e=[{"class":"rui-"+c}];this instanceof b.Input||this instanceof b.Form||e.unshift(a),this.$super.apply(this,e),b.isString(d)&&(d=b.$(d)),d instanceof b.Element&&(this._=d._,"$listeners"in d&&(d.$listeners=d.$listeners),d={}),this.setOptions(d,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(a,c){c&&(a=b.Object.merge(a,(new Function("return "+(c.get("data-"+this.key)||"{}")))())),a&&b.Options.setOptions.call(this,b.Object.merge(this.options,a));return this}}),e=new b.Class(d,c);b.Observer.createShortcuts(e.prototype,e.EVENTS||[]);return e}var d=new b.Class(b.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"}),this.dots=[];for(var c=0;c<(a||4);c++)this.dots.push(new b.Element("div"));this.dots[0].addClass("glowing"),this.insert(this.dots),b(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a),this.insert(a,"top")}}}),e={show:function(a,b){this.constructor.current=this;return f(this,"show",a,b)},hide:function(a,b){this.constructor.current=null;return f(this,"show",a,b)},showAt:function(a,c,d){this.hide(null).shownAt=a=b.$(a),g.call(this,a,c,d);return this.show()},toggleAt:function(a,b,c){return this.hidden()?this.showAt(a,b,c):this.hide()}},h=b,i=b.$,j=b.$w,k=b.$E,l=b.Xhr,m=b.RegExp,n=b.isArray,o=new c("UL",{include:e,extend:{version:"2.2.1",EVENTS:j("show hide update load select done"),Options:{url:a.location.href,param:"search",method:"get",minLength:1,threshold:200,cache:!0,local:null,fxName:"slide",fxDuration:"short",spinner:"native",cssRule:"input[data-autocompleter]"}},initialize:function(a,b){this.input=i(a),this.$super("autocompleter",b).addClass("rui-dd-menu").onMousedown(this.clicked),this.input.autocompleter=this},destroy:function(){delete this.input.autocompleter;return this},prev:function(){return this.pick("prev")},next:function(){return this.pick("next")},done:function(a){a=a||this.first("li.current"),a&&(a.radioClass("current"),this.input.setValue(a._.textContent||a._.innerText),this.fire("done"));return this.hide()},setOptions:function(a){this.$super(a,this.input),a=this.options,h(a.url).includes("%{search}")||(a.url+=(h(a.url).includes("?")?"&":"?")+a.param+"=%{search}")},pick:function(a){var b=this.children(),c=b.first("hasClass","current"),d=b.indexOf(c);a=="prev"?c=d<1?b.last():b[d<0?0:d-1]:a=="next"&&(c=d<0||d==b.length-1?b.first():b[d+1]);return this.fire("select",{item:c.radioClass("current")})},clicked:function(a){this.done(a.stop().find("li"))},keypressed:function(a){if(this.input.value().length<this.options.minLength)return this.hide();this.timeout&&this.timeout.cancel(),this.timeout=h(this.trigger).bind(this).delay(this.options.threshold)},trigger:function(){this.timeout=null,this.cache=this.cache||{};var a=this.input.value(),b=this.options;if(a.length<b.minLength)return this.hide();this.cache[a]?this.suggest(this.cache[a],a):n(b.local)?this.suggest(this.findLocal(a),a):this.request=l.load(b.url.replace("%{search}",encodeURIComponent(a)),{method:b.method,spinner:this.getSpinner(),onComplete:h(function(b){this.fire("load").suggest(b.text,a)}).bind(this)})},suggest:function(a,b){this.options.cache&&(this.cache[b]=a);if(h(a).blank())this.hide();else{this.update(a.replace(/<ul[^>]*>|<\/ul>/im,"")),this.fire("update");if(!this._connected||this.hidden())this.showAt(this.input,"bottom","resize"),this._connected=!0}return this},findLocal:function(a){var b=new m("("+m.escape(a)+")","ig");return h(this.options.local).map(function(a){if(a.match(b))return"<li>"+a.replace(b,"<strong>$1</strong>")+"</li>"}).compact().join("")},getSpinner:function(){var a=this.options,b=a.spinner;b=="native"&&(b=a.spinner=(new d(3)).insertTo(this),b.addClass("rui-autocompleter-spinner")),b instanceof d&&g.call(b,this.input,"right","resize");return b}});i(a).on({focus:function(a){var c=a.target;c&&c instanceof b.Element&&(c.autocompleter||c.match(o.Options.cssRule))&&(c.autocompleter||new o(c))},blur:function(a){var b=a.target?a.target.autocompleter:null;b&&b.visible()&&b.hide()},keydown:function(a){var b=a.target?a.target.autocompleter:null;if(b&&b.visible()){var c=({27:"hide",38:"prev",40:"next",13:"done"})[a.keyCode];c&&(a.stop(),b[c]())}},keyup:function(a){var b=a.target?a.target.autocompleter:null;b&&!h([9,27,37,38,39,40,13]).include(a.keyCode)&&b.keypressed(a)}});var p=a.createElement("style"),q=a.createTextNode("*.rui-dd-menu, *.rui-dd-menu li{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none} *.rui-dd-menu{display:none;position:absolute;z-index:9999;background:white;border:1px solid #BBB;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;box-shadow:#DDD .2em .2em .4em;-moz-box-shadow:#DDD .2em .2em .4em;-webkit-box-shadow:#DDD .2em .2em .4em} *.rui-dd-menu li{padding:.2em .4em;border-top:none;border-bottom:none;cursor:pointer} *.rui-dd-menu li.current{background:#DDD} *.rui-dd-menu li:hover{background:#EEE}dl.rui-dd-menu dt{padding:.3em .5em;cursor:default;font-weight:bold;font-style:italic;color:#444;background:#EEE}dl.rui-dd-menu dd li{padding-left:1.5em}div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}.rui-autocompleter{border-top-color:#DDD !important;border-top-left-radius:0 !important;border-top-right-radius:0 !important;-moz-border-radius-topleft:0 !important;-moz-border-radius-topright:0 !important;-webkit-border-top-left-radius:0 !important;-webkit-border-top-right-radius:0 !important}.rui-autocompleter-spinner{border:none !important;background:none !important;position:absolute;z-index:9999}.rui-autocompleter-spinner div{margin-top:.2em !important; *margin-top:0.1em !important}");p.type="text/css",a.getElementsByTagName("head")[0].appendChild(p),p.styleSheet?p.styleSheet.cssText=q.nodeValue:p.appendChild(q);return o}(document,RightJS)