cloudinary 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -1
  3. data/.travis.yml +12 -6
  4. data/CHANGELOG.md +30 -0
  5. data/cloudinary.gemspec +2 -0
  6. data/lib/active_storage/blob_key.rb +20 -0
  7. data/lib/active_storage/service/cloudinary_service.rb +181 -0
  8. data/lib/cloudinary.rb +9 -4
  9. data/lib/cloudinary/api.rb +17 -4
  10. data/lib/cloudinary/auth_token.rb +6 -4
  11. data/lib/cloudinary/uploader.rb +4 -4
  12. data/lib/cloudinary/utils.rb +62 -29
  13. data/lib/cloudinary/version.rb +1 -1
  14. data/spec/active_storage/Gemfile +12 -0
  15. data/spec/active_storage/application_system_test_case.rb +5 -0
  16. data/spec/active_storage/database/create_users_migration.rb +9 -0
  17. data/spec/active_storage/database/setup.rb +7 -0
  18. data/spec/active_storage/dummy/Rakefile +5 -0
  19. data/spec/active_storage/dummy/app/assets/config/manifest.js +3 -0
  20. data/spec/active_storage/dummy/app/assets/javascripts/application.js +13 -0
  21. data/spec/active_storage/dummy/app/assets/stylesheets/application.css +15 -0
  22. data/spec/active_storage/dummy/app/controllers/application_controller.rb +5 -0
  23. data/spec/active_storage/dummy/app/helpers/application_helper.rb +4 -0
  24. data/spec/active_storage/dummy/app/jobs/application_job.rb +4 -0
  25. data/spec/active_storage/dummy/app/models/application_record.rb +5 -0
  26. data/spec/active_storage/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/active_storage/dummy/bin/bundle +5 -0
  28. data/spec/active_storage/dummy/bin/rails +6 -0
  29. data/spec/active_storage/dummy/bin/rake +6 -0
  30. data/spec/active_storage/dummy/bin/yarn +11 -0
  31. data/spec/active_storage/dummy/config.ru +7 -0
  32. data/spec/active_storage/dummy/config/application.rb +22 -0
  33. data/spec/active_storage/dummy/config/boot.rb +7 -0
  34. data/spec/active_storage/dummy/config/database.yml +25 -0
  35. data/spec/active_storage/dummy/config/environment.rb +7 -0
  36. data/spec/active_storage/dummy/config/environments/development.rb +52 -0
  37. data/spec/active_storage/dummy/config/environments/production.rb +83 -0
  38. data/spec/active_storage/dummy/config/environments/test.rb +38 -0
  39. data/spec/active_storage/dummy/config/initializers/application_controller_renderer.rb +7 -0
  40. data/spec/active_storage/dummy/config/initializers/assets.rb +16 -0
  41. data/spec/active_storage/dummy/config/initializers/backtrace_silencers.rb +8 -0
  42. data/spec/active_storage/dummy/config/initializers/cookies_serializer.rb +7 -0
  43. data/spec/active_storage/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  44. data/spec/active_storage/dummy/config/initializers/inflections.rb +17 -0
  45. data/spec/active_storage/dummy/config/initializers/mime_types.rb +5 -0
  46. data/spec/active_storage/dummy/config/initializers/wrap_parameters.rb +16 -0
  47. data/spec/active_storage/dummy/config/routes.rb +4 -0
  48. data/spec/active_storage/dummy/config/secrets.yml +32 -0
  49. data/spec/active_storage/dummy/config/spring.rb +8 -0
  50. data/spec/active_storage/dummy/config/storage.yml +3 -0
  51. data/spec/active_storage/dummy/config/webpacker.yml +72 -0
  52. data/spec/active_storage/dummy/package.json +5 -0
  53. data/spec/active_storage/dummy/public/404.html +67 -0
  54. data/spec/active_storage/dummy/public/422.html +67 -0
  55. data/spec/active_storage/dummy/public/500.html +66 -0
  56. data/spec/active_storage/dummy/public/apple-touch-icon-precomposed.png +0 -0
  57. data/spec/active_storage/dummy/public/apple-touch-icon.png +0 -0
  58. data/spec/active_storage/dummy/public/favicon.ico +0 -0
  59. data/spec/active_storage/fixtures/files/colors.bmp +0 -0
  60. data/spec/active_storage/fixtures/files/empty_file.txt +0 -0
  61. data/spec/active_storage/fixtures/files/favicon.ico +0 -0
  62. data/spec/active_storage/fixtures/files/icon.psd +0 -0
  63. data/spec/active_storage/fixtures/files/icon.svg +13 -0
  64. data/spec/active_storage/fixtures/files/image.gif +0 -0
  65. data/spec/active_storage/fixtures/files/racecar.jpg +0 -0
  66. data/spec/active_storage/fixtures/files/racecar.tif +0 -0
  67. data/spec/active_storage/fixtures/files/racecar_rotated.jpg +0 -0
  68. data/spec/active_storage/fixtures/files/report.pdf +0 -0
  69. data/spec/active_storage/fixtures/files/rotated_video.mp4 +0 -0
  70. data/spec/active_storage/fixtures/files/video.mp4 +0 -0
  71. data/spec/active_storage/fixtures/files/video_with_rectangular_samples.mp4 +0 -0
  72. data/spec/active_storage/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 +0 -0
  73. data/spec/active_storage/fixtures/files/video_without_video_stream.mp4 +0 -0
  74. data/spec/active_storage/service/cloudinary_service_spec.rb +92 -0
  75. data/spec/active_storage/service/configurations.yml +4 -0
  76. data/spec/active_storage/test_helper.rb +43 -0
  77. data/spec/api_spec.rb +68 -12
  78. data/spec/archive_spec.rb +17 -1
  79. data/spec/cloudinary_helper_spec.rb +2 -0
  80. data/spec/cloudinary_spec.rb +30 -6
  81. data/spec/movie.mp4 +0 -0
  82. data/spec/spec_helper.rb +9 -2
  83. data/spec/uploader_spec.rb +20 -3
  84. data/spec/utils_methods_spec.rb +29 -2
  85. data/spec/utils_spec.rb +93 -11
  86. data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +31 -1
  87. data/vendor/assets/javascripts/cloudinary/jquery.fileupload.js +24 -4
  88. data/vendor/assets/javascripts/cloudinary/jquery.ui.widget.js +741 -561
  89. data/vendor/assets/javascripts/cloudinary/load-image.all.min.js +1 -1
  90. metadata +161 -3
