right-rails 0.6.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/CHANGELOG +8 -0
  2. data/README.rdoc +71 -0
  3. data/Rakefile +144 -14
  4. data/generators/right_rails/right_rails_generator.rb +18 -21
  5. data/init.rb +11 -32
  6. data/lib/generators/right_rails/right_rails_generator.rb +27 -0
  7. data/lib/generators/right_rails/templates/iframed.html.erb +10 -0
  8. data/lib/right-rails.rb +1 -1
  9. data/lib/right_rails/config.rb +278 -0
  10. data/lib/right_rails/controller_extensions.rb +10 -5
  11. data/lib/right_rails/helpers/basic.rb +10 -66
  12. data/lib/right_rails/helpers/forms.rb +141 -139
  13. data/lib/right_rails/helpers/misc.rb +45 -67
  14. data/lib/right_rails/helpers/rails.rb +40 -105
  15. data/lib/right_rails/helpers.rb +364 -1
  16. data/lib/right_rails/java_script_generator.rb +34 -24
  17. data/lib/right_rails.rb +6 -1
  18. data/{images → public/images}/colorpicker.png +0 -0
  19. data/{images → public/images}/resizable.png +0 -0
  20. data/public/javascripts/right/autocompleter-src.js +612 -0
  21. data/public/javascripts/right/autocompleter.js +18 -0
  22. data/public/javascripts/right/calendar-src.js +1448 -0
  23. data/public/javascripts/right/calendar.js +36 -0
  24. data/public/javascripts/right/colorpicker-src.js +967 -0
  25. data/public/javascripts/right/colorpicker.js +26 -0
  26. data/{javascripts/right-dnd-src.js → public/javascripts/right/dnd-src.js} +86 -52
  27. data/public/javascripts/right/dnd.js +20 -0
  28. data/{javascripts/right-effects-src.js → public/javascripts/right/effects-src.js} +90 -45
  29. data/public/javascripts/right/effects.js +17 -0
  30. data/{javascripts/right-ui-i18n-de.js → public/javascripts/right/i18n/de.js} +7 -7
  31. data/{javascripts/right-ui-i18n-en-us.js → public/javascripts/right/i18n/en-us.js} +1 -1
  32. data/{javascripts/right-ui-i18n-es.js → public/javascripts/right/i18n/es.js} +7 -7
  33. data/{javascripts/right-ui-i18n-fr.js → public/javascripts/right/i18n/fr.js} +7 -7
  34. data/{javascripts/right-ui-i18n-hu.js → public/javascripts/right/i18n/hu.js} +7 -7
  35. data/{javascripts/right-ui-i18n-jp.js → public/javascripts/right/i18n/jp.js} +7 -7
  36. data/{javascripts/right-ui-i18n-nl.js → public/javascripts/right/i18n/nl.js} +7 -7
  37. data/{javascripts/right-ui-i18n-pt-br.js → public/javascripts/right/i18n/pt-br.js} +7 -7
  38. data/{javascripts/right-ui-i18n-ru.js → public/javascripts/right/i18n/ru.js} +7 -7
  39. data/{javascripts/right-ui-i18n-ua.js → public/javascripts/right/i18n/ua.js} +17 -12
  40. data/public/javascripts/right/in-edit-src.js +352 -0
  41. data/public/javascripts/right/in-edit.js +13 -0
  42. data/public/javascripts/right/json-src.js +160 -0
  43. data/public/javascripts/right/json.js +10 -0
  44. data/public/javascripts/right/lightbox-src.js +881 -0
  45. data/public/javascripts/right/lightbox.js +24 -0
  46. data/{javascripts/right-rails-src.js → public/javascripts/right/rails-src.js} +195 -171
  47. data/public/javascripts/right/rails.js +14 -0
  48. data/public/javascripts/right/rater-src.js +366 -0
  49. data/public/javascripts/right/rater.js +13 -0
  50. data/public/javascripts/right/resizable-src.js +420 -0
  51. data/public/javascripts/right/resizable.js +15 -0
  52. data/public/javascripts/right/selectable-src.js +687 -0
  53. data/public/javascripts/right/selectable.js +22 -0
  54. data/public/javascripts/right/slider-src.js +377 -0
  55. data/public/javascripts/right/slider.js +14 -0
  56. data/public/javascripts/right/sortable-src.js +392 -0
  57. data/public/javascripts/right/sortable.js +16 -0
  58. data/public/javascripts/right/tabs-src.js +1123 -0
  59. data/public/javascripts/right/tabs.js +29 -0
  60. data/public/javascripts/right/tooltip-src.js +307 -0
  61. data/public/javascripts/right/tooltip.js +12 -0
  62. data/public/javascripts/right/uploader-src.js +283 -0
  63. data/public/javascripts/right/uploader.js +13 -0
  64. data/{javascripts → public/javascripts}/right-olds-src.js +134 -186
  65. data/public/javascripts/right-olds.js +18 -0
  66. data/public/javascripts/right-safe-src.js +161 -0
  67. data/public/javascripts/right-safe.js +8 -0
  68. data/{javascripts → public/javascripts}/right-src.js +2558 -1750
  69. data/public/javascripts/right.js +92 -0
  70. data/spec/lib/right_rails/config_spec.rb +133 -0
  71. data/spec/lib/right_rails/controller_extensions_spec.rb +1 -1
  72. data/spec/lib/right_rails/helpers/basic_spec.rb +77 -66
  73. data/spec/lib/right_rails/helpers/forms_spec.rb +231 -33
  74. data/spec/lib/right_rails/helpers/misc_spec.rb +94 -26
  75. data/spec/lib/right_rails/helpers/rails_spec.rb +42 -7
  76. data/spec/lib/right_rails/helpers_spec.rb +125 -0
  77. data/spec/lib/right_rails/java_script_generator_spec.rb +30 -0
  78. data/spec/rcov.opts +3 -0
  79. data/spec/spec_helper.rb +12 -7
  80. metadata +70 -61
  81. data/README.textile +0 -69
  82. data/javascripts/right-autocompleter-src.js +0 -318
  83. data/javascripts/right-autocompleter.js +0 -9
  84. data/javascripts/right-behavior-src.js +0 -261
  85. data/javascripts/right-behavior.js +0 -8
  86. data/javascripts/right-calendar-src.js +0 -946
  87. data/javascripts/right-calendar.js +0 -9
  88. data/javascripts/right-colorpicker-src.js +0 -635
  89. data/javascripts/right-colorpicker.js +0 -9
  90. data/javascripts/right-dnd.js +0 -9
  91. data/javascripts/right-effects.js +0 -6
  92. data/javascripts/right-events-src.js +0 -321
  93. data/javascripts/right-events.js +0 -6
  94. data/javascripts/right-in-edit-src.js +0 -194
  95. data/javascripts/right-in-edit.js +0 -6
  96. data/javascripts/right-json-src.js +0 -141
  97. data/javascripts/right-json.js +0 -6
  98. data/javascripts/right-lightbox-src.js +0 -651
  99. data/javascripts/right-lightbox.js +0 -9
  100. data/javascripts/right-olds.js +0 -9
  101. data/javascripts/right-rails.js +0 -9
  102. data/javascripts/right-rater-src.js +0 -253
  103. data/javascripts/right-rater.js +0 -9
  104. data/javascripts/right-resizable-src.js +0 -336
  105. data/javascripts/right-resizable.js +0 -9
  106. data/javascripts/right-selectable-src.js +0 -565
  107. data/javascripts/right-selectable.js +0 -7
  108. data/javascripts/right-slider-src.js +0 -288
  109. data/javascripts/right-slider.js +0 -7
  110. data/javascripts/right-sortable-src.js +0 -225
  111. data/javascripts/right-sortable.js +0 -9
  112. data/javascripts/right-tabs-src.js +0 -937
  113. data/javascripts/right-tabs.js +0 -6
  114. data/javascripts/right-tooltips-src.js +0 -195
  115. data/javascripts/right-tooltips.js +0 -9
  116. data/javascripts/right-uploader-src.js +0 -167
  117. data/javascripts/right-uploader.js +0 -9
  118. data/javascripts/right.js +0 -7
