jqueryui-requirejs-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/LICENSE +22 -0
  2. data/README.md +3 -0
  3. data/Rakefile +27 -0
  4. data/app/assets/javascripts/jqueryui/accordion.js +575 -0
  5. data/app/assets/javascripts/jqueryui/autocomplete.js +613 -0
  6. data/app/assets/javascripts/jqueryui/button.js +422 -0
  7. data/app/assets/javascripts/jqueryui/core.js +323 -0
  8. data/app/assets/javascripts/jqueryui/datepicker-af.js +26 -0
  9. data/app/assets/javascripts/jqueryui/datepicker-ar-DZ.js +26 -0
  10. data/app/assets/javascripts/jqueryui/datepicker-ar.js +26 -0
  11. data/app/assets/javascripts/jqueryui/datepicker-az.js +26 -0
  12. data/app/assets/javascripts/jqueryui/datepicker-be.js +26 -0
  13. data/app/assets/javascripts/jqueryui/datepicker-bg.js +27 -0
  14. data/app/assets/javascripts/jqueryui/datepicker-bs.js +26 -0
  15. data/app/assets/javascripts/jqueryui/datepicker-ca.js +26 -0
  16. data/app/assets/javascripts/jqueryui/datepicker-cs.js +26 -0
  17. data/app/assets/javascripts/jqueryui/datepicker-cy-GB.js +26 -0
  18. data/app/assets/javascripts/jqueryui/datepicker-da.js +26 -0
  19. data/app/assets/javascripts/jqueryui/datepicker-de.js +26 -0
  20. data/app/assets/javascripts/jqueryui/datepicker-el.js +26 -0
  21. data/app/assets/javascripts/jqueryui/datepicker-en-AU.js +26 -0
  22. data/app/assets/javascripts/jqueryui/datepicker-en-GB.js +26 -0
  23. data/app/assets/javascripts/jqueryui/datepicker-en-NZ.js +26 -0
  24. data/app/assets/javascripts/jqueryui/datepicker-eo.js +26 -0
  25. data/app/assets/javascripts/jqueryui/datepicker-es.js +26 -0
  26. data/app/assets/javascripts/jqueryui/datepicker-et.js +26 -0
  27. data/app/assets/javascripts/jqueryui/datepicker-eu.js +26 -0
  28. data/app/assets/javascripts/jqueryui/datepicker-fa.js +62 -0
  29. data/app/assets/javascripts/jqueryui/datepicker-fi.js +26 -0
  30. data/app/assets/javascripts/jqueryui/datepicker-fo.js +26 -0
  31. data/app/assets/javascripts/jqueryui/datepicker-fr-CA.js +26 -0
  32. data/app/assets/javascripts/jqueryui/datepicker-fr-CH.js +26 -0
  33. data/app/assets/javascripts/jqueryui/datepicker-fr.js +28 -0
  34. data/app/assets/javascripts/jqueryui/datepicker-gl.js +26 -0
  35. data/app/assets/javascripts/jqueryui/datepicker-he.js +26 -0
  36. data/app/assets/javascripts/jqueryui/datepicker-hi.js +26 -0
  37. data/app/assets/javascripts/jqueryui/datepicker-hr.js +26 -0
  38. data/app/assets/javascripts/jqueryui/datepicker-hu.js +26 -0
  39. data/app/assets/javascripts/jqueryui/datepicker-hy.js +26 -0
  40. data/app/assets/javascripts/jqueryui/datepicker-id.js +26 -0
  41. data/app/assets/javascripts/jqueryui/datepicker-is.js +26 -0
  42. data/app/assets/javascripts/jqueryui/datepicker-it.js +26 -0
  43. data/app/assets/javascripts/jqueryui/datepicker-ja.js +26 -0
  44. data/app/assets/javascripts/jqueryui/datepicker-ka.js +24 -0
  45. data/app/assets/javascripts/jqueryui/datepicker-kk.js +26 -0
  46. data/app/assets/javascripts/jqueryui/datepicker-km.js +26 -0
  47. data/app/assets/javascripts/jqueryui/datepicker-ko.js +26 -0
  48. data/app/assets/javascripts/jqueryui/datepicker-ky.js +27 -0
  49. data/app/assets/javascripts/jqueryui/datepicker-lb.js +26 -0
  50. data/app/assets/javascripts/jqueryui/datepicker-lt.js +26 -0
  51. data/app/assets/javascripts/jqueryui/datepicker-lv.js +26 -0
  52. data/app/assets/javascripts/jqueryui/datepicker-mk.js +26 -0
  53. data/app/assets/javascripts/jqueryui/datepicker-ml.js +26 -0
  54. data/app/assets/javascripts/jqueryui/datepicker-ms.js +26 -0
  55. data/app/assets/javascripts/jqueryui/datepicker-nb.js +25 -0
  56. data/app/assets/javascripts/jqueryui/datepicker-nl-BE.js +26 -0
  57. data/app/assets/javascripts/jqueryui/datepicker-nl.js +26 -0
  58. data/app/assets/javascripts/jqueryui/datepicker-nn.js +25 -0
  59. data/app/assets/javascripts/jqueryui/datepicker-no.js +26 -0
  60. data/app/assets/javascripts/jqueryui/datepicker-pl.js +26 -0
  61. data/app/assets/javascripts/jqueryui/datepicker-pt-BR.js +26 -0
  62. data/app/assets/javascripts/jqueryui/datepicker-pt.js +25 -0
  63. data/app/assets/javascripts/jqueryui/datepicker-rm.js +24 -0
  64. data/app/assets/javascripts/jqueryui/datepicker-ro.js +29 -0
  65. data/app/assets/javascripts/jqueryui/datepicker-ru.js +26 -0
  66. data/app/assets/javascripts/jqueryui/datepicker-sk.js +26 -0
  67. data/app/assets/javascripts/jqueryui/datepicker-sl.js +27 -0
  68. data/app/assets/javascripts/jqueryui/datepicker-sq.js +26 -0
  69. data/app/assets/javascripts/jqueryui/datepicker-sr-SR.js +26 -0
  70. data/app/assets/javascripts/jqueryui/datepicker-sr.js +26 -0
  71. data/app/assets/javascripts/jqueryui/datepicker-sv.js +26 -0
  72. data/app/assets/javascripts/jqueryui/datepicker-ta.js +26 -0
  73. data/app/assets/javascripts/jqueryui/datepicker-th.js +26 -0
  74. data/app/assets/javascripts/jqueryui/datepicker-tj.js +26 -0
  75. data/app/assets/javascripts/jqueryui/datepicker-tr.js +26 -0
  76. data/app/assets/javascripts/jqueryui/datepicker-uk.js +27 -0
  77. data/app/assets/javascripts/jqueryui/datepicker-vi.js +26 -0
  78. data/app/assets/javascripts/jqueryui/datepicker-zh-CN.js +26 -0
  79. data/app/assets/javascripts/jqueryui/datepicker-zh-HK.js +26 -0
  80. data/app/assets/javascripts/jqueryui/datepicker-zh-TW.js +26 -0
  81. data/app/assets/javascripts/jqueryui/datepicker.js +2053 -0
  82. data/app/assets/javascripts/jqueryui/dialog.js +811 -0
  83. data/app/assets/javascripts/jqueryui/draggable.js +936 -0
  84. data/app/assets/javascripts/jqueryui/droppable.js +375 -0
  85. data/app/assets/javascripts/jqueryui/effect-blind.js +85 -0
  86. data/app/assets/javascripts/jqueryui/effect-bounce.js +116 -0
  87. data/app/assets/javascripts/jqueryui/effect-clip.js +70 -0
  88. data/app/assets/javascripts/jqueryui/effect-drop.js +68 -0
  89. data/app/assets/javascripts/jqueryui/effect-explode.js +100 -0
  90. data/app/assets/javascripts/jqueryui/effect-fade.js +33 -0
  91. data/app/assets/javascripts/jqueryui/effect-fold.js +79 -0
  92. data/app/assets/javascripts/jqueryui/effect-highlight.js +53 -0
  93. data/app/assets/javascripts/jqueryui/effect-pulsate.js +66 -0
  94. data/app/assets/javascripts/jqueryui/effect-scale.js +321 -0
  95. data/app/assets/javascripts/jqueryui/effect-shake.js +77 -0
  96. data/app/assets/javascripts/jqueryui/effect-slide.js +67 -0
  97. data/app/assets/javascripts/jqueryui/effect-transfer.js +50 -0
  98. data/app/assets/javascripts/jqueryui/effect.js +1292 -0
  99. data/app/assets/javascripts/jqueryui/menu.js +624 -0
  100. data/app/assets/javascripts/jqueryui/mouse.js +172 -0
  101. data/app/assets/javascripts/jqueryui/position.js +500 -0
  102. data/app/assets/javascripts/jqueryui/progressbar.js +148 -0
  103. data/app/assets/javascripts/jqueryui/resizable.js +971 -0
  104. data/app/assets/javascripts/jqueryui/selectable.js +280 -0
  105. data/app/assets/javascripts/jqueryui/slider.js +675 -0
  106. data/app/assets/javascripts/jqueryui/sortable.js +1285 -0
  107. data/app/assets/javascripts/jqueryui/spinner.js +496 -0
  108. data/app/assets/javascripts/jqueryui/tabs.js +849 -0
  109. data/app/assets/javascripts/jqueryui/tooltip.js +405 -0
  110. data/app/assets/javascripts/jqueryui/widget.js +524 -0
  111. data/lib/jqueryui-requirejs-rails.rb +4 -0
  112. data/lib/jqueryui-requirejs-rails/engine.rb +4 -0
  113. data/lib/jqueryui-requirejs-rails/version.rb +3 -0
  114. metadata +196 -0