@@ -1,571 +1,751 @@
1
- /*! jQuery UI - v1.11.4+CommonJS - 2015-08-28
2
- * http://jqueryui.com
3
- * Includes: widget.js
4
- * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
1
+ /*! jQuery UI - v1.12.1+CommonJS - 2018-02-10
2
+ * http://jqueryui.com
3
+ * Includes: widget.js
4
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
5
 
6
6
  (function( factory ) {
7
- if ( typeof define === "function" && define.amd ) {
7
+ if ( typeof define === "function" && define.amd ) {
8
8
 
9
- // AMD. Register as an anonymous module.
10
- define([ "jquery" ], factory );
9
+ // AMD. Register as an anonymous module.
10
+ define([ "jquery" ], factory );
11
+ } else if ( typeof exports === "object" ) {
11
12
 
12
- } else if ( typeof exports === "object" ) {
13
+ // Node/CommonJS
14
+ factory( require( "jquery" ) );
15
+ } else {
13
16
 
14
- // Node/CommonJS
15
- factory( require( "jquery" ) );
17
+ // Browser globals
18
+ factory( jQuery );
19
+ }
20
+ }(function( $ ) {
16
21
 
17
- } else {
22
+ $.ui = $.ui || {};
23
+
24
+ var version = $.ui.version = "1.12.1";
25
+
26
+
27
+ /*!
28
+ * jQuery UI Widget 1.12.1
29
+ * http://jqueryui.com
30
+ *
31
+ * Copyright jQuery Foundation and other contributors
32
+ * Released under the MIT license.
33
+ * http://jquery.org/license
34
+ */
35
+
36
+ //>>label: Widget
37
+ //>>group: Core
38
+ //>>description: Provides a factory for creating stateful widgets with a common API.
39
+ //>>docs: http://api.jqueryui.com/jQuery.widget/
40
+ //>>demos: http://jqueryui.com/widget/
41
+
42
+
43
+
44
+ var widgetUuid = 0;
45
+ var widgetSlice = Array.prototype.slice;
46
+
47
+ $.cleanData = ( function( orig ) {
48
+ return function( elems ) {
49
+ var events, elem, i;
50
+ for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
51
+ try {
52
+
53
+ // Only trigger remove when necessary to save time
54
+ events = $._data( elem, "events" );
55
+ if ( events && events.remove ) {
56
+ $( elem ).triggerHandler( "remove" );
57
+ }
58
+
59
+ // Http://bugs.jquery.com/ticket/8235
60
+ } catch ( e ) {}
61
+ }
62
+ orig( elems );
63
+ };
64
+ } )( $.cleanData );
65
+
66
+ $.widget = function( name, base, prototype ) {
67
+ var existingConstructor, constructor, basePrototype;
68
+
69
+ // ProxiedPrototype allows the provided prototype to remain unmodified
70
+ // so that it can be used as a mixin for multiple widgets (#8876)
71
+ var proxiedPrototype = {};
72
+
73
+ var namespace = name.split( "." )[ 0 ];
74
+ name = name.split( "." )[ 1 ];
75
+ var fullName = namespace + "-" + name;
76
+
77
+ if ( !prototype ) {
78
+ prototype = base;
79
+ base = $.Widget;
80
+ }
81
+
82
+ if ( $.isArray( prototype ) ) {
83
+ prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
84
+ }
85
+
86
+ // Create selector for plugin
87
+ $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
88
+ return !!$.data( elem, fullName );
89
+ };
90
+
91
+ $[ namespace ] = $[ namespace ] || {};
92
+ existingConstructor = $[ namespace ][ name ];
93
+ constructor = $[ namespace ][ name ] = function( options, element ) {
94
+
95
+ // Allow instantiation without "new" keyword
96
+ if ( !this._createWidget ) {
97
+ return new constructor( options, element );
98
+ }
99
+
100
+ // Allow instantiation without initializing for simple inheritance
101
+ // must use "new" keyword (the code above always passes args)
102
+ if ( arguments.length ) {
103
+ this._createWidget( options, element );
104
+ }
105
+ };
106
+
107
+ // Extend with the existing constructor to carry over any static properties
108
+ $.extend( constructor, existingConstructor, {
109
+ version: prototype.version,
110
+
111
+ // Copy the object used to create the prototype in case we need to
112
+ // redefine the widget later
113
+ _proto: $.extend( {}, prototype ),
114
+
115
+ // Track widgets that inherit from this widget in case this widget is
116
+ // redefined after a widget inherits from it
117
+ _childConstructors: []
118
+ } );
119
+
120
+ basePrototype = new base();
121
+
122
+ // We need to make the options hash a property directly on the new instance
123
+ // otherwise we'll modify the options hash on the prototype that we're
124
+ // inheriting from
125
+ basePrototype.options = $.widget.extend( {}, basePrototype.options );
126
+ $.each( prototype, function( prop, value ) {
127
+ if ( !$.isFunction( value ) ) {
128
+ proxiedPrototype[ prop ] = value;
129
+ return;
130
+ }
131
+ proxiedPrototype[ prop ] = ( function() {
132
+ function _super() {
133
+ return base.prototype[ prop ].apply( this, arguments );
134
+ }
135
+
136
+ function _superApply( args ) {
137
+ return base.prototype[ prop ].apply( this, args );
138
+ }
139
+
140
+ return function() {
141
+ var __super = this._super;
142
+ var __superApply = this._superApply;
143
+ var returnValue;
144
+
145
+ this._super = _super;
146
+ this._superApply = _superApply;
147
+
148
+ returnValue = value.apply( this, arguments );
149
+
150
+ this._super = __super;
151
+ this._superApply = __superApply;
152
+
153
+ return returnValue;
154
+ };
155
+ } )();
156
+ } );
157
+ constructor.prototype = $.widget.extend( basePrototype, {
158
+
159
+ // TODO: remove support for widgetEventPrefix
160
+ // always use the name + a colon as the prefix, e.g., draggable:start
161
+ // don't prefix for widgets that aren't DOM-based
162
+ widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
163
+ }, proxiedPrototype, {
164
+ constructor: constructor,
165
+ namespace: namespace,
166
+ widgetName: name,
167
+ widgetFullName: fullName
168
+ } );
169
+
170
+ // If this widget is being redefined then we need to find all widgets that
171
+ // are inheriting from it and redefine all of them so that they inherit from
172
+ // the new version of this widget. We're essentially trying to replace one
173
+ // level in the prototype chain.
174
+ if ( existingConstructor ) {
175
+ $.each( existingConstructor._childConstructors, function( i, child ) {
176
+ var childPrototype = child.prototype;
177
+
178
+ // Redefine the child widget using the same prototype that was
179
+ // originally used, but inherit from the new version of the base
180
+ $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
181
+ child._proto );
182
+ } );
183
+
184
+ // Remove the list of existing child constructors from the old constructor
185
+ // so the old child constructors can be garbage collected
186
+ delete existingConstructor._childConstructors;
187
+ } else {
188
+ base._childConstructors.push( constructor );
189
+ }
190
+
191
+ $.widget.bridge( name, constructor );
192
+
193
+ return constructor;
194
+ };
195
+
196
+ $.widget.extend = function( target ) {
197
+ var input = widgetSlice.call( arguments, 1 );
198
+ var inputIndex = 0;
199
+ var inputLength = input.length;
200
+ var key;
201
+ var value;
202
+
203
+ for ( ; inputIndex < inputLength; inputIndex++ ) {
204
+ for ( key in input[ inputIndex ] ) {
205
+ value = input[ inputIndex ][ key ];
206
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
207
+
208
+ // Clone objects
209
+ if ( $.isPlainObject( value ) ) {
210
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
211
+ $.widget.extend( {}, target[ key ], value ) :
212
+
213
+ // Don't extend strings, arrays, etc. with objects
214
+ $.widget.extend( {}, value );
215
+
216
+ // Copy everything else by reference
217
+ } else {
218
+ target[ key ] = value;
219
+ }
220
+ }
221
+ }
222
+ }
223
+ return target;
224
+ };
225
+
226
+ $.widget.bridge = function( name, object ) {
227
+ var fullName = object.prototype.widgetFullName || name;
228
+ $.fn[ name ] = function( options ) {
229
+ var isMethodCall = typeof options === "string";
230
+ var args = widgetSlice.call( arguments, 1 );
231
+ var returnValue = this;
232
+
233
+ if ( isMethodCall ) {
234
+
235
+ // If this is an empty collection, we need to have the instance method
236
+ // return undefined instead of the jQuery instance
237
+ if ( !this.length && options === "instance" ) {
238
+ returnValue = undefined;
239
+ } else {
240
+ this.each( function() {
241
+ var methodValue;
242
+ var instance = $.data( this, fullName );
243
+
244
+ if ( options === "instance" ) {
245
+ returnValue = instance;
246
+ return false;
247
+ }
248
+
249
+ if ( !instance ) {
250
+ return $.error( "cannot call methods on " + name +
251
+ " prior to initialization; " +
252
+ "attempted to call method '" + options + "'" );
253
+ }
254
+
255
+ if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
256
+ return $.error( "no such method '" + options + "' for " + name +
257
+ " widget instance" );
258
+ }
259
+
260
+ methodValue = instance[ options ].apply( instance, args );
261
+
262
+ if ( methodValue !== instance && methodValue !== undefined ) {
263
+ returnValue = methodValue && methodValue.jquery ?
264
+ returnValue.pushStack( methodValue.get() ) :
265
+ methodValue;
266
+ return false;
267
+ }
268
+ } );
269
+ }
270
+ } else {
271
+
272
+ // Allow multiple hashes to be passed on init
273
+ if ( args.length ) {
274
+ options = $.widget.extend.apply( null, [ options ].concat( args ) );
275
+ }
276
+
277
+ this.each( function() {
278
+ var instance = $.data( this, fullName );
279
+ if ( instance ) {
280
+ instance.option( options || {} );
281
+ if ( instance._init ) {
282
+ instance._init();
283
+ }
284
+ } else {
285
+ $.data( this, fullName, new object( options, this ) );
286
+ }
287
+ } );
288
+ }
289
+
290
+ return returnValue;
291
+ };
292
+ };
293
+
294
+ $.Widget = function( /* options, element */ ) {};
295
+ $.Widget._childConstructors = [];
296
+
297
+ $.Widget.prototype = {
298
+ widgetName: "widget",
299
+ widgetEventPrefix: "",
300
+ defaultElement: "<div>",
301
+
302
+ options: {
303
+ classes: {},
304
+ disabled: false,
305
+
306
+ // Callbacks
307
+ create: null
308
+ },
309
+
310
+ _createWidget: function( options, element ) {
311
+ element = $( element || this.defaultElement || this )[ 0 ];
312
+ this.element = $( element );
313
+ this.uuid = widgetUuid++;
314
+ this.eventNamespace = "." + this.widgetName + this.uuid;
315
+
316
+ this.bindings = $();
317
+ this.hoverable = $();
318
+ this.focusable = $();
319
+ this.classesElementLookup = {};
320
+
321
+ if ( element !== this ) {
322
+ $.data( element, this.widgetFullName, this );
323
+ this._on( true, this.element, {
324
+ remove: function( event ) {
325
+ if ( event.target === element ) {
326
+ this.destroy();
327
+ }
328
+ }
329
+ } );
330
+ this.document = $( element.style ?
331
+
332
+ // Element within the document
333
+ element.ownerDocument :
334
+
335
+ // Element is window or document
336
+ element.document || element );
337
+ this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
338
+ }
339
+
340
+ this.options = $.widget.extend( {},
341
+ this.options,
342
+ this._getCreateOptions(),
343
+ options );
344
+
345
+ this._create();
346
+
347
+ if ( this.options.disabled ) {
348
+ this._setOptionDisabled( this.options.disabled );
349
+ }
350
+
351
+ this._trigger( "create", null, this._getCreateEventData() );
352
+ this._init();
353
+ },
354
+
355
+ _getCreateOptions: function() {
356
+ return {};
357
+ },
358
+
359
+ _getCreateEventData: $.noop,
360
+
361
+ _create: $.noop,
362
+
363
+ _init: $.noop,
364
+
365
+ destroy: function() {
366
+ var that = this;
367
+
368
+ this._destroy();
369
+ $.each( this.classesElementLookup, function( key, value ) {
370
+ that._removeClass( value, key );
371
+ } );
372
+
373
+ // We can probably remove the unbind calls in 2.0
374
+ // all event bindings should go through this._on()
375
+ this.element
376
+ .off( this.eventNamespace )
377
+ .removeData( this.widgetFullName );
378
+ this.widget()
379
+ .off( this.eventNamespace )
380
+ .removeAttr( "aria-disabled" );
381
+
382
+ // Clean up events and states
383
+ this.bindings.off( this.eventNamespace );
384
+ },
385
+
386
+ _destroy: $.noop,
387
+
388
+ widget: function() {
389
+ return this.element;
390
+ },
391
+
392
+ option: function( key, value ) {
393
+ var options = key;
394
+ var parts;
395
+ var curOption;
396
+ var i;
397
+
398
+ if ( arguments.length === 0 ) {
399
+
400
+ // Don't return a reference to the internal hash
401
+ return $.widget.extend( {}, this.options );
402
+ }
403
+
404
+ if ( typeof key === "string" ) {
405
+
406
+ // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
407
+ options = {};
408
+ parts = key.split( "." );
409
+ key = parts.shift();
410
+ if ( parts.length ) {
411
+ curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
412
+ for ( i = 0; i < parts.length - 1; i++ ) {
413
+ curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
414
+ curOption = curOption[ parts[ i ] ];
415
+ }
416
+ key = parts.pop();
417
+ if ( arguments.length === 1 ) {
418
+ return curOption[ key ] === undefined ? null : curOption[ key ];
419
+ }
420
+ curOption[ key ] = value;
421
+ } else {
422
+ if ( arguments.length === 1 ) {
423
+ return this.options[ key ] === undefined ? null : this.options[ key ];
424
+ }
425
+ options[ key ] = value;
426
+ }
427
+ }
428
+
429
+ this._setOptions( options );
430
+
431
+ return this;
432
+ },
433
+
434
+ _setOptions: function( options ) {
435
+ var key;
436
+
437
+ for ( key in options ) {
438
+ this._setOption( key, options[ key ] );
439
+ }
440
+
441
+ return this;
442
+ },
443
+
444
+ _setOption: function( key, value ) {
445
+ if ( key === "classes" ) {
446
+ this._setOptionClasses( value );
447
+ }
448
+
449
+ this.options[ key ] = value;
450
+
451
+ if ( key === "disabled" ) {
452
+ this._setOptionDisabled( value );
453
+ }
454
+
455
+ return this;
456
+ },
457
+
458
+ _setOptionClasses: function( value ) {
459
+ var classKey, elements, currentElements;
460
+
461
+ for ( classKey in value ) {
462
+ currentElements = this.classesElementLookup[ classKey ];
463
+ if ( value[ classKey ] === this.options.classes[ classKey ] ||
464
+ !currentElements ||
465
+ !currentElements.length ) {
466
+ continue;
467
+ }
468
+
469
+ // We are doing this to create a new jQuery object because the _removeClass() call
470
+ // on the next line is going to destroy the reference to the current elements being
471
+ // tracked. We need to save a copy of this collection so that we can add the new classes
472
+ // below.
473
+ elements = $( currentElements.get() );
474
+ this._removeClass( currentElements, classKey );
475
+
476
+ // We don't use _addClass() here, because that uses this.options.classes
477
+ // for generating the string of classes. We want to use the value passed in from
478
+ // _setOption(), this is the new value of the classes option which was passed to
479
+ // _setOption(). We pass this value directly to _classes().
480
+ elements.addClass( this._classes( {
481
+ element: elements,
482
+ keys: classKey,
483
+ classes: value,
484
+ add: true
485
+ } ) );
486
+ }
487
+ },
488
+
489
+ _setOptionDisabled: function( value ) {
490
+ this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
491
+
492
+ // If the widget is becoming disabled, then nothing is interactive
493
+ if ( value ) {
494
+ this._removeClass( this.hoverable, null, "ui-state-hover" );
495
+ this._removeClass( this.focusable, null, "ui-state-focus" );
496
+ }
497
+ },
498
+
499
+ enable: function() {
500
+ return this._setOptions( { disabled: false } );
501
+ },
502
+
503
+ disable: function() {
504
+ return this._setOptions( { disabled: true } );
505
+ },
506
+
507
+ _classes: function( options ) {
508
+ var full = [];
509
+ var that = this;
510
+
511
+ options = $.extend( {
512
+ element: this.element,
513
+ classes: this.options.classes || {}
514
+ }, options );
515
+
516
+ function processClassString( classes, checkOption ) {
517
+ var current, i;
518
+ for ( i = 0; i < classes.length; i++ ) {
519
+ current = that.classesElementLookup[ classes[ i ] ] || $();
520
+ if ( options.add ) {
521
+ current = $( $.unique( current.get().concat( options.element.get() ) ) );
522
+ } else {
523
+ current = $( current.not( options.element ).get() );
524
+ }
525
+ that.classesElementLookup[ classes[ i ] ] = current;
526
+ full.push( classes[ i ] );
527
+ if ( checkOption && options.classes[ classes[ i ] ] ) {
528
+ full.push( options.classes[ classes[ i ] ] );
529
+ }
530
+ }
531
+ }
532
+
533
+ this._on( options.element, {
534
+ "remove": "_untrackClassesElement"
535
+ } );
536
+
537
+ if ( options.keys ) {
538
+ processClassString( options.keys.match( /\S+/g ) || [], true );
539
+ }
540
+ if ( options.extra ) {
541
+ processClassString( options.extra.match( /\S+/g ) || [] );
542
+ }
543
+
544
+ return full.join( " " );
545
+ },
546
+
547
+ _untrackClassesElement: function( event ) {
548
+ var that = this;
549
+ $.each( that.classesElementLookup, function( key, value ) {
550
+ if ( $.inArray( event.target, value ) !== -1 ) {
551
+ that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
552
+ }
553
+ } );
554
+ },
555
+
556
+ _removeClass: function( element, keys, extra ) {
557
+ return this._toggleClass( element, keys, extra, false );
558
+ },
559
+
560
+ _addClass: function( element, keys, extra ) {
561
+ return this._toggleClass( element, keys, extra, true );
562
+ },
563
+
564
+ _toggleClass: function( element, keys, extra, add ) {
565
+ add = ( typeof add === "boolean" ) ? add : extra;
566
+ var shift = ( typeof element === "string" || element === null ),
567
+ options = {
568
+ extra: shift ? keys : extra,
569
+ keys: shift ? element : keys,
570
+ element: shift ? this.element : element,
571
+ add: add
572
+ };
573
+ options.element.toggleClass( this._classes( options ), add );
574
+ return this;
575
+ },
576
+
577
+ _on: function( suppressDisabledCheck, element, handlers ) {
578
+ var delegateElement;
579
+ var instance = this;
580
+
581
+ // No suppressDisabledCheck flag, shuffle arguments
582
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
583
+ handlers = element;
584
+ element = suppressDisabledCheck;
585
+ suppressDisabledCheck = false;
586
+ }
587
+
588
+ // No element argument, shuffle and use this.element
589
+ if ( !handlers ) {
590
+ handlers = element;
591
+ element = this.element;
592
+ delegateElement = this.widget();
593
+ } else {
594
+ element = delegateElement = $( element );
595
+ this.bindings = this.bindings.add( element );
596
+ }
597
+
598
+ $.each( handlers, function( event, handler ) {
599
+ function handlerProxy() {
600
+
601
+ // Allow widgets to customize the disabled handling
602
+ // - disabled as an array instead of boolean
603
+ // - disabled class as method for disabling individual parts
604
+ if ( !suppressDisabledCheck &&
605
+ ( instance.options.disabled === true ||
606
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
607
+ return;
608
+ }
609
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
610
+ .apply( instance, arguments );
611
+ }
612
+
613
+ // Copy the guid so direct unbinding works
614
+ if ( typeof handler !== "string" ) {
615
+ handlerProxy.guid = handler.guid =
616
+ handler.guid || handlerProxy.guid || $.guid++;
617
+ }
618
+
619
+ var match = event.match( /^([\w:-]*)\s*(.*)$/ );
620
+ var eventName = match[ 1 ] + instance.eventNamespace;
621
+ var selector = match[ 2 ];
622
+
623
+ if ( selector ) {
624
+ delegateElement.on( eventName, selector, handlerProxy );
625
+ } else {
626
+ element.on( eventName, handlerProxy );
627
+ }
628
+ } );
629
+ },
630
+
631
+ _off: function( element, eventName ) {
632
+ eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
633
+ this.eventNamespace;
634
+ element.off( eventName ).off( eventName );
635
+
636
+ // Clear the stack to avoid memory leaks (#10056)
637
+ this.bindings = $( this.bindings.not( element ).get() );
638
+ this.focusable = $( this.focusable.not( element ).get() );
639
+ this.hoverable = $( this.hoverable.not( element ).get() );
640
+ },
641
+
642
+ _delay: function( handler, delay ) {
643
+ function handlerProxy() {
644
+ return ( typeof handler === "string" ? instance[ handler ] : handler )
645
+ .apply( instance, arguments );
646
+ }
647
+ var instance = this;
648
+ return setTimeout( handlerProxy, delay || 0 );
649
+ },
650
+
651
+ _hoverable: function( element ) {
652
+ this.hoverable = this.hoverable.add( element );
653
+ this._on( element, {
654
+ mouseenter: function( event ) {
655
+ this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
656
+ },
657
+ mouseleave: function( event ) {
658
+ this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
659
+ }
660
+ } );
661
+ },
662
+
663
+ _focusable: function( element ) {
664
+ this.focusable = this.focusable.add( element );
665
+ this._on( element, {
666
+ focusin: function( event ) {
667
+ this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
668
+ },
669
+ focusout: function( event ) {
670
+ this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
671
+ }
672
+ } );
673
+ },
674
+
675
+ _trigger: function( type, event, data ) {
676
+ var prop, orig;
677
+ var callback = this.options[ type ];
678
+
679
+ data = data || {};
680
+ event = $.Event( event );
681
+ event.type = ( type === this.widgetEventPrefix ?
682
+ type :
683
+ this.widgetEventPrefix + type ).toLowerCase();
684
+
685
+ // The original event may come from any element
686
+ // so we need to reset the target on the new event
687
+ event.target = this.element[ 0 ];
688
+
689
+ // Copy original event properties over to the new event
690
+ orig = event.originalEvent;
691
+ if ( orig ) {
692
+ for ( prop in orig ) {
693
+ if ( !( prop in event ) ) {
694
+ event[ prop ] = orig[ prop ];
695
+ }
696
+ }
697
+ }
698
+
699
+ this.element.trigger( event, data );
700
+ return !( $.isFunction( callback ) &&
701
+ callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
702
+ event.isDefaultPrevented() );
703
+ }
704
+ };
705
+
706
+ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
707
+ $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
708
+ if ( typeof options === "string" ) {
709
+ options = { effect: options };
710
+ }
711
+
712
+ var hasOptions;
713
+ var effectName = !options ?
714
+ method :
715
+ options === true || typeof options === "number" ?
716
+ defaultEffect :
717
+ options.effect || defaultEffect;
718
+
719
+ options = options || {};
720
+ if ( typeof options === "number" ) {
721
+ options = { duration: options };
722
+ }
723
+
724
+ hasOptions = !$.isEmptyObject( options );
725
+ options.complete = callback;
726
+
727
+ if ( options.delay ) {
728
+ element.delay( options.delay );
729
+ }
730
+
731
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
732
+ element[ method ]( options );
733
+ } else if ( effectName !== method && element[ effectName ] ) {
734
+ element[ effectName ]( options.duration, options.easing, callback );
735
+ } else {
736
+ element.queue( function( next ) {
737
+ $( this )[ method ]();
738
+ if ( callback ) {
739
+ callback.call( element[ 0 ] );
740
+ }
741
+ next();
742
+ } );
743
+ }
744
+ };
745
+ } );
746
+
747
+ var widget = $.widget;
18
748
 