@@ -0,0 +1,420 @@
1
+ /**
2
+ * Resizable unit for RightJS
3
+ * http://rightjs.org/ui/resizable
4
+ *
5
+ * Copyright (C) 2010 Nikolay Nemshilov
6
+ */
7
+ var Resizable = RightJS.Resizable = (function(document, RightJS) {
8
+ /**
9
+ * This module defines the basic widgets constructor
10
+ * it creates an abstract proxy with the common functionality
11
+ * which then we reuse and override in the actual widgets
12
+ *
13
+ * Copyright (C) 2010 Nikolay Nemshilov
14
+ */
15
+
16
+ /**
17
+ * The filenames to include
18
+ *
19
+ * Copyright (C) 2010 Nikolay Nemshilov
20
+ */
21
+ var R = RightJS,
22
+ $ = RightJS.$,
23
+ $w = RightJS.$w,
24
+ $E = RightJS.$E,
25
+ Wrapper = RightJS.Wrapper,
26
+ Element = RightJS.Element;
27
+
28
+
29
+
30
+
31
+ /**
32
+ * The widget units constructor
33
+ *
34
+ * @param String tag-name or Object methods
35
+ * @param Object methods
36
+ * @return Widget wrapper
37
+ */
38
+ function Widget(tag_name, methods) {
39
+ if (!methods) {
40
+ methods = tag_name;
41
+ tag_name = 'DIV';
42
+ }
43
+
44
+ /**
45
+ * An Abstract Widget Unit
46
+ *
47
+ * Copyright (C) 2010 Nikolay Nemshilov
48
+ */
49
+ var AbstractWidget = new RightJS.Wrapper(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
50
+ /**
51
+ * The common constructor
52
+ *
53
+ * @param Object options
54
+ * @param String optional tag name
55
+ * @return void
56
+ */
57
+ initialize: function(key, options) {
58
+ this.key = key;
59
+ var args = [{'class': 'rui-' + key}];
60
+
61
+ // those two have different constructors
62
+ if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
63
+ args.unshift(tag_name);
64
+ }
65
+ this.$super.apply(this, args);
66
+
67
+ if (RightJS.isString(options)) {
68
+ options = RightJS.$(options);
69
+ }
70
+
71
+ // if the options is another element then
72
+ // try to dynamically rewrap it with our widget
73
+ if (options instanceof RightJS.Element) {
74
+ this._ = options._;
75
+ if ('$listeners' in options) {
76
+ options.$listeners = options.$listeners;
77
+ }
78
+ options = {};
79
+ }
80
+ this.setOptions(options, this);
81
+ return this;
82
+ },
83
+
84
+ // protected
85
+
86
+ /**
87
+ * Catches the options
88
+ *
89
+ * @param Object user-options
90
+ * @param Element element with contextual options
91
+ * @return void
92
+ */
93
+ setOptions: function(options, element) {
94
+ element = element || this;
95
+ RightJS.Options.setOptions.call(this,
96
+ RightJS.Object.merge(options, eval("("+(
97
+ element.get('data-'+ this.key) || '{}'
98
+ )+")"))
99
+ );
100
+ return this;
101
+ }
102
+ });
103
+
104
+ /**
105
+ * Creating the actual widget class
106
+ *
107
+ */
108
+ var Klass = new RightJS.Wrapper(AbstractWidget, methods);
109
+
110
+ // creating the widget related shortcuts
111
+ RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
112
+
113
+ return Klass;
114
+ }
115
+
116
+
117
+ /**
118
+ * The resizable unit main file
119
+ *
120
+ * Copyright (C) 2010 Nikolay Nemshilov
121
+ */
122
+ var Resizable = new Widget({
123
+ extend: {
124
+ version: '2.0.0',
125
+
126
+ EVENTS: $w('resize start release'),
127
+
128
+ Options: {
129
+ direction: null, // 'top', 'left', 'right', 'bottom', null for bidrectional
130
+
131
+ minWidth: null,
132
+ maxWidth: null,
133
+ minHeight: null,
134
+ maxHeight: null
135
+ }
136
+ },
137
+
138
+ /**
139
+ * Basic constructor
140
+ *
141
+ * @param Element reference
142
+ * @param Object options
143
+ * @return void
144
+ */
145
+ initialize: function(element, options) {
146
+ this
147
+ .$super('resizable', this.old_inst = $(element))
148
+ .setOptions(options);
149
+
150
+ if (this.options.direction) {
151
+ this.addClass('rui-resizable-'+ this.options.direction);
152
+ } else {
153
+ this.addClass('rui-resizable');
154
+ }
155
+
156
+ // initializing the inner structure
157
+ this.content = this.first('.rui-resizable-content') ||
158
+ $E('div', {'class': 'rui-resizable-content'}).insert(this._.childNodes).insertTo(this);
159
+ this.handle = this.first('.rui-resizable-handle') ||
160
+ $E('div', {'class': 'rui-resizable-handle'}).insertTo(this);
161
+ },
162
+
163
+ /**
164
+ * destructor
165
+ *
166
+ * @return Resizable this
167
+ */
168
+ destroy: function() {
169
+ this
170
+ .removeClass('rui-resizable')
171
+ .removeClass('rui-resizable-top')
172
+ .removeClass('rui-resizable-left')
173
+ .removeClass('rui-resizable-right')
174
+ .removeClass('rui-resizable-bottom')
175
+ .insert(this.content._.childNodes);
176
+
177
+ this.content.remove();
178
+ this.handle.remove();
179
+
180
+ // swapping the old element back
181
+ if (this.old_inst) {
182
+ Wrapper.Cache[$uid(this._)] = this.old_inst;
183
+ }
184
+
185
+ return this;
186
+ },
187
+
188
+ /**
189
+ * Overriding the method to recognize the direction
190
+ * option from the element class-name
191
+ *
192
+ * @param Object options
193
+ * @return Resizable this
194
+ */
195
+ setOptions: function(options, context) {
196
+ options = options || {};
197
+
198
+ // trying to recognize the direction
199
+ $w('top left right bottom').each(function(direction) {
200
+ if (this.hasClass('rui-resizable-'+ direction)) {
201
+ options.direction = direction;
202
+ }
203
+ }, this);
204
+
205
+ return this.$super(options, context);
206
+ },
207
+
208
+ /**
209
+ * Starts the resizing process
210
+ *
211
+ * @param Event mouse event
212
+ */
213
+ start: function(event) {
214
+ this.prevSizes = this.size();
215
+ this.prevEvPos = event.position();
216
+
217
+ // used later during the resize process
218
+ this.contXDiff = this.size().x - this.content.size().x;
219
+ this.contYDiff = this.size().y - this.content.size().y;
220
+
221
+ // trying to recognize the boundaries
222
+ $w('minWidth maxWidth minHeight maxHeight').each(function(dimension) {
223
+ this[dimension] = this.findDim(dimension);
224
+ }, this);
225
+
226
+ return this.fire('start', event);
227
+ },
228
+
229
+ /**
230
+ * Tracks the event during the resize process
231
+ *
232
+ * @param Event mouse event
233
+ */
234
+ track: function(event) {
235
+ var event_pos = event.position(), prev_pos = this.prevEvPos,
236
+ handle = this.handle.dimensions(),
237
+ prev_size = this.prevSizes, width = prev_size.x, height = prev_size.y,
238
+ x_diff = prev_pos.x - event_pos.x,
239
+ y_diff = prev_pos.y - event_pos.y,
240
+ min_x = this.minWidth,
241
+ max_x = this.maxWidth,
242
+ min_y = this.minHeight,
243
+ max_y = this.maxHeight,
244
+ options = this.options,
245
+ direction = options.direction;
246
+
247
+ // calculating the new size
248
+ width += (direction === 'left' ? 1 : -1) * x_diff;
249
+ height += (direction === 'top' ? 1 : -1) * y_diff;
250
+
251
+ // applying the boundaries
252
+ if (width < min_x) { width = min_x; }
253
+ if (width > max_x) { width = max_x; }
254
+ if (height < min_y) { height = min_y; }
255
+ if (height > max_y) { height = max_y; }
256
+
257
+ // applying the sizes
258
+ if (prev_size.x !== width && direction !== 'top' && direction !== 'bottom') {
259
+ this.setWidth(width);
260
+ }
261
+ if (prev_size.y !== height && direction !== 'left' && direction !== 'right') {
262
+ this.setHeight(height);
263
+ }
264
+
265
+ // adjusting the previous cursor position so that it didn't had a shift
266
+ if (width == min_x || width == max_x) {
267
+ event_pos.x = handle.left + handle.width / 2;
268
+ }
269
+ if (height == min_y || height == max_y) {
270
+ event_pos.y = handle.top + handle.height / 2;
271
+ }
272
+
273
+ this.prevEvPos = event_pos;
274
+ this.prevSizes = this.size();
275
+
276
+ this.fire('resize', event);
277
+ },
278
+
279
+ /**
280
+ * Sets the width of the widget
281
+ *
282
+ * @param Number width
283
+ * @return Resizable this
284
+ */
285
+ setWidth: function(width) {
286
+ this.content.setWidth(width - this.contXDiff);
287
+ return this.$super(width);
288
+ },
289
+
290
+ /**
291
+ * Sets the height of the widget
292
+ *
293
+ * @param Number height
294
+ * @return Resizable this
295
+ */
296
+ setHeight: function(height) {
297
+ this.content.setHeight(height - this.contYDiff);
298
+ return this.$super(height);
299
+ },
300
+
301
+ /**
302
+ * Marks it the end of the action
303
+ *
304
+ * @return Resizable this
305
+ */
306
+ release: function(event) {
307
+ return this.fire('release', event);
308
+ },
309
+
310
+ /**
311
+ * Overloading the standard method so that it was sending
312
+ * current instance as an argument
313
+ *
314
+ * @param String event name
315
+ * @return Resizable this
316
+ */
317
+ fire: function(event, dom_event) {
318
+ return this.$super(event, this, dom_event);
319
+ },
320
+
321
+ // protected
322
+
323
+ // finds dimensions of the element
324
+ findDim: function(dimension) {
325
+ var style = this.options[dimension] || this.getStyle(dimension);
326
+
327
+ if (style && /\d+/.test(style) && parseFloat(style) > 0) {
328
+ var what = R(dimension).include('Width') ? 'width' : 'height',
329
+ dummy = (this._dummy || (this._dummy = $E('div', {
330
+ style: 'visibility:hidden;z-index:-1'
331
+ })))
332
+ .setStyle(what, style)
333
+ .insertTo(this, 'before');
334
+
335
+ var size = dummy._['offset' + R(what).capitalize()];
336
+ dummy.remove();
337
+
338
+ return size;
339
+ }
340
+ }
341
+ });
342
+
343
+ /**
344
+ * Document level hooks for resizables
345
+ *
346
+ * Copyright (C) 2010 Nikolay Nemshilov
347
+ */
348
+ $(document).on({
349
+ mousedown: function(event) {
350
+ var handle = event.find('.rui-resizable-handle');
351
+ if (handle) {
352
+ var resizable = handle.parent();
353
+
354
+ if (resizable instanceof Element) {
355
+ resizable = new Resizable(resizable);
356
+ }
357
+
358
+ Resizable.current = resizable.start(event.stop());
359
+ }
360
+ },
361
+
362
+ mousemove: function(event) {
363
+ var resizable = Resizable.current;
364
+ if (resizable) {
365
+ resizable.track(event);
366
+ }
367
+ },
368
+
369
+ mouseup: function(event) {
370
+ var resizable = Resizable.current;
371
+
372
+ if (resizable) {
373
+ resizable.release(event);
374
+ Resizable.current = null;
375
+ }
376
+ }
377
+ });
378
+
379
+ $(window).onBlur(function(event) {
380
+ var resizable = Resizable.current;
381
+ if (resizable) {
382
+ resizable.release(event);
383
+ Resizable.current = null;
384
+ }
385
+ });
386
+
387
+ /**
388
+ * Element level hook to make things resizable
389
+ *
390
+ * Copyright (C) 2010 Nikolay Nemshilov
391
+ */
392
+ Element.include({
393
+ /**
394
+ * Makes a resizeable out of the element
395
+ *
396
+ * @param Object options
397
+ * @return Element this
398
+ */
399
+ makeResizable: function(options) {
400
+ new Resizable(this, options);
401
+ return this;
402
+ },
403
+
404
+ /**
405
+ * Destroys a resizable functionality
406
+ *
407
+ * @return Element this
408
+ */
409
+ undoResizable: function() {
410
+ if (this instanceof Resizable) {
411
+ this.destroy();
412
+ }
413
+ return this;
414
+ }
415
+ });
416
+
417
+ document.write("<style type=\"text/css\">.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/images/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}</style>");
418
+
419
+ return Resizable;
420
+ })(document, RightJS);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Resizable unit for RightJS
3
+ * http://rightjs.org/ui/resizable
4
+ *
5
+ * Copyright (C) 2010 Nikolay Nemshilov
6
+ */
7
+ var Resizable=RightJS.Resizable=function(r,c){var k=c.$,l=c.$w,m=c.$E,t=c.Wrapper,s=c.Element,g=new (function(a,b){if(!b){b=a;a="DIV"}var f=new c.Wrapper(c.Element.Wrappers[a]||c.Element,{initialize:function(h,d){this.key=h;var e=[{"class":"rui-"+h}];this instanceof c.Input||this instanceof c.Form||e.unshift(a);this.$super.apply(this,e);if(c.isString(d))d=c.$(d);if(d instanceof c.Element){this._=d._;if("$listeners"in d)d.$listeners=d.$listeners;d={}}this.setOptions(d,this);return this},setOptions:function(h,
8
+ d){d=d||this;c.Options.setOptions.call(this,c.Object.merge(h,eval("("+(d.get("data-"+this.key)||"{}")+")")));return this}});f=new c.Wrapper(f,b);c.Observer.createShortcuts(f.prototype,f.EVENTS||[]);return f})({extend:{version:"2.0.0",EVENTS:l("resize start release"),Options:{direction:null,minWidth:null,maxWidth:null,minHeight:null,maxHeight:null}},initialize:function(a,b){this.$super("resizable",this.old_inst=k(a)).setOptions(b);this.options.direction?this.addClass("rui-resizable-"+this.options.direction):
9
+ this.addClass("rui-resizable");this.content=this.first(".rui-resizable-content")||m("div",{"class":"rui-resizable-content"}).insert(this._.childNodes).insertTo(this);this.handle=this.first(".rui-resizable-handle")||m("div",{"class":"rui-resizable-handle"}).insertTo(this)},destroy:function(){this.removeClass("rui-resizable").removeClass("rui-resizable-top").removeClass("rui-resizable-left").removeClass("rui-resizable-right").removeClass("rui-resizable-bottom").insert(this.content._.childNodes);this.content.remove();
10
+ this.handle.remove();if(this.old_inst)t.Cache[$uid(this._)]=this.old_inst;return this},setOptions:function(a,b){a=a||{};l("top left right bottom").each(function(f){if(this.hasClass("rui-resizable-"+f))a.direction=f},this);return this.$super(a,b)},start:function(a){this.prevSizes=this.size();this.prevEvPos=a.position();this.contXDiff=this.size().x-this.content.size().x;this.contYDiff=this.size().y-this.content.size().y;l("minWidth maxWidth minHeight maxHeight").each(function(b){this[b]=this.findDim(b)},
11
+ this);return this.fire("start",a)},track:function(a){var b=a.position(),f=this.prevEvPos,h=this.handle.dimensions(),d=this.prevSizes,e=d.x,i=d.y,u=f.y-b.y,n=this.minWidth,o=this.maxWidth,p=this.minHeight,q=this.maxHeight,j=this.options.direction;e+=(j==="left"?1:-1)*(f.x-b.x);i+=(j==="top"?1:-1)*u;if(e<n)e=n;if(e>o)e=o;if(i<p)i=p;if(i>q)i=q;d.x!==e&&j!=="top"&&j!=="bottom"&&this.setWidth(e);d.y!==i&&j!=="left"&&j!=="right"&&this.setHeight(i);if(e==n||e==o)b.x=h.left+h.width/2;if(i==p||i==q)b.y=h.top+
12
+ h.height/2;this.prevEvPos=b;this.prevSizes=this.size();this.fire("resize",a)},setWidth:function(a){this.content.setWidth(a-this.contXDiff);return this.$super(a)},setHeight:function(a){this.content.setHeight(a-this.contYDiff);return this.$super(a)},release:function(a){return this.fire("release",a)},fire:function(a,b){return this.$super(a,this,b)},findDim:function(a){var b=this.options[a]||this.getStyle(a);if(b&&/\d+/.test(b)&&parseFloat(b)>0){a=c(a).include("Width")?"width":"height";b=(this._dummy||
13
+ (this._dummy=m("div",{style:"visibility:hidden;z-index:-1"}))).setStyle(a,b).insertTo(this,"before");a=b._["offset"+c(a).capitalize()];b.remove();return a}}});k(r).on({mousedown:function(a){var b=a.find(".rui-resizable-handle");if(b){b=b.parent();if(b instanceof s)b=new g(b);g.current=b.start(a.stop())}},mousemove:function(a){var b=g.current;b&&b.track(a)},mouseup:function(a){var b=g.current;if(b){b.release(a);g.current=null}}});k(window).onBlur(function(a){var b=g.current;if(b){b.release(a);g.current=
14
+ null}});s.include({makeResizable:function(a){new g(this,a);return this},undoResizable:function(){this instanceof g&&this.destroy();return this}});r.write('<style type="text/css">.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom,.rui-resizable-content .rui-resizable-handle{margin:0;padding:0;overflow:none;border:none;background:none;width:auto;height:auto;min-width:none;max-width:none;min-height:none;max-height:none}.rui-resizable,.rui-resizable-top,.rui-resizable-left,.rui-resizable-right,.rui-resizable-bottom{position:relative;min-width:8em;min-height:8em;border:1px solid #DDD}.rui-resizable-content{overflow:auto;padding:.5em;position:relative}.rui-resizable-handle{position:absolute;background-image:url(/images/rightjs-ui/resizable.png);background-repeat:no-repeat;background-color:#DDD;cursor:move}.rui-resizable .rui-resizable-handle{right:0;bottom:0;background-position:-2px -2px;background-color:transparent;width:16px;height:16px}.rui-resizable-top .rui-resizable-handle,.rui-resizable-bottom .rui-resizable-handle{height:8px;width:100%;background-position:center -26px;cursor:row-resize}.rui-resizable-left .rui-resizable-handle,.rui-resizable-right .rui-resizable-handle{top:0px;width:8px;height:100%;background-position:-26px center;cursor:col-resize}.rui-resizable-top .rui-resizable-content{padding-top:1em}.rui-resizable-top .rui-resizable-handle{top:0}.rui-resizable-bottom .rui-resizable-content{padding-bottom:1em}.rui-resizable-bottom .rui-resizable-handle{bottom:0}.rui-resizable-left .rui-resizable-content{padding-left:1em}.rui-resizable-left .rui-resizable-handle{left:0}.rui-resizable-right .rui-resizable-content{padding-right:1em}.rui-resizable-right .rui-resizable-handle{right:0}</style>');
15
+ return g}(document,RightJS);