@@ -0,0 +1,148 @@
1
+ define(['jquery','./core','./widget'], function (jQuery) {
2
+ /*!
3
+ * jQuery UI Progressbar 1.10.2
4
+ * http://jqueryui.com
5
+ *
6
+ * Copyright 2013 jQuery Foundation and other contributors
7
+ * Released under the MIT license.
8
+ * http://jquery.org/license
9
+ *
10
+ * http://api.jqueryui.com/progressbar/
11
+ *
12
+ * Depends:
13
+ * jquery.ui.core.js
14
+ * jquery.ui.widget.js
15
+ */
16
+ (function( $, undefined ) {
17
+
18
+ $.widget( "ui.progressbar", {
19
+ version: "1.10.2",
20
+ options: {
21
+ max: 100,
22
+ value: 0,
23
+
24
+ change: null,
25
+ complete: null
26
+ },
27
+
28
+ min: 0,
29
+
30
+ _create: function() {
31
+ // Constrain initial value
32
+ this.oldValue = this.options.value = this._constrainedValue();
33
+
34
+ this.element
35
+ .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
36
+ .attr({
37
+ // Only set static values, aria-valuenow and aria-valuemax are
38
+ // set inside _refreshValue()
39
+ role: "progressbar",
40
+ "aria-valuemin": this.min
41
+ });
42
+
43
+ this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
44
+ .appendTo( this.element );
45
+
46
+ this._refreshValue();
47
+ },
48
+
49
+ _destroy: function() {
50
+ this.element
51
+ .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
52
+ .removeAttr( "role" )
53
+ .removeAttr( "aria-valuemin" )
54
+ .removeAttr( "aria-valuemax" )
55
+ .removeAttr( "aria-valuenow" );
56
+
57
+ this.valueDiv.remove();
58
+ },
59
+
60
+ value: function( newValue ) {
61
+ if ( newValue === undefined ) {
62
+ return this.options.value;
63
+ }
64
+
65
+ this.options.value = this._constrainedValue( newValue );
66
+ this._refreshValue();
67
+ },
68
+
69
+ _constrainedValue: function( newValue ) {
70
+ if ( newValue === undefined ) {
71
+ newValue = this.options.value;
72
+ }
73
+
74
+ this.indeterminate = newValue === false;
75
+
76
+ // sanitize value
77
+ if ( typeof newValue !== "number" ) {
78
+ newValue = 0;
79
+ }
80
+
81
+ return this.indeterminate ? false :
82
+ Math.min( this.options.max, Math.max( this.min, newValue ) );
83
+ },
84
+
85
+ _setOptions: function( options ) {
86
+ // Ensure "value" option is set after other values (like max)
87
+ var value = options.value;
88
+ delete options.value;
89
+
90
+ this._super( options );
91
+
92
+ this.options.value = this._constrainedValue( value );
93
+ this._refreshValue();
94
+ },
95
+
96
+ _setOption: function( key, value ) {
97
+ if ( key === "max" ) {
98
+ // Don't allow a max less than min
99
+ value = Math.max( this.min, value );
100
+ }
101
+
102
+ this._super( key, value );
103
+ },
104
+
105
+ _percentage: function() {
106
+ return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min );
107
+ },
108
+
109
+ _refreshValue: function() {
110
+ var value = this.options.value,
111
+ percentage = this._percentage();
112
+
113
+ this.valueDiv
114
+ .toggle( this.indeterminate || value > this.min )
115
+ .toggleClass( "ui-corner-right", value === this.options.max )
116
+ .width( percentage.toFixed(0) + "%" );
117
+
118
+ this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
119
+
120
+ if ( this.indeterminate ) {
121
+ this.element.removeAttr( "aria-valuenow" );
122
+ if ( !this.overlayDiv ) {
123
+ this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv );
124
+ }
125
+ } else {
126
+ this.element.attr({
127
+ "aria-valuemax": this.options.max,
128
+ "aria-valuenow": value
129
+ });
130
+ if ( this.overlayDiv ) {
131
+ this.overlayDiv.remove();
132
+ this.overlayDiv = null;
133
+ }
134
+ }
135
+
136
+ if ( this.oldValue !== value ) {
137
+ this.oldValue = value;
138
+ this._trigger( "change" );
139
+ }
140
+ if ( value === this.options.max ) {
141
+ this._trigger( "complete" );
142
+ }
143
+ }
144
+ });
145
+
146
+ })( jQuery );
147
+
148
+ });
@@ -0,0 +1,971 @@
1
+ define(['jquery','./core','./mouse','./widget'], function (jQuery) {
2
+ /*!
3
+ * jQuery UI Resizable 1.10.2
4
+ * http://jqueryui.com
5
+ *
6
+ * Copyright 2013 jQuery Foundation and other contributors
7
+ * Released under the MIT license.
8
+ * http://jquery.org/license
9
+ *
10
+ * http://api.jqueryui.com/resizable/
11
+ *
12
+ * Depends:
13
+ * jquery.ui.core.js
14
+ * jquery.ui.mouse.js
15
+ * jquery.ui.widget.js
16
+ */
17
+ (function( $, undefined ) {
18
+
19
+ function num(v) {
20
+ return parseInt(v, 10) || 0;
21
+ }
22
+
23
+ function isNumber(value) {
24
+ return !isNaN(parseInt(value, 10));
25
+ }
26
+
27
+ $.widget("ui.resizable", $.ui.mouse, {
28
+ version: "1.10.2",
29
+ widgetEventPrefix: "resize",
30
+ options: {
31
+ alsoResize: false,
32
+ animate: false,
33
+ animateDuration: "slow",
34
+ animateEasing: "swing",
35
+ aspectRatio: false,
36
+ autoHide: false,
37
+ containment: false,
38
+ ghost: false,
39
+ grid: false,
40
+ handles: "e,s,se",
41
+ helper: false,
42
+ maxHeight: null,
43
+ maxWidth: null,
44
+ minHeight: 10,
45
+ minWidth: 10,
46
+ // See #7960
47
+ zIndex: 90,
48
+
49
+ // callbacks
50
+ resize: null,
51
+ start: null,
52
+ stop: null
53
+ },
54
+ _create: function() {
55
+
56
+ var n, i, handle, axis, hname,
57
+ that = this,
58
+ o = this.options;
59
+ this.element.addClass("ui-resizable");
60
+
61
+ $.extend(this, {
62
+ _aspectRatio: !!(o.aspectRatio),
63
+ aspectRatio: o.aspectRatio,
64
+ originalElement: this.element,
65
+ _proportionallyResizeElements: [],
66
+ _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
67
+ });
68
+
69
+ //Wrap the element if it cannot hold child nodes
70
+ if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
71
+
72
+ //Create a wrapper element and set the wrapper to the new current internal element
73
+ this.element.wrap(
74
+ $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
75
+ position: this.element.css("position"),
76
+ width: this.element.outerWidth(),
77
+ height: this.element.outerHeight(),
78
+ top: this.element.css("top"),
79
+ left: this.element.css("left")
80
+ })
81
+ );
82
+
83
+ //Overwrite the original this.element
84
+ this.element = this.element.parent().data(
85
+ "ui-resizable", this.element.data("ui-resizable")
86
+ );
87
+
88
+ this.elementIsWrapper = true;
89
+
90
+ //Move margins to the wrapper
91
+ this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
92
+ this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
93
+
94
+ //Prevent Safari textarea resize
95
+ this.originalResizeStyle = this.originalElement.css("resize");
96
+ this.originalElement.css("resize", "none");
97
+
98
+ //Push the actual element to our proportionallyResize internal array
99
+ this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
100
+
101
+ // avoid IE jump (hard set the margin)
102
+ this.originalElement.css({ margin: this.originalElement.css("margin") });
103
+
104
+ // fix handlers offset
105
+ this._proportionallyResize();
106
+
107
+ }
108
+
109
+ this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
110
+ if(this.handles.constructor === String) {
111
+
112
+ if ( this.handles === "all") {
113
+ this.handles = "n,e,s,w,se,sw,ne,nw";
114
+ }
115
+
116
+ n = this.handles.split(",");
117
+ this.handles = {};
118
+
119
+ for(i = 0; i < n.length; i++) {
120
+
121
+ handle = $.trim(n[i]);
122
+ hname = "ui-resizable-"+handle;
123
+ axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
124
+
125
+ // Apply zIndex to all handles - see #7960
126
+ axis.css({ zIndex: o.zIndex });
127
+
128
+ //TODO : What's going on here?
129
+ if ("se" === handle) {
130
+ axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
131
+ }
132
+
133
+ //Insert into internal handles object and append to element
134
+ this.handles[handle] = ".ui-resizable-"+handle;
135
+ this.element.append(axis);
136
+ }
137
+
138
+ }
139
+
140
+ this._renderAxis = function(target) {
141
+
142
+ var i, axis, padPos, padWrapper;
143
+
144
+ target = target || this.element;
145
+
146
+ for(i in this.handles) {
147
+
148
+ if(this.handles[i].constructor === String) {
149
+ this.handles[i] = $(this.handles[i], this.element).show();
150
+ }
151
+
152
+ //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
153
+ if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
154
+
155
+ axis = $(this.handles[i], this.element);
156
+
157
+ //Checking the correct pad and border
158
+ padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
159
+
160
+ //The padding type i have to apply...
161
+ padPos = [ "padding",
162
+ /ne|nw|n/.test(i) ? "Top" :
163
+ /se|sw|s/.test(i) ? "Bottom" :
164
+ /^e$/.test(i) ? "Right" : "Left" ].join("");
165
+
166
+ target.css(padPos, padWrapper);
167
+
168
+ this._proportionallyResize();
169
+
170
+ }
171
+
172
+ //TODO: What's that good for? There's not anything to be executed left
173
+ if(!$(this.handles[i]).length) {
174
+ continue;
175
+ }
176
+ }
177
+ };
178
+
179
+ //TODO: make renderAxis a prototype function
180
+ this._renderAxis(this.element);
181
+
182
+ this._handles = $(".ui-resizable-handle", this.element)
183
+ .disableSelection();
184
+
185
+ //Matching axis name
186
+ this._handles.mouseover(function() {
187
+ if (!that.resizing) {
188
+ if (this.className) {
189
+ axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
190
+ }
191
+ //Axis, default = se
192
+ that.axis = axis && axis[1] ? axis[1] : "se";
193
+ }
194
+ });
195
+
196
+ //If we want to auto hide the elements
197
+ if (o.autoHide) {
198
+ this._handles.hide();
199
+ $(this.element)
200
+ .addClass("ui-resizable-autohide")
201
+ .mouseenter(function() {
202
+ if (o.disabled) {
203
+ return;
204
+ }
205
+ $(this).removeClass("ui-resizable-autohide");
206
+ that._handles.show();
207
+ })
208
+ .mouseleave(function(){
209
+ if (o.disabled) {
210
+ return;
211
+ }
212
+ if (!that.resizing) {
213
+ $(this).addClass("ui-resizable-autohide");
214
+ that._handles.hide();
215
+ }
216
+ });
217
+ }
218
+
219
+ //Initialize the mouse interaction
220
+ this._mouseInit();
221
+
222
+ },
223
+
224
+ _destroy: function() {
225
+
226
+ this._mouseDestroy();
227
+
228
+ var wrapper,
229
+ _destroy = function(exp) {
230
+ $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
231
+ .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
232
+ };
233
+
234
+ //TODO: Unwrap at same DOM position
235
+ if (this.elementIsWrapper) {
236
+ _destroy(this.element);
237
+ wrapper = this.element;
238
+ this.originalElement.css({
239
+ position: wrapper.css("position"),
240
+ width: wrapper.outerWidth(),
241
+ height: wrapper.outerHeight(),
242
+ top: wrapper.css("top"),
243
+ left: wrapper.css("left")
244
+ }).insertAfter( wrapper );
245
+ wrapper.remove();
246
+ }
247
+
248
+ this.originalElement.css("resize", this.originalResizeStyle);
249
+ _destroy(this.originalElement);
250
+
251
+ return this;
252
+ },
253
+
254
+ _mouseCapture: function(event) {
255
+ var i, handle,
256
+ capture = false;
257
+
258
+ for (i in this.handles) {
259
+ handle = $(this.handles[i])[0];
260
+ if (handle === event.target || $.contains(handle, event.target)) {
261
+ capture = true;
262
+ }
263
+ }
264
+
265
+ return !this.options.disabled && capture;
266
+ },
267
+
268
+ _mouseStart: function(event) {
269
+
270
+ var curleft, curtop, cursor,
271
+ o = this.options,
272
+ iniPos = this.element.position(),
273
+ el = this.element;
274
+
275
+ this.resizing = true;
276
+
277
+ // bugfix for http://dev.jquery.com/ticket/1749
278
+ if ( (/absolute/).test( el.css("position") ) ) {
279
+ el.css({ position: "absolute", top: el.css("top"), left: el.css("left") });
280
+ } else if (el.is(".ui-draggable")) {
281
+ el.css({ position: "absolute", top: iniPos.top, left: iniPos.left });
282
+ }
283
+
284
+ this._renderProxy();
285
+
286
+ curleft = num(this.helper.css("left"));
287
+ curtop = num(this.helper.css("top"));
288
+
289
+ if (o.containment) {
290
+ curleft += $(o.containment).scrollLeft() || 0;
291
+ curtop += $(o.containment).scrollTop() || 0;
292
+ }
293
+
294
+ //Store needed variables
295
+ this.offset = this.helper.offset();
296
+ this.position = { left: curleft, top: curtop };
297
+ this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
298
+ this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
299
+ this.originalPosition = { left: curleft, top: curtop };
300
+ this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
301
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
302
+
303
+ //Aspect Ratio
304
+ this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
305
+
306
+ cursor = $(".ui-resizable-" + this.axis).css("cursor");
307
+ $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
308
+
309
+ el.addClass("ui-resizable-resizing");
310
+ this._propagate("start", event);
311
+ return true;
312
+ },
313
+
314
+ _mouseDrag: function(event) {
315
+
316
+ //Increase performance, avoid regex
317
+ var data,
318
+ el = this.helper, props = {},
319
+ smp = this.originalMousePosition,
320
+ a = this.axis,
321
+ prevTop = this.position.top,
322
+ prevLeft = this.position.left,
323
+ prevWidth = this.size.width,
324
+ prevHeight = this.size.height,
325
+ dx = (event.pageX-smp.left)||0,
326
+ dy = (event.pageY-smp.top)||0,
327
+ trigger = this._change[a];
328
+
329
+ if (!trigger) {
330
+ return false;
331
+ }
332
+
333
+ // Calculate the attrs that will be change
334
+ data = trigger.apply(this, [event, dx, dy]);
335
+
336
+ // Put this in the mouseDrag handler since the user can start pressing shift while resizing
337
+ this._updateVirtualBoundaries(event.shiftKey);
338
+ if (this._aspectRatio || event.shiftKey) {
339
+ data = this._updateRatio(data, event);
340
+ }
341
+
342
+ data = this._respectSize(data, event);
343
+
344
+ this._updateCache(data);
345
+
346
+ // plugins callbacks need to be called first
347
+ this._propagate("resize", event);
348
+
349
+ if (this.position.top !== prevTop) {
350
+ props.top = this.position.top + "px";
351
+ }
352
+ if (this.position.left !== prevLeft) {
353
+ props.left = this.position.left + "px";
354
+ }
355
+ if (this.size.width !== prevWidth) {
356
+ props.width = this.size.width + "px";
357
+ }
358
+ if (this.size.height !== prevHeight) {
359
+ props.height = this.size.height + "px";
360
+ }
361
+ el.css(props);
362
+
363
+ if (!this._helper && this._proportionallyResizeElements.length) {
364
+ this._proportionallyResize();
365
+ }
366
+
367
+ // Call the user callback if the element was resized
368
+ if ( ! $.isEmptyObject(props) ) {
369
+ this._trigger("resize", event, this.ui());
370
+ }
371
+
372
+ return false;
373
+ },
374
+
375
+ _mouseStop: function(event) {
376
+
377
+ this.resizing = false;
378
+ var pr, ista, soffseth, soffsetw, s, left, top,
379
+ o = this.options, that = this;
380
+
381
+ if(this._helper) {
382
+
383
+ pr = this._proportionallyResizeElements;
384
+ ista = pr.length && (/textarea/i).test(pr[0].nodeName);
385
+ soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
386
+ soffsetw = ista ? 0 : that.sizeDiff.width;
387
+
388
+ s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
389
+ left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
390
+ top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
391
+
392
+ if (!o.animate) {
393
+ this.element.css($.extend(s, { top: top, left: left }));
394
+ }
395
+
396
+ that.helper.height(that.size.height);
397
+ that.helper.width(that.size.width);
398
+
399
+ if (this._helper && !o.animate) {
400
+ this._proportionallyResize();
401
+ }
402
+ }
403
+
404
+ $("body").css("cursor", "auto");
405
+
406
+ this.element.removeClass("ui-resizable-resizing");
407
+
408
+ this._propagate("stop", event);
409
+
410
+ if (this._helper) {
411
+ this.helper.remove();
412
+ }
413
+
414
+ return false;
415
+
416
+ },
417
+
418
+ _updateVirtualBoundaries: function(forceAspectRatio) {
419
+ var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
420
+ o = this.options;
421
+
422
+ b = {
423
+ minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
424
+ maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
425
+ minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
426
+ maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
427
+ };
428
+
429
+ if(this._aspectRatio || forceAspectRatio) {
430
+ // We want to create an enclosing box whose aspect ration is the requested one
431
+ // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
432
+ pMinWidth = b.minHeight * this.aspectRatio;
433
+ pMinHeight = b.minWidth / this.aspectRatio;
434
+ pMaxWidth = b.maxHeight * this.aspectRatio;
435
+ pMaxHeight = b.maxWidth / this.aspectRatio;
436
+
437
+ if(pMinWidth > b.minWidth) {
438
+ b.minWidth = pMinWidth;
439
+ }
440
+ if(pMinHeight > b.minHeight) {
441
+ b.minHeight = pMinHeight;
442
+ }
443
+ if(pMaxWidth < b.maxWidth) {
444
+ b.maxWidth = pMaxWidth;
445
+ }
446
+ if(pMaxHeight < b.maxHeight) {
447
+ b.maxHeight = pMaxHeight;
448
+ }
449
+ }
450
+ this._vBoundaries = b;
451
+ },
452
+
453
+ _updateCache: function(data) {
454
+ this.offset = this.helper.offset();
455
+ if (isNumber(data.left)) {
456
+ this.position.left = data.left;
457
+ }
458
+ if (isNumber(data.top)) {
459
+ this.position.top = data.top;
460
+ }
461
+ if (isNumber(data.height)) {
462
+ this.size.height = data.height;
463
+ }
464
+ if (isNumber(data.width)) {
465
+ this.size.width = data.width;
466
+ }
467
+ },
468
+
469
+ _updateRatio: function( data ) {
470
+
471
+ var cpos = this.position,
472
+ csize = this.size,
473
+ a = this.axis;
474
+
475
+ if (isNumber(data.height)) {
476
+ data.width = (data.height * this.aspectRatio);
477
+ } else if (isNumber(data.width)) {
478
+ data.height = (data.width / this.aspectRatio);
479
+ }
480
+
481
+ if (a === "sw") {
482
+ data.left = cpos.left + (csize.width - data.width);
483
+ data.top = null;
484
+ }
485
+ if (a === "nw") {
486
+ data.top = cpos.top + (csize.height - data.height);
487
+ data.left = cpos.left + (csize.width - data.width);
488
+ }
489
+
490
+ return data;
491
+ },
492
+
493
+ _respectSize: function( data ) {
494
+
495
+ var o = this._vBoundaries,
496
+ a = this.axis,
497
+ ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
498
+ isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
499
+ dw = this.originalPosition.left + this.originalSize.width,
500
+ dh = this.position.top + this.size.height,
501
+ cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
502
+ if (isminw) {
503
+ data.width = o.minWidth;
504
+ }
505
+ if (isminh) {
506
+ data.height = o.minHeight;
507
+ }
508
+ if (ismaxw) {
509
+ data.width = o.maxWidth;
510
+ }
511
+ if (ismaxh) {
512
+ data.height = o.maxHeight;
513
+ }
514
+
515
+ if (isminw && cw) {
516
+ data.left = dw - o.minWidth;
517
+ }
518
+ if (ismaxw && cw) {
519
+ data.left = dw - o.maxWidth;
520
+ }
521
+ if (isminh && ch) {
522
+ data.top = dh - o.minHeight;
523
+ }
524
+ if (ismaxh && ch) {
525
+ data.top = dh - o.maxHeight;
526
+ }
527
+
528
+ // fixing jump error on top/left - bug #2330
529
+ if (!data.width && !data.height && !data.left && data.top) {
530
+ data.top = null;
531
+ } else if (!data.width && !data.height && !data.top && data.left) {
532
+ data.left = null;
533
+ }
534
+
535
+ return data;
536
+ },
537
+
538
+ _proportionallyResize: function() {
539
+
540
+ if (!this._proportionallyResizeElements.length) {
541
+ return;
542
+ }
543
+
544
+ var i, j, borders, paddings, prel,
545
+ element = this.helper || this.element;
546
+
547
+ for ( i=0; i < this._proportionallyResizeElements.length; i++) {
548
+
549
+ prel = this._proportionallyResizeElements[i];
550
+
551
+ if (!this.borderDif) {
552
+ this.borderDif = [];
553
+ borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
554
+ paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
555
+
556
+ for ( j = 0; j < borders.length; j++ ) {
557
+ this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
558
+ }
559
+ }
560
+
561
+ prel.css({
562
+ height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
563
+ width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
564
+ });
565
+
566
+ }
567
+
568
+ },
569
+
570
+ _renderProxy: function() {
571
+
572
+ var el = this.element, o = this.options;
573
+ this.elementOffset = el.offset();
574
+
575
+ if(this._helper) {
576
+
577
+ this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
578
+
579
+ this.helper.addClass(this._helper).css({
580
+ width: this.element.outerWidth() - 1,
581
+ height: this.element.outerHeight() - 1,
582
+ position: "absolute",
583
+ left: this.elementOffset.left +"px",
584
+ top: this.elementOffset.top +"px",
585
+ zIndex: ++o.zIndex //TODO: Don't modify option
586
+ });
587
+
588
+ this.helper
589
+ .appendTo("body")
590
+ .disableSelection();
591
+
592
+ } else {
593
+ this.helper = this.element;
594
+ }
595
+
596
+ },
597
+
598
+ _change: {
599
+ e: function(event, dx) {
600
+ return { width: this.originalSize.width + dx };
601
+ },
602
+ w: function(event, dx) {
603
+ var cs = this.originalSize, sp = this.originalPosition;
604
+ return { left: sp.left + dx, width: cs.width - dx };
605
+ },
606
+ n: function(event, dx, dy) {
607
+ var cs = this.originalSize, sp = this.originalPosition;
608
+ return { top: sp.top + dy, height: cs.height - dy };
609
+ },
610
+ s: function(event, dx, dy) {
611
+ return { height: this.originalSize.height + dy };
612
+ },
613
+ se: function(event, dx, dy) {
614
+ return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
615
+ },
616
+ sw: function(event, dx, dy) {
617
+ return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
618
+ },
619
+ ne: function(event, dx, dy) {
620
+ return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
621
+ },
622
+ nw: function(event, dx, dy) {
623
+ return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
624
+ }
625
+ },
626
+
627
+ _propagate: function(n, event) {
628
+ $.ui.plugin.call(this, n, [event, this.ui()]);
629
+ (n !== "resize" && this._trigger(n, event, this.ui()));
630
+ },
631
+
632
+ plugins: {},
633
+
634
+ ui: function() {
635
+ return {
636
+ originalElement: this.originalElement,
637
+ element: this.element,
638
+ helper: this.helper,
639
+ position: this.position,
640
+ size: this.size,
641
+ originalSize: this.originalSize,
642
+ originalPosition: this.originalPosition
643
+ };
644
+ }
645
+
646
+ });
647
+
648
+ /*
649
+ * Resizable Extensions
650
+ */
651
+
652
+ $.ui.plugin.add("resizable", "animate", {
653
+
654
+ stop: function( event ) {
655
+ var that = $(this).data("ui-resizable"),
656
+ o = that.options,
657
+ pr = that._proportionallyResizeElements,
658
+ ista = pr.length && (/textarea/i).test(pr[0].nodeName),
659
+ soffseth = ista && $.ui.hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
660
+ soffsetw = ista ? 0 : that.sizeDiff.width,
661
+ style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
662
+ left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
663
+ top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
664
+
665
+ that.element.animate(
666
+ $.extend(style, top && left ? { top: top, left: left } : {}), {
667
+ duration: o.animateDuration,
668
+ easing: o.animateEasing,
669
+ step: function() {
670
+
671
+ var data = {
672
+ width: parseInt(that.element.css("width"), 10),
673
+ height: parseInt(that.element.css("height"), 10),
674
+ top: parseInt(that.element.css("top"), 10),
675
+ left: parseInt(that.element.css("left"), 10)
676
+ };
677
+
678
+ if (pr && pr.length) {
679
+ $(pr[0]).css({ width: data.width, height: data.height });
680
+ }
681
+
682
+ // propagating resize, and updating values for each animation step
683
+ that._updateCache(data);
684
+ that._propagate("resize", event);
685
+
686
+ }
687
+ }
688
+ );
689
+ }
690
+
691
+ });
692
+
693
+ $.ui.plugin.add("resizable", "containment", {
694
+
695
+ start: function() {
696
+ var element, p, co, ch, cw, width, height,
697
+ that = $(this).data("ui-resizable"),
698
+ o = that.options,
699
+ el = that.element,
700
+ oc = o.containment,
701
+ ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
702
+
703
+ if (!ce) {
704
+ return;
705
+ }
706
+
707
+ that.containerElement = $(ce);
708
+
709
+ if (/document/.test(oc) || oc === document) {
710
+ that.containerOffset = { left: 0, top: 0 };
711
+ that.containerPosition = { left: 0, top: 0 };
712
+
713
+ that.parentData = {
714
+ element: $(document), left: 0, top: 0,
715
+ width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
716
+ };
717
+ }
718
+
719
+ // i'm a node, so compute top, left, right, bottom
720
+ else {
721
+ element = $(ce);
722
+ p = [];
723
+ $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
724
+
725
+ that.containerOffset = element.offset();
726
+ that.containerPosition = element.position();
727
+ that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
728
+
729
+ co = that.containerOffset;
730
+ ch = that.containerSize.height;
731
+ cw = that.containerSize.width;
732
+ width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
733
+ height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
734
+
735
+ that.parentData = {
736
+ element: ce, left: co.left, top: co.top, width: width, height: height
737
+ };
738
+ }
739
+ },
740
+
741
+ resize: function( event ) {
742
+ var woset, hoset, isParent, isOffsetRelative,
743
+ that = $(this).data("ui-resizable"),
744
+ o = that.options,
745
+ co = that.containerOffset, cp = that.position,
746
+ pRatio = that._aspectRatio || event.shiftKey,
747
+ cop = { top:0, left:0 }, ce = that.containerElement;
748
+
749
+ if (ce[0] !== document && (/static/).test(ce.css("position"))) {
750
+ cop = co;
751
+ }
752
+
753
+ if (cp.left < (that._helper ? co.left : 0)) {
754
+ that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
755
+ if (pRatio) {
756
+ that.size.height = that.size.width / that.aspectRatio;
757
+ }
758
+ that.position.left = o.helper ? co.left : 0;
759
+ }
760
+
761
+ if (cp.top < (that._helper ? co.top : 0)) {
762
+ that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
763
+ if (pRatio) {
764
+ that.size.width = that.size.height * that.aspectRatio;
765
+ }
766
+ that.position.top = that._helper ? co.top : 0;
767
+ }
768
+
769
+ that.offset.left = that.parentData.left+that.position.left;
770
+ that.offset.top = that.parentData.top+that.position.top;
771
+
772
+ woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );
773
+ hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
774
+
775
+ isParent = that.containerElement.get(0) === that.element.parent().get(0);
776
+ isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));
777
+
778
+ if(isParent && isOffsetRelative) {
779
+ woset -= that.parentData.left;
780
+ }
781
+
782
+ if (woset + that.size.width >= that.parentData.width) {
783
+ that.size.width = that.parentData.width - woset;
784
+ if (pRatio) {
785
+ that.size.height = that.size.width / that.aspectRatio;
786
+ }
787
+ }
788
+
789
+ if (hoset + that.size.height >= that.parentData.height) {
790
+ that.size.height = that.parentData.height - hoset;
791
+ if (pRatio) {
792
+ that.size.width = that.size.height * that.aspectRatio;
793
+ }
794
+ }
795
+ },
796
+
797
+ stop: function(){
798
+ var that = $(this).data("ui-resizable"),
799
+ o = that.options,
800
+ co = that.containerOffset,
801
+ cop = that.containerPosition,
802
+ ce = that.containerElement,
803
+ helper = $(that.helper),
804
+ ho = helper.offset(),
805
+ w = helper.outerWidth() - that.sizeDiff.width,
806
+ h = helper.outerHeight() - that.sizeDiff.height;
807
+
808
+ if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
809
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
810
+ }
811
+
812
+ if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
813
+ $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
814
+ }
815
+
816
+ }
817
+ });
818
+
819
+ $.ui.plugin.add("resizable", "alsoResize", {
820
+
821
+ start: function () {
822
+ var that = $(this).data("ui-resizable"),
823
+ o = that.options,
824
+ _store = function (exp) {
825
+ $(exp).each(function() {
826
+ var el = $(this);
827
+ el.data("ui-resizable-alsoresize", {
828
+ width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
829
+ left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10)
830
+ });
831
+ });
832
+ };
833
+
834
+ if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
835
+ if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
836
+ else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
837
+ }else{
838
+ _store(o.alsoResize);
839
+ }
840
+ },
841
+
842
+ resize: function (event, ui) {
843
+ var that = $(this).data("ui-resizable"),
844
+ o = that.options,
845
+ os = that.originalSize,
846
+ op = that.originalPosition,
847
+ delta = {
848
+ height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
849
+ top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
850
+ },
851
+
852
+ _alsoResize = function (exp, c) {
853
+ $(exp).each(function() {
854
+ var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
855
+ css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
856
+
857
+ $.each(css, function (i, prop) {
858
+ var sum = (start[prop]||0) + (delta[prop]||0);
859
+ if (sum && sum >= 0) {
860
+ style[prop] = sum || null;
861
+ }
862
+ });
863
+
864
+ el.css(style);
865
+ });
866
+ };
867
+
868
+ if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
869
+ $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
870
+ }else{
871
+ _alsoResize(o.alsoResize);
872
+ }
873
+ },
874
+
875
+ stop: function () {
876
+ $(this).removeData("resizable-alsoresize");
877
+ }
878
+ });
879
+
880
+ $.ui.plugin.add("resizable", "ghost", {
881
+
882
+ start: function() {
883
+
884
+ var that = $(this).data("ui-resizable"), o = that.options, cs = that.size;
885
+
886
+ that.ghost = that.originalElement.clone();
887
+ that.ghost
888
+ .css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
889
+ .addClass("ui-resizable-ghost")
890
+ .addClass(typeof o.ghost === "string" ? o.ghost : "");
891
+
892
+ that.ghost.appendTo(that.helper);
893
+
894
+ },
895
+
896
+ resize: function(){
897
+ var that = $(this).data("ui-resizable");
898
+ if (that.ghost) {
899
+ that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
900
+ }
901
+ },
902
+
903
+ stop: function() {
904
+ var that = $(this).data("ui-resizable");
905
+ if (that.ghost && that.helper) {
906
+ that.helper.get(0).removeChild(that.ghost.get(0));
907
+ }
908
+ }
909
+
910
+ });
911
+
912
+ $.ui.plugin.add("resizable", "grid", {
913
+
914
+ resize: function() {
915
+ var that = $(this).data("ui-resizable"),
916
+ o = that.options,
917
+ cs = that.size,
918
+ os = that.originalSize,
919
+ op = that.originalPosition,
920
+ a = that.axis,
921
+ grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
922
+ gridX = (grid[0]||1),
923
+ gridY = (grid[1]||1),
924
+ ox = Math.round((cs.width - os.width) / gridX) * gridX,
925
+ oy = Math.round((cs.height - os.height) / gridY) * gridY,
926
+ newWidth = os.width + ox,
927
+ newHeight = os.height + oy,
928
+ isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
929
+ isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
930
+ isMinWidth = o.minWidth && (o.minWidth > newWidth),
931
+ isMinHeight = o.minHeight && (o.minHeight > newHeight);
932
+
933
+ o.grid = grid;
934
+
935
+ if (isMinWidth) {
936
+ newWidth = newWidth + gridX;
937
+ }
938
+ if (isMinHeight) {
939
+ newHeight = newHeight + gridY;
940
+ }
941
+ if (isMaxWidth) {
942
+ newWidth = newWidth - gridX;
943
+ }
944
+ if (isMaxHeight) {
945
+ newHeight = newHeight - gridY;
946
+ }
947
+
948
+ if (/^(se|s|e)$/.test(a)) {
949
+ that.size.width = newWidth;
950
+ that.size.height = newHeight;
951
+ } else if (/^(ne)$/.test(a)) {
952
+ that.size.width = newWidth;
953
+ that.size.height = newHeight;
954
+ that.position.top = op.top - oy;
955
+ } else if (/^(sw)$/.test(a)) {
956
+ that.size.width = newWidth;
957
+ that.size.height = newHeight;
958
+ that.position.left = op.left - ox;
959
+ } else {
960
+ that.size.width = newWidth;
961
+ that.size.height = newHeight;
962
+ that.position.top = op.top - oy;
963
+ that.position.left = op.left - ox;
964
+ }
965
+ }
966
+
967
+ });
968
+
969
+ })(jQuery);
970
+
971
+ });