19
- // Browser globals
20
- factory( jQuery );
21
- }
22
- }(function( $ ) {
23
- /*!
24
- * jQuery UI Widget 1.11.4
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
- * http://api.jqueryui.com/jQuery.widget/
32
- */
33
-
34
-
35
- var widget_uuid = 0,
36
- widget_slice = Array.prototype.slice;
37
-
38
- $.cleanData = (function( orig ) {
39
- return function( elems ) {
40
- var events, elem, i;
41
- for ( i = 0; (elem = elems[i]) != null; i++ ) {
42
- try {
43
-
44
- // Only trigger remove when necessary to save time
45
- events = $._data( elem, "events" );
46
- if ( events && events.remove ) {
47
- $( elem ).triggerHandler( "remove" );
48
- }
49
-
50
- // http://bugs.jquery.com/ticket/8235
51
- } catch ( e ) {}
52
- }
53
- orig( elems );
54
- };
55
- })( $.cleanData );
56
-
57
- $.widget = function( name, base, prototype ) {
58
- var fullName, existingConstructor, constructor, basePrototype,
59
- // proxiedPrototype allows the provided prototype to remain unmodified
60
- // so that it can be used as a mixin for multiple widgets (#8876)
61
- proxiedPrototype = {},
62
- namespace = name.split( "." )[ 0 ];
63
-
64
- name = name.split( "." )[ 1 ];
65
- fullName = namespace + "-" + name;
66
-
67
- if ( !prototype ) {
68
- prototype = base;
69
- base = $.Widget;
70
- }
71
-
72
- // create selector for plugin
73
- $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
74
- return !!$.data( elem, fullName );
75
- };
76
-
77
- $[ namespace ] = $[ namespace ] || {};
78
- existingConstructor = $[ namespace ][ name ];
79
- constructor = $[ namespace ][ name ] = function( options, element ) {
80
- // allow instantiation without "new" keyword
81
- if ( !this._createWidget ) {
82
- return new constructor( options, element );
83
- }
84
-
85
- // allow instantiation without initializing for simple inheritance
86
- // must use "new" keyword (the code above always passes args)
87
- if ( arguments.length ) {
88
- this._createWidget( options, element );
89
- }
90
- };
91
- // extend with the existing constructor to carry over any static properties
92
- $.extend( constructor, existingConstructor, {
93
- version: prototype.version,
94
- // copy the object used to create the prototype in case we need to
95
- // redefine the widget later
96
- _proto: $.extend( {}, prototype ),
97
- // track widgets that inherit from this widget in case this widget is
98
- // redefined after a widget inherits from it
99
- _childConstructors: []
100
- });
101
-
102
- basePrototype = new base();
103
- // we need to make the options hash a property directly on the new instance
104
- // otherwise we'll modify the options hash on the prototype that we're
105
- // inheriting from
106
- basePrototype.options = $.widget.extend( {}, basePrototype.options );
107
- $.each( prototype, function( prop, value ) {
108
- if ( !$.isFunction( value ) ) {
109
- proxiedPrototype[ prop ] = value;
110
- return;
111
- }
112
- proxiedPrototype[ prop ] = (function() {
113
- var _super = function() {
114
- return base.prototype[ prop ].apply( this, arguments );
115
- },
116
- _superApply = function( args ) {
117
- return base.prototype[ prop ].apply( this, args );
118
- };
119
- return function() {
120
- var __super = this._super,
121
- __superApply = this._superApply,
122
- returnValue;
123
-
124
- this._super = _super;
125
- this._superApply = _superApply;
126
-
127
- returnValue = value.apply( this, arguments );
128
-
129
- this._super = __super;
130
- this._superApply = __superApply;
131
-
132
- return returnValue;
133
- };
134
- })();
135
- });
136
- constructor.prototype = $.widget.extend( basePrototype, {
137
- // TODO: remove support for widgetEventPrefix
138
- // always use the name + a colon as the prefix, e.g., draggable:start
139
- // don't prefix for widgets that aren't DOM-based
140
- widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
141
- }, proxiedPrototype, {
142
- constructor: constructor,
143
- namespace: namespace,
144
- widgetName: name,
145
- widgetFullName: fullName
146
- });
147
-
148
- // If this widget is being redefined then we need to find all widgets that
149
- // are inheriting from it and redefine all of them so that they inherit from
150
- // the new version of this widget. We're essentially trying to replace one
151
- // level in the prototype chain.
152
- if ( existingConstructor ) {
153
- $.each( existingConstructor._childConstructors, function( i, child ) {
154
- var childPrototype = child.prototype;
155
-
156
- // redefine the child widget using the same prototype that was
157
- // originally used, but inherit from the new version of the base
158
- $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
159
- });
160
- // remove the list of existing child constructors from the old constructor
161
- // so the old child constructors can be garbage collected
162
- delete existingConstructor._childConstructors;
163
- } else {
164
- base._childConstructors.push( constructor );
165
- }
166
-
167
- $.widget.bridge( name, constructor );
168
-
169
- return constructor;
170
- };
171
-
172
- $.widget.extend = function( target ) {
173
- var input = widget_slice.call( arguments, 1 ),
174
- inputIndex = 0,
175
- inputLength = input.length,
176
- key,
177
- value;
178
- for ( ; inputIndex < inputLength; inputIndex++ ) {
179
- for ( key in input[ inputIndex ] ) {
180
- value = input[ inputIndex ][ key ];
181
- if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
182
- // Clone objects
183
- if ( $.isPlainObject( value ) ) {
184
- target[ key ] = $.isPlainObject( target[ key ] ) ?
185
- $.widget.extend( {}, target[ key ], value ) :
186
- // Don't extend strings, arrays, etc. with objects
187
- $.widget.extend( {}, value );
188
- // Copy everything else by reference
189
- } else {
190
- target[ key ] = value;
191
- }
192
- }
193
- }
194
- }
195
- return target;
196
- };
197
-
198
- $.widget.bridge = function( name, object ) {
199
- var fullName = object.prototype.widgetFullName || name;
200
- $.fn[ name ] = function( options ) {
201
- var isMethodCall = typeof options === "string",
202
- args = widget_slice.call( arguments, 1 ),
203
- returnValue = this;
204
-
205
- if ( isMethodCall ) {
206
- this.each(function() {
207
- var methodValue,
208
- instance = $.data( this, fullName );
209
- if ( options === "instance" ) {
210
- returnValue = instance;
211
- return false;
212
- }
213
- if ( !instance ) {
214
- return $.error( "cannot call methods on " + name + " prior to initialization; " +
215
- "attempted to call method '" + options + "'" );
216
- }
217
- if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
218
- return $.error( "no such method '" + options + "' for " + name + " widget instance" );
219
- }
220
- methodValue = instance[ options ].apply( instance, args );
221
- if ( methodValue !== instance && methodValue !== undefined ) {
222
- returnValue = methodValue && methodValue.jquery ?
223
- returnValue.pushStack( methodValue.get() ) :
224
- methodValue;
225
- return false;
226
- }
227
- });
228
- } else {
229
-
230
- // Allow multiple hashes to be passed on init
231
- if ( args.length ) {
232
- options = $.widget.extend.apply( null, [ options ].concat(args) );
233
- }
234
-
235
- this.each(function() {
236
- var instance = $.data( this, fullName );
237
- if ( instance ) {
238
- instance.option( options || {} );
239
- if ( instance._init ) {
240
- instance._init();
241
- }
242
- } else {
243
- $.data( this, fullName, new object( options, this ) );
244
- }
245
- });
246
- }
247
-
248
- return returnValue;
249
- };
250
- };
251
-
252
- $.Widget = function( /* options, element */ ) {};
253
- $.Widget._childConstructors = [];
254
-
255
- $.Widget.prototype = {
256
- widgetName: "widget",
257
- widgetEventPrefix: "",
258
- defaultElement: "<div>",
259
- options: {
260
- disabled: false,
261
-
262
- // callbacks
263
- create: null
264
- },
265
- _createWidget: function( options, element ) {
266
- element = $( element || this.defaultElement || this )[ 0 ];
267
- this.element = $( element );
268
- this.uuid = widget_uuid++;
269
- this.eventNamespace = "." + this.widgetName + this.uuid;
270
-
271
- this.bindings = $();
272
- this.hoverable = $();
273
- this.focusable = $();
274
-
275
- if ( element !== this ) {
276
- $.data( element, this.widgetFullName, this );
277
- this._on( true, this.element, {
278
- remove: function( event ) {
279
- if ( event.target === element ) {
280
- this.destroy();
281
- }
282
- }
283
- });
284
- this.document = $( element.style ?
285
- // element within the document
286
- element.ownerDocument :
287
- // element is window or document
288
- element.document || element );
289
- this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
290
- }
291
-
292
- this.options = $.widget.extend( {},
293
- this.options,
294
- this._getCreateOptions(),
295
- options );
296
-
297
- this._create();
298
- this._trigger( "create", null, this._getCreateEventData() );
299
- this._init();
300
- },
301
- _getCreateOptions: $.noop,
302
- _getCreateEventData: $.noop,
303
- _create: $.noop,
304
- _init: $.noop,
305
-
306
- destroy: function() {
307
- this._destroy();
308
- // we can probably remove the unbind calls in 2.0
309
- // all event bindings should go through this._on()
310
- this.element
311
- .unbind( this.eventNamespace )
312
- .removeData( this.widgetFullName )
313
- // support: jquery <1.6.3
314
- // http://bugs.jquery.com/ticket/9413
315
- .removeData( $.camelCase( this.widgetFullName ) );
316
- this.widget()
317
- .unbind( this.eventNamespace )
318
- .removeAttr( "aria-disabled" )
319
- .removeClass(
320
- this.widgetFullName + "-disabled " +
321
- "ui-state-disabled" );
322
-
323
- // clean up events and states
324
- this.bindings.unbind( this.eventNamespace );
325
- this.hoverable.removeClass( "ui-state-hover" );
326
- this.focusable.removeClass( "ui-state-focus" );
327
- },
328
- _destroy: $.noop,
329
-
330
- widget: function() {
331
- return this.element;
332
- },
333
-
334
- option: function( key, value ) {
335
- var options = key,
336
- parts,
337
- curOption,
338
- i;
339
-
340
- if ( arguments.length === 0 ) {
341
- // don't return a reference to the internal hash
342
- return $.widget.extend( {}, this.options );
343
- }
344
-
345
- if ( typeof key === "string" ) {
346
- // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
347
- options = {};
348
- parts = key.split( "." );
349
- key = parts.shift();
350
- if ( parts.length ) {
351
- curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
352
- for ( i = 0; i < parts.length - 1; i++ ) {
353
- curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
354
- curOption = curOption[ parts[ i ] ];
355
- }
356
- key = parts.pop();
357
- if ( arguments.length === 1 ) {
358
- return curOption[ key ] === undefined ? null : curOption[ key ];
359
- }
360
- curOption[ key ] = value;
361
- } else {
362
- if ( arguments.length === 1 ) {
363
- return this.options[ key ] === undefined ? null : this.options[ key ];
364
- }
365
- options[ key ] = value;
366
- }
367
- }
368
-
369
- this._setOptions( options );
370
-
371
- return this;
372
- },
373
- _setOptions: function( options ) {
374
- var key;
375
-
376
- for ( key in options ) {
377
- this._setOption( key, options[ key ] );
378
- }
379
-
380
- return this;
381
- },
382
- _setOption: function( key, value ) {
383
- this.options[ key ] = value;
384
-
385
- if ( key === "disabled" ) {
386
- this.widget()
387
- .toggleClass( this.widgetFullName + "-disabled", !!value );
388
-
389
- // If the widget is becoming disabled, then nothing is interactive
390
- if ( value ) {
391
- this.hoverable.removeClass( "ui-state-hover" );
392
- this.focusable.removeClass( "ui-state-focus" );
393
- }
394
- }
395
-
396
- return this;
397
- },
398
-
399
- enable: function() {
400
- return this._setOptions({ disabled: false });
401
- },
402
- disable: function() {
403
- return this._setOptions({ disabled: true });
404
- },
405
-
406
- _on: function( suppressDisabledCheck, element, handlers ) {
407
- var delegateElement,
408
- instance = this;
409
-
410
- // no suppressDisabledCheck flag, shuffle arguments
411
- if ( typeof suppressDisabledCheck !== "boolean" ) {
412
- handlers = element;
413
- element = suppressDisabledCheck;
414
- suppressDisabledCheck = false;
415
- }
416
-
417
- // no element argument, shuffle and use this.element
418
- if ( !handlers ) {
419
- handlers = element;
420
- element = this.element;
421
- delegateElement = this.widget();
422
- } else {
423
- element = delegateElement = $( element );
424
- this.bindings = this.bindings.add( element );
425
- }
426
-
427
- $.each( handlers, function( event, handler ) {
428
- function handlerProxy() {
429
- // allow widgets to customize the disabled handling
430
- // - disabled as an array instead of boolean
431
- // - disabled class as method for disabling individual parts
432
- if ( !suppressDisabledCheck &&
433
- ( instance.options.disabled === true ||
434
- $( this ).hasClass( "ui-state-disabled" ) ) ) {
435
- return;
436
- }
437
- return ( typeof handler === "string" ? instance[ handler ] : handler )
438
- .apply( instance, arguments );
439
- }
440
-
441
- // copy the guid so direct unbinding works
442
- if ( typeof handler !== "string" ) {
443
- handlerProxy.guid = handler.guid =
444
- handler.guid || handlerProxy.guid || $.guid++;
445
- }
446
-
447
- var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
448
- eventName = match[1] + instance.eventNamespace,
449
- selector = match[2];
450
- if ( selector ) {
451
- delegateElement.delegate( selector, eventName, handlerProxy );
452
- } else {
453
- element.bind( eventName, handlerProxy );
454
- }
455
- });
456
- },
457
-
458
- _off: function( element, eventName ) {
459
- eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
460
- this.eventNamespace;
461
- element.unbind( eventName ).undelegate( eventName );
462
-
463
- // Clear the stack to avoid memory leaks (#10056)
464
- this.bindings = $( this.bindings.not( element ).get() );
465
- this.focusable = $( this.focusable.not( element ).get() );
466
- this.hoverable = $( this.hoverable.not( element ).get() );
467
- },
468
-
469
- _delay: function( handler, delay ) {
470
- function handlerProxy() {
471
- return ( typeof handler === "string" ? instance[ handler ] : handler )
472
- .apply( instance, arguments );
473
- }
474
- var instance = this;
475
- return setTimeout( handlerProxy, delay || 0 );
476
- },
477
-
478
- _hoverable: function( element ) {
479
- this.hoverable = this.hoverable.add( element );
480
- this._on( element, {
481
- mouseenter: function( event ) {
482
- $( event.currentTarget ).addClass( "ui-state-hover" );
483
- },
484
- mouseleave: function( event ) {
485
- $( event.currentTarget ).removeClass( "ui-state-hover" );
486
- }
487
- });
488
- },
489
-
490
- _focusable: function( element ) {
491
- this.focusable = this.focusable.add( element );
492
- this._on( element, {
493
- focusin: function( event ) {
494
- $( event.currentTarget ).addClass( "ui-state-focus" );
495
- },
496
- focusout: function( event ) {
497
- $( event.currentTarget ).removeClass( "ui-state-focus" );
498
- }
499
- });
500
- },
501
-
502
- _trigger: function( type, event, data ) {
503
- var prop, orig,
504
- callback = this.options[ type ];
505
-
506
- data = data || {};
507
- event = $.Event( event );
508
- event.type = ( type === this.widgetEventPrefix ?
509
- type :
510
- this.widgetEventPrefix + type ).toLowerCase();
511
- // the original event may come from any element
512
- // so we need to reset the target on the new event
513
- event.target = this.element[ 0 ];
514
-
515
- // copy original event properties over to the new event
516
- orig = event.originalEvent;
517
- if ( orig ) {
518
- for ( prop in orig ) {
519
- if ( !( prop in event ) ) {
520
- event[ prop ] = orig[ prop ];
521
- }
522
- }
523
- }
524
-
525
- this.element.trigger( event, data );
526
- return !( $.isFunction( callback ) &&
527
- callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
528
- event.isDefaultPrevented() );
529
- }
530
- };
531
-
532
- $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
533
- $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
534
- if ( typeof options === "string" ) {
535
- options = { effect: options };
536
- }
537
- var hasOptions,
538
- effectName = !options ?
539
- method :
540
- options === true || typeof options === "number" ?
541
- defaultEffect :
542
- options.effect || defaultEffect;
543
- options = options || {};
544
- if ( typeof options === "number" ) {
545
- options = { duration: options };
546
- }
547
- hasOptions = !$.isEmptyObject( options );
548
- options.complete = callback;
549
- if ( options.delay ) {
550
- element.delay( options.delay );
551
- }
552
- if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
553
- element[ method ]( options );
554
- } else if ( effectName !== method && element[ effectName ] ) {
555
- element[ effectName ]( options.duration, options.easing, callback );
556
- } else {
557
- element.queue(function( next ) {
558
- $( this )[ method ]();
559
- if ( callback ) {
560
- callback.call( element[ 0 ] );
561
- }
562
- next();
563
- });
564
- }
565
- };
566
- });
567
-
568
- var widget = $.widget;
569
749
 
570
750
 
571
751