express_ui 0.1.0.rc1 → 0.1.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2219 @@
1
+ /*! jQuery UI - v1.12.1 - 2017-03-23
2
+ * http://jqueryui.com
3
+ * Includes: widget.js, disable-selection.js, widgets/resizable.js, widgets/mouse.js
4
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
+
6
+ (function( factory ) {
7
+ if ( typeof define === "function" && define.amd ) {
8
+
9
+ // AMD. Register as an anonymous module.
10
+ define([ "jquery" ], factory );
11
+ } else {
12
+
13
+ // Browser globals
14
+ factory( jQuery );
15
+ }
16
+ }(function( $ ) {
17
+
18
+ $.ui = $.ui || {};
19
+
20
+ var version = $.ui.version = "1.12.1";
21
+
22
+
23
+ /*!
24
+ * jQuery UI Widget 1.12.1
25
+ * http://jqueryui.com
26
+ *
27
+ * Copyright jQuery Foundation and other contributors
28
+ * Released under the MIT license.
29
+ * http://jquery.org/license
30
+ */
31
+
32
+ //>>label: Widget
33
+ //>>group: Core
34
+ //>>description: Provides a factory for creating stateful widgets with a common API.
35
+ //>>docs: http://api.jqueryui.com/jQuery.widget/
36
+ //>>demos: http://jqueryui.com/widget/
37
+
38
+
39
+
40
+ var widgetUuid = 0;
41
+ var widgetSlice = Array.prototype.slice;
42
+
43
+ $.cleanData = ( function( orig ) {
44
+ return function( elems ) {
45
+ var events, elem, i;
46
+ for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
47
+ try {
48
+
49
+ // Only trigger remove when necessary to save time
50
+ events = $._data( elem, "events" );
51
+ if ( events && events.remove ) {
52
+ $( elem ).triggerHandler( "remove" );
53
+ }
54
+
55
+ // Http://bugs.jquery.com/ticket/8235
56
+ } catch ( e ) {}
57
+ }
58
+ orig( elems );
59
+ };
60
+ } )( $.cleanData );
61
+
62
+ $.widget = function( name, base, prototype ) {
63
+ var existingConstructor, constructor, basePrototype;
64
+
65
+ // ProxiedPrototype allows the provided prototype to remain unmodified
66
+ // so that it can be used as a mixin for multiple widgets (#8876)
67
+ var proxiedPrototype = {};
68
+
69
+ var namespace = name.split( "." )[ 0 ];
70
+ name = name.split( "." )[ 1 ];
71
+ var fullName = namespace + "-" + name;
72
+
73
+ if ( !prototype ) {
74
+ prototype = base;
75
+ base = $.Widget;
76
+ }
77
+
78
+ if ( $.isArray( prototype ) ) {
79
+ prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
80
+ }
81
+
82
+ // Create selector for plugin
83
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
84
+ return !!$.data( elem, fullName );
85
+ };
86
+
87
+ $[ namespace ] = $[ namespace ] || {};
88
+ existingConstructor = $[ namespace ][ name ];
89
+ constructor = $[ namespace ][ name ] = function( options, element ) {
90
+
91
+ // Allow instantiation without "new" keyword
92
+ if ( !this._createWidget ) {
93
+ return new constructor( options, element );
94
+ }
95
+
96
+ // Allow instantiation without initializing for simple inheritance
97
+ // must use "new" keyword (the code above always passes args)
98
+ if ( arguments.length ) {
99
+ this._createWidget( options, element );
100
+ }
101
+ };
102
+
103
+ // Extend with the existing constructor to carry over any static properties
104
+ $.extend( constructor, existingConstructor, {
105
+ version: prototype.version,
106
+
107
+ // Copy the object used to create the prototype in case we need to
108
+ // redefine the widget later
109
+ _proto: $.extend( {}, prototype ),
110
+
111
+ // Track widgets that inherit from this widget in case this widget is
112
+ // redefined after a widget inherits from it
113
+ _childConstructors: []
114
+ } );
115
+
116
+ basePrototype = new base();
117
+
118
+ // We need to make the options hash a property directly on the new instance
119
+ // otherwise we'll modify the options hash on the prototype that we're
120
+ // inheriting from
121
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
122
+ $.each( prototype, function( prop, value ) {
123
+ if ( !$.isFunction( value ) ) {
124
+ proxiedPrototype[ prop ] = value;
125
+ return;
126
+ }
127
+ proxiedPrototype[ prop ] = ( function() {
128
+ function _super() {
129
+ return base.prototype[ prop ].apply( this, arguments );
130
+ }
131
+
132
+ function _superApply( args ) {
133
+ return base.prototype[ prop ].apply( this, args );
134
+ }
135
+
136
+ return function() {
137
+ var __super = this._super;
138
+ var __superApply = this._superApply;
139
+ var returnValue;
140
+
141
+ this._super = _super;
142
+ this._superApply = _superApply;
143
+
144
+ returnValue = value.apply( this, arguments );
145
+
146
+ this._super = __super;
147
+ this._superApply = __superApply;
148
+
149
+ return returnValue;
150
+ };
151
+ } )();
152
+ } );
153
+ constructor.prototype = $.widget.extend( basePrototype, {
154
+
155
+ // TODO: remove support for widgetEventPrefix
156
+ // always use the name + a colon as the prefix, e.g., draggable:start
157
+ // don't prefix for widgets that aren't DOM-based
158
+ widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
159
+ }, proxiedPrototype, {
160
+ constructor: constructor,
161
+ namespace: namespace,
162
+ widgetName: name,
163
+ widgetFullName: fullName
164
+ } );
165
+
166
+ // If this widget is being redefined then we need to find all widgets that
167
+ // are inheriting from it and redefine all of them so that they inherit from
168
+ // the new version of this widget. We're essentially trying to replace one
169
+ // level in the prototype chain.
170
+ if ( existingConstructor ) {
171
+ $.each( existingConstructor._childConstructors, function( i, child ) {
172
+ var childPrototype = child.prototype;
173
+
174
+ // Redefine the child widget using the same prototype that was
175
+ // originally used, but inherit from the new version of the base
176
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
177
+ child._proto );
178
+ } );
179
+
180
+ // Remove the list of existing child constructors from the old constructor
181
+ // so the old child constructors can be garbage collected
182
+ delete existingConstructor._childConstructors;
183
+ } else {
184
+ base._childConstructors.push( constructor );
185
+ }
186
+
187
+ $.widget.bridge( name, constructor );
188
+
189
+ return constructor;
190
+ };
191
+
192
+ $.widget.extend = function( target ) {
193
+ var input = widgetSlice.call( arguments, 1 );
194
+ var inputIndex = 0;
195
+ var inputLength = input.length;
196
+ var key;
197
+ var value;
198
+
199
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
200
+ for ( key in input[ inputIndex ] ) {
201
+ value = input[ inputIndex ][ key ];
202
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
203
+
204
+ // Clone objects
205
+ if ( $.isPlainObject( value ) ) {
206
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
207
+ $.widget.extend( {}, target[ key ], value ) :
208
+
209
+ // Don't extend strings, arrays, etc. with objects
210
+ $.widget.extend( {}, value );
211
+
212
+ // Copy everything else by reference
213
+ } else {
214
+ target[ key ] = value;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ return target;
220
+ };
221
+
222
+ $.widget.bridge = function( name, object ) {
223
+ var fullName = object.prototype.widgetFullName || name;
224
+ $.fn[ name ] = function( options ) {
225
+ var isMethodCall = typeof options === "string";
226
+ var args = widgetSlice.call( arguments, 1 );
227
+ var returnValue = this;
228
+
229
+ if ( isMethodCall ) {
230
+
231
+ // If this is an empty collection, we need to have the instance method
232
+ // return undefined instead of the jQuery instance
233
+ if ( !this.length && options === "instance" ) {
234
+ returnValue = undefined;
235
+ } else {
236
+ this.each( function() {
237
+ var methodValue;
238
+ var instance = $.data( this, fullName );
239
+
240
+ if ( options === "instance" ) {
241
+ returnValue = instance;
242
+ return false;
243
+ }
244
+
245
+ if ( !instance ) {
246
+ return $.error( "cannot call methods on " + name +
247
+ " prior to initialization; " +
248
+ "attempted to call method '" + options + "'" );
249
+ }
250
+
251
+ if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
252
+ return $.error( "no such method '" + options + "' for " + name +
253
+ " widget instance" );
254
+ }
255
+
256
+ methodValue = instance[ options ].apply( instance, args );
257
+
258
+ if ( methodValue !== instance && methodValue !== undefined ) {
259
+ returnValue = methodValue && methodValue.jquery ?
260
+ returnValue.pushStack( methodValue.get() ) :
261
+ methodValue;
262
+ return false;
263
+ }
264
+ } );
265
+ }
266
+ } else {
267
+
268
+ // Allow multiple hashes to be passed on init
269
+ if ( args.length ) {
270
+ options = $.widget.extend.apply( null, [ options ].concat( args ) );
271
+ }
272
+
273
+ this.each( function() {
274
+ var instance = $.data( this, fullName );
275
+ if ( instance ) {
276
+ instance.option( options || {} );
277
+ if ( instance._init ) {
278
+ instance._init();
279
+ }
280
+ } else {
281
+ $.data( this, fullName, new object( options, this ) );
282
+ }
283
+ } );
284
+ }
285
+
286
+ return returnValue;
287
+ };
288
+ };
289
+
290
+ $.Widget = function( /* options, element */ ) {};
291
+ $.Widget._childConstructors = [];
292
+
293
+ $.Widget.prototype = {
294
+ widgetName: "widget",
295
+ widgetEventPrefix: "",
296
+ defaultElement: "<div>",
297
+
298
+ options: {
299
+ classes: {},
300
+ disabled: false,
301
+
302
+ // Callbacks
303
+ create: null
304
+ },
305
+
306
+ _createWidget: function( options, element ) {
307
+ element = $( element || this.defaultElement || this )[ 0 ];
308
+ this.element = $( element );
309
+ this.uuid = widgetUuid++;
310
+ this.eventNamespace = "." + this.widgetName + this.uuid;
311
+
312
+ this.bindings = $();
313
+ this.hoverable = $();
314
+ this.focusable = $();
315
+ this.classesElementLookup = {};
316
+
317
+ if ( element !== this ) {
318
+ $.data( element, this.widgetFullName, this );
319
+ this._on( true, this.element, {
320
+ remove: function( event ) {
321
+ if ( event.target === element ) {
322
+ this.destroy();
323
+ }
324
+ }
325
+ } );
326
+ this.document = $( element.style ?
327
+
328
+ // Element within the document
329
+ element.ownerDocument :
330
+
331
+ // Element is window or document
332
+ element.document || element );
333
+ this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
334
+ }
335
+
336
+ this.options = $.widget.extend( {},
337
+ this.options,
338
+ this._getCreateOptions(),
339
+ options );
340
+
341
+ this._create();
342
+
343
+ if ( this.options.disabled ) {
344
+ this._setOptionDisabled( this.options.disabled );
345
+ }
346
+
347
+ this._trigger( "create", null, this._getCreateEventData() );
348
+ this._init();
349
+ },
350
+
351
+ _getCreateOptions: function() {
352
+ return {};
353
+ },
354
+
355
+ _getCreateEventData: $.noop,
356
+
357
+ _create: $.noop,
358
+
359
+ _init: $.noop,
360
+
361
+ destroy: function() {
362
+ var that = this;
363
+
364
+ this._destroy();
365
+ $.each( this.classesElementLookup, function( key, value ) {
366
+ that._removeClass( value, key );
367
+ } );
368
+
369
+ // We can probably remove the unbind calls in 2.0
370
+ // all event bindings should go through this._on()
371
+ this.element
372
+ .off( this.eventNamespace )
373
+ .removeData( this.widgetFullName );
374
+ this.widget()
375
+ .off( this.eventNamespace )
376
+ .removeAttr( "aria-disabled" );
377
+
378
+ // Clean up events and states
379
+ this.bindings.off( this.eventNamespace );
380
+ },
381
+
382
+ _destroy: $.noop,
383
+
384
+ widget: function() {
385
+ return this.element;
386
+ },
387
+
388
+ option: function( key, value ) {
389
+ var options = key;
390
+ var parts;
391
+ var curOption;
392
+ var i;
393
+
394
+ if ( arguments.length === 0 ) {
395
+
396
+ // Don't return a reference to the internal hash
397
+ return $.widget.extend( {}, this.options );
398
+ }
399
+
400
+ if ( typeof key === "string" ) {
401
+
402
+ // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
403
+ options = {};
404
+ parts = key.split( "." );
405
+ key = parts.shift();
406
+ if ( parts.length ) {
407
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
408
+ for ( i = 0; i < parts.length - 1; i++ ) {
409
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
410
+ curOption = curOption[ parts[ i ] ];
411
+ }
412
+ key = parts.pop();
413
+ if ( arguments.length === 1 ) {
414
+ return curOption[ key ] === undefined ? null : curOption[ key ];
415
+ }
416
+ curOption[ key ] = value;
417
+ } else {
418
+ if ( arguments.length === 1 ) {
419
+ return this.options[ key ] === undefined ? null : this.options[ key ];
420
+ }
421
+ options[ key ] = value;
422
+ }
423
+ }
424
+
425
+ this._setOptions( options );
426
+
427
+ return this;
428
+ },
429
+
430
+ _setOptions: function( options ) {
431
+ var key;
432
+
433
+ for ( key in options ) {
434
+ this._setOption( key, options[ key ] );
435
+ }
436
+
437
+ return this;
438
+ },
439
+
440
+ _setOption: function( key, value ) {
441
+ if ( key === "classes" ) {
442
+ this._setOptionClasses( value );
443
+ }
444
+
445
+ this.options[ key ] = value;
446
+
447
+ if ( key === "disabled" ) {
448
+ this._setOptionDisabled( value );
449
+ }
450
+
451
+ return this;
452
+ },
453
+
454
+ _setOptionClasses: function( value ) {
455
+ var classKey, elements, currentElements;
456
+
457
+ for ( classKey in value ) {
458
+ currentElements = this.classesElementLookup[ classKey ];
459
+ if ( value[ classKey ] === this.options.classes[ classKey ] ||
460
+ !currentElements ||
461
+ !currentElements.length ) {
462
+ continue;
463
+ }
464
+
465
+ // We are doing this to create a new jQuery object because the _removeClass() call
466
+ // on the next line is going to destroy the reference to the current elements being
467
+ // tracked. We need to save a copy of this collection so that we can add the new classes
468
+ // below.
469
+ elements = $( currentElements.get() );
470
+ this._removeClass( currentElements, classKey );
471
+
472
+ // We don't use _addClass() here, because that uses this.options.classes
473
+ // for generating the string of classes. We want to use the value passed in from
474
+ // _setOption(), this is the new value of the classes option which was passed to
475
+ // _setOption(). We pass this value directly to _classes().
476
+ elements.addClass( this._classes( {
477
+ element: elements,
478
+ keys: classKey,
479
+ classes: value,
480
+ add: true
481
+ } ) );
482
+ }
483
+ },
484
+
485
+ _setOptionDisabled: function( value ) {
486
+ this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
487
+
488
+ // If the widget is becoming disabled, then nothing is interactive
489
+ if ( value ) {
490
+ this._removeClass( this.hoverable, null, "ui-state-hover" );
491
+ this._removeClass( this.focusable, null, "ui-state-focus" );
492
+ }
493
+ },
494
+
495
+ enable: function() {
496
+ return this._setOptions( { disabled: false } );
497
+ },
498
+
499
+ disable: function() {
500
+ return this._setOptions( { disabled: true } );
501
+ },
502
+
503
+ _classes: function( options ) {
504
+ var full = [];
505
+ var that = this;
506
+
507
+ options = $.extend( {
508
+ element: this.element,
509
+ classes: this.options.classes || {}
510
+ }, options );
511
+
512
+ function processClassString( classes, checkOption ) {
513
+ var current, i;
514
+ for ( i = 0; i < classes.length; i++ ) {
515
+ current = that.classesElementLookup[ classes[ i ] ] || $();
516
+ if ( options.add ) {
517
+ current = $( $.unique( current.get().concat( options.element.get() ) ) );
518
+ } else {
519
+ current = $( current.not( options.element ).get() );
520
+ }
521
+ that.classesElementLookup[ classes[ i ] ] = current;
522
+ full.push( classes[ i ] );
523
+ if ( checkOption && options.classes[ classes[ i ] ] ) {
524
+ full.push( options.classes[ classes[ i ] ] );
525
+ }
526
+ }
527
+ }
528
+
529
+ this._on( options.element, {
530
+ "remove": "_untrackClassesElement"
531
+ } );
532
+
533
+ if ( options.keys ) {
534
+ processClassString( options.keys.match( /\S+/g ) || [], true );
535
+ }
536
+ if ( options.extra ) {
537
+ processClassString( options.extra.match( /\S+/g ) || [] );
538
+ }
539
+
540
+ return full.join( " " );
541
+ },
542
+
543
+ _untrackClassesElement: function( event ) {
544
+ var that = this;
545
+ $.each( that.classesElementLookup, function( key, value ) {
546
+ if ( $.inArray( event.target, value ) !== -1 ) {
547
+ that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
548
+ }
549
+ } );
550
+ },
551
+
552
+ _removeClass: function( element, keys, extra ) {
553
+ return this._toggleClass( element, keys, extra, false );
554
+ },
555
+
556
+ _addClass: function( element, keys, extra ) {
557
+ return this._toggleClass( element, keys, extra, true );
558
+ },
559
+
560
+ _toggleClass: function( element, keys, extra, add ) {
561
+ add = ( typeof add === "boolean" ) ? add : extra;
562
+ var shift = ( typeof element === "string" || element === null ),
563
+ options = {
564
+ extra: shift ? keys : extra,
565
+ keys: shift ? element : keys,
566
+ element: shift ? this.element : element,
567
+ add: add
568
+ };
569
+ options.element.toggleClass( this._classes( options ), add );
570
+ return this;
571
+ },
572
+
573
+ _on: function( suppressDisabledCheck, element, handlers ) {
574
+ var delegateElement;
575
+ var instance = this;
576
+
577
+ // No suppressDisabledCheck flag, shuffle arguments
578
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
579
+ handlers = element;
580
+ element = suppressDisabledCheck;
581
+ suppressDisabledCheck = false;
582
+ }
583
+
584
+ // No element argument, shuffle and use this.element
585
+ if ( !handlers ) {
586
+ handlers = element;
587
+ element = this.element;
588
+ delegateElement = this.widget();
589
+ } else {
590
+ element = delegateElement = $( element );
591
+ this.bindings = this.bindings.add( element );
592
+ }
593
+
594
+ $.each( handlers, function( event, handler ) {
595
+ function handlerProxy() {
596
+
597
+ // Allow widgets to customize the disabled handling
598
+ // - disabled as an array instead of boolean
599
+ // - disabled class as method for disabling individual parts
600
+ if ( !suppressDisabledCheck &&
601
+ ( instance.options.disabled === true ||
602
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
603
+ return;
604
+ }
605
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
606
+ .apply( instance, arguments );
607
+ }
608
+
609
+ // Copy the guid so direct unbinding works
610
+ if ( typeof handler !== "string" ) {
611
+ handlerProxy.guid = handler.guid =
612
+ handler.guid || handlerProxy.guid || $.guid++;
613
+ }
614
+
615
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ );
616
+ var eventName = match[ 1 ] + instance.eventNamespace;
617
+ var selector = match[ 2 ];
618
+
619
+ if ( selector ) {
620
+ delegateElement.on( eventName, selector, handlerProxy );
621
+ } else {
622
+ element.on( eventName, handlerProxy );
623
+ }
624
+ } );
625
+ },
626
+
627
+ _off: function( element, eventName ) {
628
+ eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
629
+ this.eventNamespace;
630
+ element.off( eventName ).off( eventName );
631
+
632
+ // Clear the stack to avoid memory leaks (#10056)
633
+ this.bindings = $( this.bindings.not( element ).get() );
634
+ this.focusable = $( this.focusable.not( element ).get() );
635
+ this.hoverable = $( this.hoverable.not( element ).get() );
636
+ },
637
+
638
+ _delay: function( handler, delay ) {
639
+ function handlerProxy() {
640
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
641
+ .apply( instance, arguments );
642
+ }
643
+ var instance = this;
644
+ return setTimeout( handlerProxy, delay || 0 );
645
+ },
646
+
647
+ _hoverable: function( element ) {
648
+ this.hoverable = this.hoverable.add( element );
649
+ this._on( element, {
650
+ mouseenter: function( event ) {
651
+ this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
652
+ },
653
+ mouseleave: function( event ) {
654
+ this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
655
+ }
656
+ } );
657
+ },
658
+
659
+ _focusable: function( element ) {
660
+ this.focusable = this.focusable.add( element );
661
+ this._on( element, {
662
+ focusin: function( event ) {
663
+ this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
664
+ },
665
+ focusout: function( event ) {
666
+ this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
667
+ }
668
+ } );
669
+ },
670
+
671
+ _trigger: function( type, event, data ) {
672
+ var prop, orig;
673
+ var callback = this.options[ type ];
674
+
675
+ data = data || {};
676
+ event = $.Event( event );
677
+ event.type = ( type === this.widgetEventPrefix ?
678
+ type :
679
+ this.widgetEventPrefix + type ).toLowerCase();
680
+
681
+ // The original event may come from any element
682
+ // so we need to reset the target on the new event
683
+ event.target = this.element[ 0 ];
684
+
685
+ // Copy original event properties over to the new event
686
+ orig = event.originalEvent;
687
+ if ( orig ) {
688
+ for ( prop in orig ) {
689
+ if ( !( prop in event ) ) {
690
+ event[ prop ] = orig[ prop ];
691
+ }
692
+ }
693
+ }
694
+
695
+ this.element.trigger( event, data );
696
+ return !( $.isFunction( callback ) &&
697
+ callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
698
+ event.isDefaultPrevented() );
699
+ }
700
+ };
701
+
702
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
703
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
704
+ if ( typeof options === "string" ) {
705
+ options = { effect: options };
706
+ }
707
+
708
+ var hasOptions;
709
+ var effectName = !options ?
710
+ method :
711
+ options === true || typeof options === "number" ?
712
+ defaultEffect :
713
+ options.effect || defaultEffect;
714
+
715
+ options = options || {};
716
+ if ( typeof options === "number" ) {
717
+ options = { duration: options };
718
+ }
719
+
720
+ hasOptions = !$.isEmptyObject( options );
721
+ options.complete = callback;
722
+
723
+ if ( options.delay ) {
724
+ element.delay( options.delay );
725
+ }
726
+
727
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
728
+ element[ method ]( options );
729
+ } else if ( effectName !== method && element[ effectName ] ) {
730
+ element[ effectName ]( options.duration, options.easing, callback );
731
+ } else {
732
+ element.queue( function( next ) {
733
+ $( this )[ method ]();
734
+ if ( callback ) {
735
+ callback.call( element[ 0 ] );
736
+ }
737
+ next();
738
+ } );
739
+ }
740
+ };
741
+ } );
742
+
743
+ var widget = $.widget;
744
+
745
+
746
+ /*!
747
+ * jQuery UI Disable Selection 1.12.1
748
+ * http://jqueryui.com
749
+ *
750
+ * Copyright jQuery Foundation and other contributors
751
+ * Released under the MIT license.
752
+ * http://jquery.org/license
753
+ */
754
+
755
+ //>>label: disableSelection
756
+ //>>group: Core
757
+ //>>description: Disable selection of text content within the set of matched elements.
758
+ //>>docs: http://api.jqueryui.com/disableSelection/
759
+
760
+ // This file is deprecated
761
+
762
+
763
+ var disableSelection = $.fn.extend( {
764
+ disableSelection: ( function() {
765
+ var eventType = "onselectstart" in document.createElement( "div" ) ?
766
+ "selectstart" :
767
+ "mousedown";
768
+
769
+ return function() {
770
+ return this.on( eventType + ".ui-disableSelection", function( event ) {
771
+ event.preventDefault();
772
+ } );
773
+ };
774
+ } )(),
775
+
776
+ enableSelection: function() {
777
+ return this.off( ".ui-disableSelection" );
778
+ }
779
+ } );
780
+
781
+
782
+
783
+
784
+ // This file is deprecated
785
+ var ie = $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() );
786
+
787
+ /*!
788
+ * jQuery UI Mouse 1.12.1
789
+ * http://jqueryui.com
790
+ *
791
+ * Copyright jQuery Foundation and other contributors
792
+ * Released under the MIT license.
793
+ * http://jquery.org/license
794
+ */
795
+
796
+ //>>label: Mouse
797
+ //>>group: Widgets
798
+ //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
799
+ //>>docs: http://api.jqueryui.com/mouse/
800
+
801
+
802
+
803
+ var mouseHandled = false;
804
+ $( document ).on( "mouseup", function() {
805
+ mouseHandled = false;
806
+ } );
807
+
808
+ var widgetsMouse = $.widget( "ui.mouse", {
809
+ version: "1.12.1",
810
+ options: {
811
+ cancel: "input, textarea, button, select, option",
812
+ distance: 1,
813
+ delay: 0
814
+ },
815
+ _mouseInit: function() {
816
+ var that = this;
817
+
818
+ this.element
819
+ .on( "mousedown." + this.widgetName, function( event ) {
820
+ return that._mouseDown( event );
821
+ } )
822
+ .on( "click." + this.widgetName, function( event ) {
823
+ if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) {
824
+ $.removeData( event.target, that.widgetName + ".preventClickEvent" );
825
+ event.stopImmediatePropagation();
826
+ return false;
827
+ }
828
+ } );
829
+
830
+ this.started = false;
831
+ },
832
+
833
+ // TODO: make sure destroying one instance of mouse doesn't mess with
834
+ // other instances of mouse
835
+ _mouseDestroy: function() {
836
+ this.element.off( "." + this.widgetName );
837
+ if ( this._mouseMoveDelegate ) {
838
+ this.document
839
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
840
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
841
+ }
842
+ },
843
+
844
+ _mouseDown: function( event ) {
845
+
846
+ // don't let more than one widget handle mouseStart
847
+ if ( mouseHandled ) {
848
+ return;
849
+ }
850
+
851
+ this._mouseMoved = false;
852
+
853
+ // We may have missed mouseup (out of window)
854
+ ( this._mouseStarted && this._mouseUp( event ) );
855
+
856
+ this._mouseDownEvent = event;
857
+
858
+ var that = this,
859
+ btnIsLeft = ( event.which === 1 ),
860
+
861
+ // event.target.nodeName works around a bug in IE 8 with
862
+ // disabled inputs (#7620)
863
+ elIsCancel = ( typeof this.options.cancel === "string" && event.target.nodeName ?
864
+ $( event.target ).closest( this.options.cancel ).length : false );
865
+ if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) {
866
+ return true;
867
+ }
868
+
869
+ this.mouseDelayMet = !this.options.delay;
870
+ if ( !this.mouseDelayMet ) {
871
+ this._mouseDelayTimer = setTimeout( function() {
872
+ that.mouseDelayMet = true;
873
+ }, this.options.delay );
874
+ }
875
+
876
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
877
+ this._mouseStarted = ( this._mouseStart( event ) !== false );
878
+ if ( !this._mouseStarted ) {
879
+ event.preventDefault();
880
+ return true;
881
+ }
882
+ }
883
+
884
+ // Click event may never have fired (Gecko & Opera)
885
+ if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) {
886
+ $.removeData( event.target, this.widgetName + ".preventClickEvent" );
887
+ }
888
+
889
+ // These delegates are required to keep context
890
+ this._mouseMoveDelegate = function( event ) {
891
+ return that._mouseMove( event );
892
+ };
893
+ this._mouseUpDelegate = function( event ) {
894
+ return that._mouseUp( event );
895
+ };
896
+
897
+ this.document
898
+ .on( "mousemove." + this.widgetName, this._mouseMoveDelegate )
899
+ .on( "mouseup." + this.widgetName, this._mouseUpDelegate );
900
+
901
+ event.preventDefault();
902
+
903
+ mouseHandled = true;
904
+ return true;
905
+ },
906
+
907
+ _mouseMove: function( event ) {
908
+
909
+ // Only check for mouseups outside the document if you've moved inside the document
910
+ // at least once. This prevents the firing of mouseup in the case of IE<9, which will
911
+ // fire a mousemove event if content is placed under the cursor. See #7778
912
+ // Support: IE <9
913
+ if ( this._mouseMoved ) {
914
+
915
+ // IE mouseup check - mouseup happened when mouse was out of window
916
+ if ( $.ui.ie && ( !document.documentMode || document.documentMode < 9 ) &&
917
+ !event.button ) {
918
+ return this._mouseUp( event );
919
+
920
+ // Iframe mouseup check - mouseup occurred in another document
921
+ } else if ( !event.which ) {
922
+
923
+ // Support: Safari <=8 - 9
924
+ // Safari sets which to 0 if you press any of the following keys
925
+ // during a drag (#14461)
926
+ if ( event.originalEvent.altKey || event.originalEvent.ctrlKey ||
927
+ event.originalEvent.metaKey || event.originalEvent.shiftKey ) {
928
+ this.ignoreMissingWhich = true;
929
+ } else if ( !this.ignoreMissingWhich ) {
930
+ return this._mouseUp( event );
931
+ }
932
+ }
933
+ }
934
+
935
+ if ( event.which || event.button ) {
936
+ this._mouseMoved = true;
937
+ }
938
+
939
+ if ( this._mouseStarted ) {
940
+ this._mouseDrag( event );
941
+ return event.preventDefault();
942
+ }
943
+
944
+ if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) {
945
+ this._mouseStarted =
946
+ ( this._mouseStart( this._mouseDownEvent, event ) !== false );
947
+ ( this._mouseStarted ? this._mouseDrag( event ) : this._mouseUp( event ) );
948
+ }
949
+
950
+ return !this._mouseStarted;
951
+ },
952
+
953
+ _mouseUp: function( event ) {
954
+ this.document
955
+ .off( "mousemove." + this.widgetName, this._mouseMoveDelegate )
956
+ .off( "mouseup." + this.widgetName, this._mouseUpDelegate );
957
+
958
+ if ( this._mouseStarted ) {
959
+ this._mouseStarted = false;
960
+
961
+ if ( event.target === this._mouseDownEvent.target ) {
962
+ $.data( event.target, this.widgetName + ".preventClickEvent", true );
963
+ }
964
+
965
+ this._mouseStop( event );
966
+ }
967
+
968
+ if ( this._mouseDelayTimer ) {
969
+ clearTimeout( this._mouseDelayTimer );
970
+ delete this._mouseDelayTimer;
971
+ }
972
+
973
+ this.ignoreMissingWhich = false;
974
+ mouseHandled = false;
975
+ event.preventDefault();
976
+ },
977
+
978
+ _mouseDistanceMet: function( event ) {
979
+ return ( Math.max(
980
+ Math.abs( this._mouseDownEvent.pageX - event.pageX ),
981
+ Math.abs( this._mouseDownEvent.pageY - event.pageY )
982
+ ) >= this.options.distance
983
+ );
984
+ },
985
+
986
+ _mouseDelayMet: function( /* event */ ) {
987
+ return this.mouseDelayMet;
988
+ },
989
+
990
+ // These are placeholder methods, to be overriden by extending plugin
991
+ _mouseStart: function( /* event */ ) {},
992
+ _mouseDrag: function( /* event */ ) {},
993
+ _mouseStop: function( /* event */ ) {},
994
+ _mouseCapture: function( /* event */ ) { return true; }
995
+ } );
996
+
997
+
998
+
999
+
1000
+ // $.ui.plugin is deprecated. Use $.widget() extensions instead.
1001
+ var plugin = $.ui.plugin = {
1002
+ add: function( module, option, set ) {
1003
+ var i,
1004
+ proto = $.ui[ module ].prototype;
1005
+ for ( i in set ) {
1006
+ proto.plugins[ i ] = proto.plugins[ i ] || [];
1007
+ proto.plugins[ i ].push( [ option, set[ i ] ] );
1008
+ }
1009
+ },
1010
+ call: function( instance, name, args, allowDisconnected ) {
1011
+ var i,
1012
+ set = instance.plugins[ name ];
1013
+
1014
+ if ( !set ) {
1015
+ return;
1016
+ }
1017
+
1018
+ if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode ||
1019
+ instance.element[ 0 ].parentNode.nodeType === 11 ) ) {
1020
+ return;
1021
+ }
1022
+
1023
+ for ( i = 0; i < set.length; i++ ) {
1024
+ if ( instance.options[ set[ i ][ 0 ] ] ) {
1025
+ set[ i ][ 1 ].apply( instance.element, args );
1026
+ }
1027
+ }
1028
+ }
1029
+ };
1030
+
1031
+
1032
+ /*!
1033
+ * jQuery UI Resizable 1.12.1
1034
+ * http://jqueryui.com
1035
+ *
1036
+ * Copyright jQuery Foundation and other contributors
1037
+ * Released under the MIT license.
1038
+ * http://jquery.org/license
1039
+ */
1040
+
1041
+ //>>label: Resizable
1042
+ //>>group: Interactions
1043
+ //>>description: Enables resize functionality for any element.
1044
+ //>>docs: http://api.jqueryui.com/resizable/
1045
+ //>>demos: http://jqueryui.com/resizable/
1046
+ //>>css.structure: ../../themes/base/core.css
1047
+ //>>css.structure: ../../themes/base/resizable.css
1048
+ //>>css.theme: ../../themes/base/theme.css
1049
+
1050
+
1051
+
1052
+ $.widget( "ui.resizable", $.ui.mouse, {
1053
+ version: "1.12.1",
1054
+ widgetEventPrefix: "resize",
1055
+ options: {
1056
+ alsoResize: false,
1057
+ animate: false,
1058
+ animateDuration: "slow",
1059
+ animateEasing: "swing",
1060
+ aspectRatio: false,
1061
+ autoHide: false,
1062
+ classes: {
1063
+ "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
1064
+ },
1065
+ containment: false,
1066
+ ghost: false,
1067
+ grid: false,
1068
+ handles: "e,s,se",
1069
+ helper: false,
1070
+ maxHeight: null,
1071
+ maxWidth: null,
1072
+ minHeight: 10,
1073
+ minWidth: 10,
1074
+
1075
+ // See #7960
1076
+ zIndex: 90,
1077
+
1078
+ // Callbacks
1079
+ resize: null,
1080
+ start: null,
1081
+ stop: null
1082
+ },
1083
+
1084
+ _num: function( value ) {
1085
+ return parseFloat( value ) || 0;
1086
+ },
1087
+
1088
+ _isNumber: function( value ) {
1089
+ return !isNaN( parseFloat( value ) );
1090
+ },
1091
+
1092
+ _hasScroll: function( el, a ) {
1093
+
1094
+ if ( $( el ).css( "overflow" ) === "hidden" ) {
1095
+ return false;
1096
+ }
1097
+
1098
+ var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
1099
+ has = false;
1100
+
1101
+ if ( el[ scroll ] > 0 ) {
1102
+ return true;
1103
+ }
1104
+
1105
+ // TODO: determine which cases actually cause this to happen
1106
+ // if the element doesn't have the scroll set, see if it's possible to
1107
+ // set the scroll
1108
+ el[ scroll ] = 1;
1109
+ has = ( el[ scroll ] > 0 );
1110
+ el[ scroll ] = 0;
1111
+ return has;
1112
+ },
1113
+
1114
+ _create: function() {
1115
+
1116
+ var margins,
1117
+ o = this.options,
1118
+ that = this;
1119
+ this._addClass( "ui-resizable" );
1120
+
1121
+ $.extend( this, {
1122
+ _aspectRatio: !!( o.aspectRatio ),
1123
+ aspectRatio: o.aspectRatio,
1124
+ originalElement: this.element,
1125
+ _proportionallyResizeElements: [],
1126
+ _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
1127
+ } );
1128
+
1129
+ // Wrap the element if it cannot hold child nodes
1130
+ if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) {
1131
+
1132
+ this.element.wrap(
1133
+ $( "<div class='ui-wrapper' style='overflow: hidden;'></div>" ).css( {
1134
+ position: this.element.css( "position" ),
1135
+ width: this.element.outerWidth(),
1136
+ height: this.element.outerHeight(),
1137
+ top: this.element.css( "top" ),
1138
+ left: this.element.css( "left" )
1139
+ } )
1140
+ );
1141
+
1142
+ this.element = this.element.parent().data(
1143
+ "ui-resizable", this.element.resizable( "instance" )
1144
+ );
1145
+
1146
+ this.elementIsWrapper = true;
1147
+
1148
+ margins = {
1149
+ marginTop: this.originalElement.css( "marginTop" ),
1150
+ marginRight: this.originalElement.css( "marginRight" ),
1151
+ marginBottom: this.originalElement.css( "marginBottom" ),
1152
+ marginLeft: this.originalElement.css( "marginLeft" )
1153
+ };
1154
+
1155
+ this.element.css( margins );
1156
+ this.originalElement.css( "margin", 0 );
1157
+
1158
+ // support: Safari
1159
+ // Prevent Safari textarea resize
1160
+ this.originalResizeStyle = this.originalElement.css( "resize" );
1161
+ this.originalElement.css( "resize", "none" );
1162
+
1163
+ this._proportionallyResizeElements.push( this.originalElement.css( {
1164
+ position: "static",
1165
+ zoom: 1,
1166
+ display: "block"
1167
+ } ) );
1168
+
1169
+ // Support: IE9
1170
+ // avoid IE jump (hard set the margin)
1171
+ this.originalElement.css( margins );
1172
+
1173
+ this._proportionallyResize();
1174
+ }
1175
+
1176
+ this._setupHandles();
1177
+
1178
+ if ( o.autoHide ) {
1179
+ $( this.element )
1180
+ .on( "mouseenter", function() {
1181
+ if ( o.disabled ) {
1182
+ return;
1183
+ }
1184
+ that._removeClass( "ui-resizable-autohide" );
1185
+ that._handles.show();
1186
+ } )
1187
+ .on( "mouseleave", function() {
1188
+ if ( o.disabled ) {
1189
+ return;
1190
+ }
1191
+ if ( !that.resizing ) {
1192
+ that._addClass( "ui-resizable-autohide" );
1193
+ that._handles.hide();
1194
+ }
1195
+ } );
1196
+ }
1197
+
1198
+ this._mouseInit();
1199
+ },
1200
+
1201
+ _destroy: function() {
1202
+
1203
+ this._mouseDestroy();
1204
+
1205
+ var wrapper,
1206
+ _destroy = function( exp ) {
1207
+ $( exp )
1208
+ .removeData( "resizable" )
1209
+ .removeData( "ui-resizable" )
1210
+ .off( ".resizable" )
1211
+ .find( ".ui-resizable-handle" )
1212
+ .remove();
1213
+ };
1214
+
1215
+ // TODO: Unwrap at same DOM position
1216
+ if ( this.elementIsWrapper ) {
1217
+ _destroy( this.element );
1218
+ wrapper = this.element;
1219
+ this.originalElement.css( {
1220
+ position: wrapper.css( "position" ),
1221
+ width: wrapper.outerWidth(),
1222
+ height: wrapper.outerHeight(),
1223
+ top: wrapper.css( "top" ),
1224
+ left: wrapper.css( "left" )
1225
+ } ).insertAfter( wrapper );
1226
+ wrapper.remove();
1227
+ }
1228
+
1229
+ this.originalElement.css( "resize", this.originalResizeStyle );
1230
+ _destroy( this.originalElement );
1231
+
1232
+ return this;
1233
+ },
1234
+
1235
+ _setOption: function( key, value ) {
1236
+ this._super( key, value );
1237
+
1238
+ switch ( key ) {
1239
+ case "handles":
1240
+ this._removeHandles();
1241
+ this._setupHandles();
1242
+ break;
1243
+ default:
1244
+ break;
1245
+ }
1246
+ },
1247
+
1248
+ _setupHandles: function() {
1249
+ var o = this.options, handle, i, n, hname, axis, that = this;
1250
+ this.handles = o.handles ||
1251
+ ( !$( ".ui-resizable-handle", this.element ).length ?
1252
+ "e,s,se" : {
1253
+ n: ".ui-resizable-n",
1254
+ e: ".ui-resizable-e",
1255
+ s: ".ui-resizable-s",
1256
+ w: ".ui-resizable-w",
1257
+ se: ".ui-resizable-se",
1258
+ sw: ".ui-resizable-sw",
1259
+ ne: ".ui-resizable-ne",
1260
+ nw: ".ui-resizable-nw"
1261
+ } );
1262
+
1263
+ this._handles = $();
1264
+ if ( this.handles.constructor === String ) {
1265
+
1266
+ if ( this.handles === "all" ) {
1267
+ this.handles = "n,e,s,w,se,sw,ne,nw";
1268
+ }
1269
+
1270
+ n = this.handles.split( "," );
1271
+ this.handles = {};
1272
+
1273
+ for ( i = 0; i < n.length; i++ ) {
1274
+
1275
+ handle = $.trim( n[ i ] );
1276
+ hname = "ui-resizable-" + handle;
1277
+ axis = $( "<div>" );
1278
+ this._addClass( axis, "ui-resizable-handle " + hname );
1279
+
1280
+ axis.css( { zIndex: o.zIndex } );
1281
+
1282
+ this.handles[ handle ] = ".ui-resizable-" + handle;
1283
+ this.element.append( axis );
1284
+ }
1285
+
1286
+ }
1287
+
1288
+ this._renderAxis = function( target ) {
1289
+
1290
+ var i, axis, padPos, padWrapper;
1291
+
1292
+ target = target || this.element;
1293
+
1294
+ for ( i in this.handles ) {
1295
+
1296
+ if ( this.handles[ i ].constructor === String ) {
1297
+ this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show();
1298
+ } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) {
1299
+ this.handles[ i ] = $( this.handles[ i ] );
1300
+ this._on( this.handles[ i ], { "mousedown": that._mouseDown } );
1301
+ }
1302
+
1303
+ if ( this.elementIsWrapper &&
1304
+ this.originalElement[ 0 ]
1305
+ .nodeName
1306
+ .match( /^(textarea|input|select|button)$/i ) ) {
1307
+ axis = $( this.handles[ i ], this.element );
1308
+
1309
+ padWrapper = /sw|ne|nw|se|n|s/.test( i ) ?
1310
+ axis.outerHeight() :
1311
+ axis.outerWidth();
1312
+
1313
+ padPos = [ "padding",
1314
+ /ne|nw|n/.test( i ) ? "Top" :
1315
+ /se|sw|s/.test( i ) ? "Bottom" :
1316
+ /^e$/.test( i ) ? "Right" : "Left" ].join( "" );
1317
+
1318
+ target.css( padPos, padWrapper );
1319
+
1320
+ this._proportionallyResize();
1321
+ }
1322
+
1323
+ this._handles = this._handles.add( this.handles[ i ] );
1324
+ }
1325
+ };
1326
+
1327
+ // TODO: make renderAxis a prototype function
1328
+ this._renderAxis( this.element );
1329
+
1330
+ this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) );
1331
+ this._handles.disableSelection();
1332
+
1333
+ this._handles.on( "mouseover", function() {
1334
+ if ( !that.resizing ) {
1335
+ if ( this.className ) {
1336
+ axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i );
1337
+ }
1338
+ that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se";
1339
+ }
1340
+ } );
1341
+
1342
+ if ( o.autoHide ) {
1343
+ this._handles.hide();
1344
+ this._addClass( "ui-resizable-autohide" );
1345
+ }
1346
+ },
1347
+
1348
+ _removeHandles: function() {
1349
+ this._handles.remove();
1350
+ },
1351
+
1352
+ _mouseCapture: function( event ) {
1353
+ var i, handle,
1354
+ capture = false;
1355
+
1356
+ for ( i in this.handles ) {
1357
+ handle = $( this.handles[ i ] )[ 0 ];
1358
+ if ( handle === event.target || $.contains( handle, event.target ) ) {
1359
+ capture = true;
1360
+ }
1361
+ }
1362
+
1363
+ return !this.options.disabled && capture;
1364
+ },
1365
+
1366
+ _mouseStart: function( event ) {
1367
+
1368
+ var curleft, curtop, cursor,
1369
+ o = this.options,
1370
+ el = this.element;
1371
+
1372
+ this.resizing = true;
1373
+
1374
+ this._renderProxy();
1375
+
1376
+ curleft = this._num( this.helper.css( "left" ) );
1377
+ curtop = this._num( this.helper.css( "top" ) );
1378
+
1379
+ if ( o.containment ) {
1380
+ curleft += $( o.containment ).scrollLeft() || 0;
1381
+ curtop += $( o.containment ).scrollTop() || 0;
1382
+ }
1383
+
1384
+ this.offset = this.helper.offset();
1385
+ this.position = { left: curleft, top: curtop };
1386
+
1387
+ this.size = this._helper ? {
1388
+ width: this.helper.width(),
1389
+ height: this.helper.height()
1390
+ } : {
1391
+ width: el.width(),
1392
+ height: el.height()
1393
+ };
1394
+
1395
+ this.originalSize = this._helper ? {
1396
+ width: el.outerWidth(),
1397
+ height: el.outerHeight()
1398
+ } : {
1399
+ width: el.width(),
1400
+ height: el.height()
1401
+ };
1402
+
1403
+ this.sizeDiff = {
1404
+ width: el.outerWidth() - el.width(),
1405
+ height: el.outerHeight() - el.height()
1406
+ };
1407
+
1408
+ this.originalPosition = { left: curleft, top: curtop };
1409
+ this.originalMousePosition = { left: event.pageX, top: event.pageY };
1410
+
1411
+ this.aspectRatio = ( typeof o.aspectRatio === "number" ) ?
1412
+ o.aspectRatio :
1413
+ ( ( this.originalSize.width / this.originalSize.height ) || 1 );
1414
+
1415
+ cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" );
1416
+ $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor );
1417
+
1418
+ this._addClass( "ui-resizable-resizing" );
1419
+ this._propagate( "start", event );
1420
+ return true;
1421
+ },
1422
+
1423
+ _mouseDrag: function( event ) {
1424
+
1425
+ var data, props,
1426
+ smp = this.originalMousePosition,
1427
+ a = this.axis,
1428
+ dx = ( event.pageX - smp.left ) || 0,
1429
+ dy = ( event.pageY - smp.top ) || 0,
1430
+ trigger = this._change[ a ];
1431
+
1432
+ this._updatePrevProperties();
1433
+
1434
+ if ( !trigger ) {
1435
+ return false;
1436
+ }
1437
+
1438
+ data = trigger.apply( this, [ event, dx, dy ] );
1439
+
1440
+ this._updateVirtualBoundaries( event.shiftKey );
1441
+ if ( this._aspectRatio || event.shiftKey ) {
1442
+ data = this._updateRatio( data, event );
1443
+ }
1444
+
1445
+ data = this._respectSize( data, event );
1446
+
1447
+ this._updateCache( data );
1448
+
1449
+ this._propagate( "resize", event );
1450
+
1451
+ props = this._applyChanges();
1452
+
1453
+ if ( !this._helper && this._proportionallyResizeElements.length ) {
1454
+ this._proportionallyResize();
1455
+ }
1456
+
1457
+ if ( !$.isEmptyObject( props ) ) {
1458
+ this._updatePrevProperties();
1459
+ this._trigger( "resize", event, this.ui() );
1460
+ this._applyChanges();
1461
+ }
1462
+
1463
+ return false;
1464
+ },
1465
+
1466
+ _mouseStop: function( event ) {
1467
+
1468
+ this.resizing = false;
1469
+ var pr, ista, soffseth, soffsetw, s, left, top,
1470
+ o = this.options, that = this;
1471
+
1472
+ if ( this._helper ) {
1473
+
1474
+ pr = this._proportionallyResizeElements;
1475
+ ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName );
1476
+ soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height;
1477
+ soffsetw = ista ? 0 : that.sizeDiff.width;
1478
+
1479
+ s = {
1480
+ width: ( that.helper.width() - soffsetw ),
1481
+ height: ( that.helper.height() - soffseth )
1482
+ };
1483
+ left = ( parseFloat( that.element.css( "left" ) ) +
1484
+ ( that.position.left - that.originalPosition.left ) ) || null;
1485
+ top = ( parseFloat( that.element.css( "top" ) ) +
1486
+ ( that.position.top - that.originalPosition.top ) ) || null;
1487
+
1488
+ if ( !o.animate ) {
1489
+ this.element.css( $.extend( s, { top: top, left: left } ) );
1490
+ }
1491
+
1492
+ that.helper.height( that.size.height );
1493
+ that.helper.width( that.size.width );
1494
+
1495
+ if ( this._helper && !o.animate ) {
1496
+ this._proportionallyResize();
1497
+ }
1498
+ }
1499
+
1500
+ $( "body" ).css( "cursor", "auto" );
1501
+
1502
+ this._removeClass( "ui-resizable-resizing" );
1503
+
1504
+ this._propagate( "stop", event );
1505
+
1506
+ if ( this._helper ) {
1507
+ this.helper.remove();
1508
+ }
1509
+
1510
+ return false;
1511
+
1512
+ },
1513
+
1514
+ _updatePrevProperties: function() {
1515
+ this.prevPosition = {
1516
+ top: this.position.top,
1517
+ left: this.position.left
1518
+ };
1519
+ this.prevSize = {
1520
+ width: this.size.width,
1521
+ height: this.size.height
1522
+ };
1523
+ },
1524
+
1525
+ _applyChanges: function() {
1526
+ var props = {};
1527
+
1528
+ if ( this.position.top !== this.prevPosition.top ) {
1529
+ props.top = this.position.top + "px";
1530
+ }
1531
+ if ( this.position.left !== this.prevPosition.left ) {
1532
+ props.left = this.position.left + "px";
1533
+ }
1534
+ if ( this.size.width !== this.prevSize.width ) {
1535
+ props.width = this.size.width + "px";
1536
+ }
1537
+ if ( this.size.height !== this.prevSize.height ) {
1538
+ props.height = this.size.height + "px";
1539
+ }
1540
+
1541
+ this.helper.css( props );
1542
+
1543
+ return props;
1544
+ },
1545
+
1546
+ _updateVirtualBoundaries: function( forceAspectRatio ) {
1547
+ var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
1548
+ o = this.options;
1549
+
1550
+ b = {
1551
+ minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0,
1552
+ maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity,
1553
+ minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0,
1554
+ maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity
1555
+ };
1556
+
1557
+ if ( this._aspectRatio || forceAspectRatio ) {
1558
+ pMinWidth = b.minHeight * this.aspectRatio;
1559
+ pMinHeight = b.minWidth / this.aspectRatio;
1560
+ pMaxWidth = b.maxHeight * this.aspectRatio;
1561
+ pMaxHeight = b.maxWidth / this.aspectRatio;
1562
+
1563
+ if ( pMinWidth > b.minWidth ) {
1564
+ b.minWidth = pMinWidth;
1565
+ }
1566
+ if ( pMinHeight > b.minHeight ) {
1567
+ b.minHeight = pMinHeight;
1568
+ }
1569
+ if ( pMaxWidth < b.maxWidth ) {
1570
+ b.maxWidth = pMaxWidth;
1571
+ }
1572
+ if ( pMaxHeight < b.maxHeight ) {
1573
+ b.maxHeight = pMaxHeight;
1574
+ }
1575
+ }
1576
+ this._vBoundaries = b;
1577
+ },
1578
+
1579
+ _updateCache: function( data ) {
1580
+ this.offset = this.helper.offset();
1581
+ if ( this._isNumber( data.left ) ) {
1582
+ this.position.left = data.left;
1583
+ }
1584
+ if ( this._isNumber( data.top ) ) {
1585
+ this.position.top = data.top;
1586
+ }
1587
+ if ( this._isNumber( data.height ) ) {
1588
+ this.size.height = data.height;
1589
+ }
1590
+ if ( this._isNumber( data.width ) ) {
1591
+ this.size.width = data.width;
1592
+ }
1593
+ },
1594
+
1595
+ _updateRatio: function( data ) {
1596
+
1597
+ var cpos = this.position,
1598
+ csize = this.size,
1599
+ a = this.axis;
1600
+
1601
+ if ( this._isNumber( data.height ) ) {
1602
+ data.width = ( data.height * this.aspectRatio );
1603
+ } else if ( this._isNumber( data.width ) ) {
1604
+ data.height = ( data.width / this.aspectRatio );
1605
+ }
1606
+
1607
+ if ( a === "sw" ) {
1608
+ data.left = cpos.left + ( csize.width - data.width );
1609
+ data.top = null;
1610
+ }
1611
+ if ( a === "nw" ) {
1612
+ data.top = cpos.top + ( csize.height - data.height );
1613
+ data.left = cpos.left + ( csize.width - data.width );
1614
+ }
1615
+
1616
+ return data;
1617
+ },
1618
+
1619
+ _respectSize: function( data ) {
1620
+
1621
+ var o = this._vBoundaries,
1622
+ a = this.axis,
1623
+ ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ),
1624
+ ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ),
1625
+ isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ),
1626
+ isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ),
1627
+ dw = this.originalPosition.left + this.originalSize.width,
1628
+ dh = this.originalPosition.top + this.originalSize.height,
1629
+ cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a );
1630
+ if ( isminw ) {
1631
+ data.width = o.minWidth;
1632
+ }
1633
+ if ( isminh ) {
1634
+ data.height = o.minHeight;
1635
+ }
1636
+ if ( ismaxw ) {
1637
+ data.width = o.maxWidth;
1638
+ }
1639
+ if ( ismaxh ) {
1640
+ data.height = o.maxHeight;
1641
+ }
1642
+
1643
+ if ( isminw && cw ) {
1644
+ data.left = dw - o.minWidth;
1645
+ }
1646
+ if ( ismaxw && cw ) {
1647
+ data.left = dw - o.maxWidth;
1648
+ }
1649
+ if ( isminh && ch ) {
1650
+ data.top = dh - o.minHeight;
1651
+ }
1652
+ if ( ismaxh && ch ) {
1653
+ data.top = dh - o.maxHeight;
1654
+ }
1655
+
1656
+ // Fixing jump error on top/left - bug #2330
1657
+ if ( !data.width && !data.height && !data.left && data.top ) {
1658
+ data.top = null;
1659
+ } else if ( !data.width && !data.height && !data.top && data.left ) {
1660
+ data.left = null;
1661
+ }
1662
+
1663
+ return data;
1664
+ },
1665
+
1666
+ _getPaddingPlusBorderDimensions: function( element ) {
1667
+ var i = 0,
1668
+ widths = [],
1669
+ borders = [
1670
+ element.css( "borderTopWidth" ),
1671
+ element.css( "borderRightWidth" ),
1672
+ element.css( "borderBottomWidth" ),
1673
+ element.css( "borderLeftWidth" )
1674
+ ],
1675
+ paddings = [
1676
+ element.css( "paddingTop" ),
1677
+ element.css( "paddingRight" ),
1678
+ element.css( "paddingBottom" ),
1679
+ element.css( "paddingLeft" )
1680
+ ];
1681
+
1682
+ for ( ; i < 4; i++ ) {
1683
+ widths[ i ] = ( parseFloat( borders[ i ] ) || 0 );
1684
+ widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 );
1685
+ }
1686
+
1687
+ return {
1688
+ height: widths[ 0 ] + widths[ 2 ],
1689
+ width: widths[ 1 ] + widths[ 3 ]
1690
+ };
1691
+ },
1692
+
1693
+ _proportionallyResize: function() {
1694
+
1695
+ if ( !this._proportionallyResizeElements.length ) {
1696
+ return;
1697
+ }
1698
+
1699
+ var prel,
1700
+ i = 0,
1701
+ element = this.helper || this.element;
1702
+
1703
+ for ( ; i < this._proportionallyResizeElements.length; i++ ) {
1704
+
1705
+ prel = this._proportionallyResizeElements[ i ];
1706
+
1707
+ // TODO: Seems like a bug to cache this.outerDimensions
1708
+ // considering that we are in a loop.
1709
+ if ( !this.outerDimensions ) {
1710
+ this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
1711
+ }
1712
+
1713
+ prel.css( {
1714
+ height: ( element.height() - this.outerDimensions.height ) || 0,
1715
+ width: ( element.width() - this.outerDimensions.width ) || 0
1716
+ } );
1717
+
1718
+ }
1719
+
1720
+ },
1721
+
1722
+ _renderProxy: function() {
1723
+
1724
+ var el = this.element, o = this.options;
1725
+ this.elementOffset = el.offset();
1726
+
1727
+ if ( this._helper ) {
1728
+
1729
+ this.helper = this.helper || $( "<div style='overflow:hidden;'></div>" );
1730
+
1731
+ this._addClass( this.helper, this._helper );
1732
+ this.helper.css( {
1733
+ width: this.element.outerWidth(),
1734
+ height: this.element.outerHeight(),
1735
+ position: "absolute",
1736
+ left: this.elementOffset.left + "px",
1737
+ top: this.elementOffset.top + "px",
1738
+ zIndex: ++o.zIndex //TODO: Don't modify option
1739
+ } );
1740
+
1741
+ this.helper
1742
+ .appendTo( "body" )
1743
+ .disableSelection();
1744
+
1745
+ } else {
1746
+ this.helper = this.element;
1747
+ }
1748
+
1749
+ },
1750
+
1751
+ _change: {
1752
+ e: function( event, dx ) {
1753
+ return { width: this.originalSize.width + dx };
1754
+ },
1755
+ w: function( event, dx ) {
1756
+ var cs = this.originalSize, sp = this.originalPosition;
1757
+ return { left: sp.left + dx, width: cs.width - dx };
1758
+ },
1759
+ n: function( event, dx, dy ) {
1760
+ var cs = this.originalSize, sp = this.originalPosition;
1761
+ return { top: sp.top + dy, height: cs.height - dy };
1762
+ },
1763
+ s: function( event, dx, dy ) {
1764
+ return { height: this.originalSize.height + dy };
1765
+ },
1766
+ se: function( event, dx, dy ) {
1767
+ return $.extend( this._change.s.apply( this, arguments ),
1768
+ this._change.e.apply( this, [ event, dx, dy ] ) );
1769
+ },
1770
+ sw: function( event, dx, dy ) {
1771
+ return $.extend( this._change.s.apply( this, arguments ),
1772
+ this._change.w.apply( this, [ event, dx, dy ] ) );
1773
+ },
1774
+ ne: function( event, dx, dy ) {
1775
+ return $.extend( this._change.n.apply( this, arguments ),
1776
+ this._change.e.apply( this, [ event, dx, dy ] ) );
1777
+ },
1778
+ nw: function( event, dx, dy ) {
1779
+ return $.extend( this._change.n.apply( this, arguments ),
1780
+ this._change.w.apply( this, [ event, dx, dy ] ) );
1781
+ }
1782
+ },
1783
+
1784
+ _propagate: function( n, event ) {
1785
+ $.ui.plugin.call( this, n, [ event, this.ui() ] );
1786
+ ( n !== "resize" && this._trigger( n, event, this.ui() ) );
1787
+ },
1788
+
1789
+ plugins: {},
1790
+
1791
+ ui: function() {
1792
+ return {
1793
+ originalElement: this.originalElement,
1794
+ element: this.element,
1795
+ helper: this.helper,
1796
+ position: this.position,
1797
+ size: this.size,
1798
+ originalSize: this.originalSize,
1799
+ originalPosition: this.originalPosition
1800
+ };
1801
+ }
1802
+
1803
+ } );
1804
+
1805
+ /*
1806
+ * Resizable Extensions
1807
+ */
1808
+
1809
+ $.ui.plugin.add( "resizable", "animate", {
1810
+
1811
+ stop: function( event ) {
1812
+ var that = $( this ).resizable( "instance" ),
1813
+ o = that.options,
1814
+ pr = that._proportionallyResizeElements,
1815
+ ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ),
1816
+ soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height,
1817
+ soffsetw = ista ? 0 : that.sizeDiff.width,
1818
+ style = {
1819
+ width: ( that.size.width - soffsetw ),
1820
+ height: ( that.size.height - soffseth )
1821
+ },
1822
+ left = ( parseFloat( that.element.css( "left" ) ) +
1823
+ ( that.position.left - that.originalPosition.left ) ) || null,
1824
+ top = ( parseFloat( that.element.css( "top" ) ) +
1825
+ ( that.position.top - that.originalPosition.top ) ) || null;
1826
+
1827
+ that.element.animate(
1828
+ $.extend( style, top && left ? { top: top, left: left } : {} ), {
1829
+ duration: o.animateDuration,
1830
+ easing: o.animateEasing,
1831
+ step: function() {
1832
+
1833
+ var data = {
1834
+ width: parseFloat( that.element.css( "width" ) ),
1835
+ height: parseFloat( that.element.css( "height" ) ),
1836
+ top: parseFloat( that.element.css( "top" ) ),
1837
+ left: parseFloat( that.element.css( "left" ) )
1838
+ };
1839
+
1840
+ if ( pr && pr.length ) {
1841
+ $( pr[ 0 ] ).css( { width: data.width, height: data.height } );
1842
+ }
1843
+
1844
+ // Propagating resize, and updating values for each animation step
1845
+ that._updateCache( data );
1846
+ that._propagate( "resize", event );
1847
+
1848
+ }
1849
+ }
1850
+ );
1851
+ }
1852
+
1853
+ } );
1854
+
1855
+ $.ui.plugin.add( "resizable", "containment", {
1856
+
1857
+ start: function() {
1858
+ var element, p, co, ch, cw, width, height,
1859
+ that = $( this ).resizable( "instance" ),
1860
+ o = that.options,
1861
+ el = that.element,
1862
+ oc = o.containment,
1863
+ ce = ( oc instanceof $ ) ?
1864
+ oc.get( 0 ) :
1865
+ ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc;
1866
+
1867
+ if ( !ce ) {
1868
+ return;
1869
+ }
1870
+
1871
+ that.containerElement = $( ce );
1872
+
1873
+ if ( /document/.test( oc ) || oc === document ) {
1874
+ that.containerOffset = {
1875
+ left: 0,
1876
+ top: 0
1877
+ };
1878
+ that.containerPosition = {
1879
+ left: 0,
1880
+ top: 0
1881
+ };
1882
+
1883
+ that.parentData = {
1884
+ element: $( document ),
1885
+ left: 0,
1886
+ top: 0,
1887
+ width: $( document ).width(),
1888
+ height: $( document ).height() || document.body.parentNode.scrollHeight
1889
+ };
1890
+ } else {
1891
+ element = $( ce );
1892
+ p = [];
1893
+ $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) {
1894
+ p[ i ] = that._num( element.css( "padding" + name ) );
1895
+ } );
1896
+
1897
+ that.containerOffset = element.offset();
1898
+ that.containerPosition = element.position();
1899
+ that.containerSize = {
1900
+ height: ( element.innerHeight() - p[ 3 ] ),
1901
+ width: ( element.innerWidth() - p[ 1 ] )
1902
+ };
1903
+
1904
+ co = that.containerOffset;
1905
+ ch = that.containerSize.height;
1906
+ cw = that.containerSize.width;
1907
+ width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw );
1908
+ height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ;
1909
+
1910
+ that.parentData = {
1911
+ element: ce,
1912
+ left: co.left,
1913
+ top: co.top,
1914
+ width: width,
1915
+ height: height
1916
+ };
1917
+ }
1918
+ },
1919
+
1920
+ resize: function( event ) {
1921
+ var woset, hoset, isParent, isOffsetRelative,
1922
+ that = $( this ).resizable( "instance" ),
1923
+ o = that.options,
1924
+ co = that.containerOffset,
1925
+ cp = that.position,
1926
+ pRatio = that._aspectRatio || event.shiftKey,
1927
+ cop = {
1928
+ top: 0,
1929
+ left: 0
1930
+ },
1931
+ ce = that.containerElement,
1932
+ continueResize = true;
1933
+
1934
+ if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) {
1935
+ cop = co;
1936
+ }
1937
+
1938
+ if ( cp.left < ( that._helper ? co.left : 0 ) ) {
1939
+ that.size.width = that.size.width +
1940
+ ( that._helper ?
1941
+ ( that.position.left - co.left ) :
1942
+ ( that.position.left - cop.left ) );
1943
+
1944
+ if ( pRatio ) {
1945
+ that.size.height = that.size.width / that.aspectRatio;
1946
+ continueResize = false;
1947
+ }
1948
+ that.position.left = o.helper ? co.left : 0;
1949
+ }
1950
+
1951
+ if ( cp.top < ( that._helper ? co.top : 0 ) ) {
1952
+ that.size.height = that.size.height +
1953
+ ( that._helper ?
1954
+ ( that.position.top - co.top ) :
1955
+ that.position.top );
1956
+
1957
+ if ( pRatio ) {
1958
+ that.size.width = that.size.height * that.aspectRatio;
1959
+ continueResize = false;
1960
+ }
1961
+ that.position.top = that._helper ? co.top : 0;
1962
+ }
1963
+
1964
+ isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
1965
+ isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
1966
+
1967
+ if ( isParent && isOffsetRelative ) {
1968
+ that.offset.left = that.parentData.left + that.position.left;
1969
+ that.offset.top = that.parentData.top + that.position.top;
1970
+ } else {
1971
+ that.offset.left = that.element.offset().left;
1972
+ that.offset.top = that.element.offset().top;
1973
+ }
1974
+
1975
+ woset = Math.abs( that.sizeDiff.width +
1976
+ ( that._helper ?
1977
+ that.offset.left - cop.left :
1978
+ ( that.offset.left - co.left ) ) );
1979
+
1980
+ hoset = Math.abs( that.sizeDiff.height +
1981
+ ( that._helper ?
1982
+ that.offset.top - cop.top :
1983
+ ( that.offset.top - co.top ) ) );
1984
+
1985
+ if ( woset + that.size.width >= that.parentData.width ) {
1986
+ that.size.width = that.parentData.width - woset;
1987
+ if ( pRatio ) {
1988
+ that.size.height = that.size.width / that.aspectRatio;
1989
+ continueResize = false;
1990
+ }
1991
+ }
1992
+
1993
+ if ( hoset + that.size.height >= that.parentData.height ) {
1994
+ that.size.height = that.parentData.height - hoset;
1995
+ if ( pRatio ) {
1996
+ that.size.width = that.size.height * that.aspectRatio;
1997
+ continueResize = false;
1998
+ }
1999
+ }
2000
+
2001
+ if ( !continueResize ) {
2002
+ that.position.left = that.prevPosition.left;
2003
+ that.position.top = that.prevPosition.top;
2004
+ that.size.width = that.prevSize.width;
2005
+ that.size.height = that.prevSize.height;
2006
+ }
2007
+ },
2008
+
2009
+ stop: function() {
2010
+ var that = $( this ).resizable( "instance" ),
2011
+ o = that.options,
2012
+ co = that.containerOffset,
2013
+ cop = that.containerPosition,
2014
+ ce = that.containerElement,
2015
+ helper = $( that.helper ),
2016
+ ho = helper.offset(),
2017
+ w = helper.outerWidth() - that.sizeDiff.width,
2018
+ h = helper.outerHeight() - that.sizeDiff.height;
2019
+
2020
+ if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) {
2021
+ $( this ).css( {
2022
+ left: ho.left - cop.left - co.left,
2023
+ width: w,
2024
+ height: h
2025
+ } );
2026
+ }
2027
+
2028
+ if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) {
2029
+ $( this ).css( {
2030
+ left: ho.left - cop.left - co.left,
2031
+ width: w,
2032
+ height: h
2033
+ } );
2034
+ }
2035
+ }
2036
+ } );
2037
+
2038
+ $.ui.plugin.add( "resizable", "alsoResize", {
2039
+
2040
+ start: function() {
2041
+ var that = $( this ).resizable( "instance" ),
2042
+ o = that.options;
2043
+
2044
+ $( o.alsoResize ).each( function() {
2045
+ var el = $( this );
2046
+ el.data( "ui-resizable-alsoresize", {
2047
+ width: parseFloat( el.width() ), height: parseFloat( el.height() ),
2048
+ left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) )
2049
+ } );
2050
+ } );
2051
+ },
2052
+
2053
+ resize: function( event, ui ) {
2054
+ var that = $( this ).resizable( "instance" ),
2055
+ o = that.options,
2056
+ os = that.originalSize,
2057
+ op = that.originalPosition,
2058
+ delta = {
2059
+ height: ( that.size.height - os.height ) || 0,
2060
+ width: ( that.size.width - os.width ) || 0,
2061
+ top: ( that.position.top - op.top ) || 0,
2062
+ left: ( that.position.left - op.left ) || 0
2063
+ };
2064
+
2065
+ $( o.alsoResize ).each( function() {
2066
+ var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {},
2067
+ css = el.parents( ui.originalElement[ 0 ] ).length ?
2068
+ [ "width", "height" ] :
2069
+ [ "width", "height", "top", "left" ];
2070
+
2071
+ $.each( css, function( i, prop ) {
2072
+ var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 );
2073
+ if ( sum && sum >= 0 ) {
2074
+ style[ prop ] = sum || null;
2075
+ }
2076
+ } );
2077
+
2078
+ el.css( style );
2079
+ } );
2080
+ },
2081
+
2082
+ stop: function() {
2083
+ $( this ).removeData( "ui-resizable-alsoresize" );
2084
+ }
2085
+ } );
2086
+
2087
+ $.ui.plugin.add( "resizable", "ghost", {
2088
+
2089
+ start: function() {
2090
+
2091
+ var that = $( this ).resizable( "instance" ), cs = that.size;
2092
+
2093
+ that.ghost = that.originalElement.clone();
2094
+ that.ghost.css( {
2095
+ opacity: 0.25,
2096
+ display: "block",
2097
+ position: "relative",
2098
+ height: cs.height,
2099
+ width: cs.width,
2100
+ margin: 0,
2101
+ left: 0,
2102
+ top: 0
2103
+ } );
2104
+
2105
+ that._addClass( that.ghost, "ui-resizable-ghost" );
2106
+
2107
+ // DEPRECATED
2108
+ // TODO: remove after 1.12
2109
+ if ( $.uiBackCompat !== false && typeof that.options.ghost === "string" ) {
2110
+
2111
+ // Ghost option
2112
+ that.ghost.addClass( this.options.ghost );
2113
+ }
2114
+
2115
+ that.ghost.appendTo( that.helper );
2116
+
2117
+ },
2118
+
2119
+ resize: function() {
2120
+ var that = $( this ).resizable( "instance" );
2121
+ if ( that.ghost ) {
2122
+ that.ghost.css( {
2123
+ position: "relative",
2124
+ height: that.size.height,
2125
+ width: that.size.width
2126
+ } );
2127
+ }
2128
+ },
2129
+
2130
+ stop: function() {
2131
+ var that = $( this ).resizable( "instance" );
2132
+ if ( that.ghost && that.helper ) {
2133
+ that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) );
2134
+ }
2135
+ }
2136
+
2137
+ } );
2138
+
2139
+ $.ui.plugin.add( "resizable", "grid", {
2140
+
2141
+ resize: function() {
2142
+ var outerDimensions,
2143
+ that = $( this ).resizable( "instance" ),
2144
+ o = that.options,
2145
+ cs = that.size,
2146
+ os = that.originalSize,
2147
+ op = that.originalPosition,
2148
+ a = that.axis,
2149
+ grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
2150
+ gridX = ( grid[ 0 ] || 1 ),
2151
+ gridY = ( grid[ 1 ] || 1 ),
2152
+ ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX,
2153
+ oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY,
2154
+ newWidth = os.width + ox,
2155
+ newHeight = os.height + oy,
2156
+ isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ),
2157
+ isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ),
2158
+ isMinWidth = o.minWidth && ( o.minWidth > newWidth ),
2159
+ isMinHeight = o.minHeight && ( o.minHeight > newHeight );
2160
+
2161
+ o.grid = grid;
2162
+
2163
+ if ( isMinWidth ) {
2164
+ newWidth += gridX;
2165
+ }
2166
+ if ( isMinHeight ) {
2167
+ newHeight += gridY;
2168
+ }
2169
+ if ( isMaxWidth ) {
2170
+ newWidth -= gridX;
2171
+ }
2172
+ if ( isMaxHeight ) {
2173
+ newHeight -= gridY;
2174
+ }
2175
+
2176
+ if ( /^(se|s|e)$/.test( a ) ) {
2177
+ that.size.width = newWidth;
2178
+ that.size.height = newHeight;
2179
+ } else if ( /^(ne)$/.test( a ) ) {
2180
+ that.size.width = newWidth;
2181
+ that.size.height = newHeight;
2182
+ that.position.top = op.top - oy;
2183
+ } else if ( /^(sw)$/.test( a ) ) {
2184
+ that.size.width = newWidth;
2185
+ that.size.height = newHeight;
2186
+ that.position.left = op.left - ox;
2187
+ } else {
2188
+ if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) {
2189
+ outerDimensions = that._getPaddingPlusBorderDimensions( this );
2190
+ }
2191
+
2192
+ if ( newHeight - gridY > 0 ) {
2193
+ that.size.height = newHeight;
2194
+ that.position.top = op.top - oy;
2195
+ } else {
2196
+ newHeight = gridY - outerDimensions.height;
2197
+ that.size.height = newHeight;
2198
+ that.position.top = op.top + os.height - newHeight;
2199
+ }
2200
+ if ( newWidth - gridX > 0 ) {
2201
+ that.size.width = newWidth;
2202
+ that.position.left = op.left - ox;
2203
+ } else {
2204
+ newWidth = gridX - outerDimensions.width;
2205
+ that.size.width = newWidth;
2206
+ that.position.left = op.left + os.width - newWidth;
2207
+ }
2208
+ }
2209
+ }
2210
+
2211
+ } );
2212
+
2213
+ var widgetsResizable = $.ui.resizable;
2214
+
2215
+
2216
+
2217
+
2218
+ }));
2219
+