card-mod-script 0.13.3 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/components.js.coffee +3 -0
  3. data/assets/script/decko/decko.js.coffee +0 -15
  4. data/assets/script/decko/editor.js.coffee +3 -1
  5. data/assets/script/decko/filter.js.coffee +13 -6
  6. data/assets/script/decko/mod.js.coffee +2 -8
  7. data/assets/script/{script_pointer_config.js.coffee → decko/pointer_config.js.coffee} +1 -2
  8. data/assets/script/{script_pointer_list_editor.js.coffee → decko/pointer_list_editor.js.coffee} +0 -0
  9. data/assets/script/decko/slot.js.coffee +2 -2
  10. data/assets/script/decko/slot_ready.js.coffee +1 -0
  11. data/assets/script/decko/slotter.js.coffee +23 -31
  12. data/assets/script/decko/type_editor.js.coffee +21 -0
  13. data/assets/script/decko/upload.js.coffee +12 -5
  14. data/assets/script/manifest.yml +15 -2
  15. data/set/abstract/00_script.rb +30 -31
  16. data/set/abstract/01_asset_script.rb +0 -16
  17. data/set/abstract/{script_asset_list.rb → script_group.rb} +12 -13
  18. data/set/all/head_javascript.rb +4 -5
  19. data/set/right/script.rb +1 -14
  20. data/set/type/local_script_folder_group.rb +2 -2
  21. data/set/type/local_script_manifest_group.rb +1 -1
  22. data/set/type_plus_right/mod/script.rb +56 -0
  23. data/set/type_plus_right/set/script.rb +7 -0
  24. data/vendor/jquery_file_upload/LICENSE.txt +11 -12
  25. data/vendor/jquery_file_upload/README.md +189 -72
  26. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  27. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  28. data/vendor/jquery_file_upload/cors/postmessage.html +68 -58
  29. data/vendor/jquery_file_upload/cors/result.html +12 -10
  30. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +24 -13
  31. data/vendor/jquery_file_upload/css/jquery.fileupload.css +3 -4
  32. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  33. data/vendor/jquery_file_upload/index.html +332 -230
  34. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +109 -109
  35. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +81 -73
  36. data/vendor/jquery_file_upload/js/demo.js +75 -0
  37. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +82 -94
  38. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +321 -300
  39. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +138 -146
  40. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +737 -692
  41. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +91 -97
  42. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +82 -94
  43. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1569 -1451
  44. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +208 -205
  45. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +397 -340
  46. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  47. data/vendor/jquery_file_upload/package.json +71 -10
  48. data/vendor/jquery_file_upload/server/gae-python/app.yaml +11 -10
  49. data/vendor/jquery_file_upload/server/php/Dockerfile +23 -17
  50. data/vendor/jquery_file_upload/server/php/UploadHandler.php +206 -137
  51. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  52. data/vendor/jquery_file_upload/test/index.html +36 -159
  53. data/vendor/jquery_file_upload/test/unit.js +989 -0
  54. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  55. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  56. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  57. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  58. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  59. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  60. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  61. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  62. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  63. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  64. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  65. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  66. metadata +34 -52
  67. data/file/mod_script_script_decko_machine_output/file.js +0 -2685
  68. data/file/mod_script_script_jquery_machine_output/file.js +0 -12924
  69. data/lib/javascript/script_html5shiv_printshiv.js +0 -1
  70. data/set/self/script_html5shiv_printshiv.rb +0 -11
  71. data/set/self/script_mods.rb +0 -1
  72. data/set/type/mod_script_assets.rb +0 -21
  73. data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
  74. data/vendor/jquery_file_upload/angularjs.html +0 -211
  75. data/vendor/jquery_file_upload/basic-plus.html +0 -226
  76. data/vendor/jquery_file_upload/basic.html +0 -136
  77. data/vendor/jquery_file_upload/bower-version-update.js +0 -16
  78. data/vendor/jquery_file_upload/bower.json +0 -64
  79. data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
  80. data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
  81. data/vendor/jquery_file_upload/css/style.css +0 -15
  82. data/vendor/jquery_file_upload/jquery-ui.html +0 -252
  83. data/vendor/jquery_file_upload/js/app.js +0 -101
  84. data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
  85. data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
  86. data/vendor/jquery_file_upload/js/main.js +0 -75
  87. data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
  88. data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
  89. data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
  90. data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +0 -2
  91. data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
  92. data/vendor/jquery_file_upload/test/test.js +0 -1292
@@ -1,24 +1,29 @@
1
- /*! jQuery UI - v1.12.1 - 2018-02-10
1
+ /*! jQuery UI - v1.12.1+0b7246b6eeadfa9e2696e22f3230f6452f8129dc - 2020-02-20
2
2
  * http://jqueryui.com
3
3
  * Includes: widget.js
4
4
  * Copyright jQuery Foundation and other contributors; Licensed MIT */
5
5
 
6
- (function( factory ) {
7
- if ( typeof define === "function" && define.amd ) {
6
+ /* global define, require */
7
+ /* eslint-disable no-param-reassign, new-cap, jsdoc/require-jsdoc */
8
8
 
9
+ (function (factory) {
10
+ 'use strict';
11
+ if (typeof define === 'function' && define.amd) {
9
12
  // AMD. Register as an anonymous module.
10
- define([ "jquery" ], factory );
13
+ define(['jquery'], factory);
14
+ } else if (typeof exports === 'object') {
15
+ // Node/CommonJS
16
+ factory(require('jquery'));
11
17
  } else {
12
-
13
18
  // Browser globals
14
- factory( jQuery );
19
+ factory(window.jQuery);
15
20
  }
16
- }(function( $ ) {
21
+ })(function ($) {
22
+ ('use strict');
17
23
 
18
24
  $.ui = $.ui || {};
19
25
 
20
- var version = $.ui.version = "1.12.1";
21
-
26
+ $.ui.version = '1.12.1';
22
27
 
23
28
  /*!
24
29
  * jQuery UI Widget 1.12.1
@@ -35,105 +40,111 @@
35
40
  //>>docs: http://api.jqueryui.com/jQuery.widget/
36
41
  //>>demos: http://jqueryui.com/widget/
37
42
 
43
+ // Support: jQuery 1.9.x or older
44
+ // $.expr[ ":" ] is deprecated.
45
+ if (!$.expr.pseudos) {
46
+ $.expr.pseudos = $.expr[':'];
47
+ }
38
48
 
49
+ // Support: jQuery 1.11.x or older
50
+ // $.unique has been renamed to $.uniqueSort
51
+ if (!$.uniqueSort) {
52
+ $.uniqueSort = $.unique;
53
+ }
39
54
 
40
55
  var widgetUuid = 0;
56
+ var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
41
57
  var widgetSlice = Array.prototype.slice;
42
58
 
43
- $.cleanData = ( function( orig ) {
44
- return function( elems ) {
59
+ $.cleanData = (function (orig) {
60
+ return function (elems) {
45
61
  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 ) {}
62
+ // eslint-disable-next-line eqeqeq
63
+ for (i = 0; (elem = elems[i]) != null; i++) {
64
+ // Only trigger remove when necessary to save time
65
+ events = $._data(elem, 'events');
66
+ if (events && events.remove) {
67
+ $(elem).triggerHandler('remove');
68
+ }
57
69
  }
58
- orig( elems );
70
+ orig(elems);
59
71
  };
60
- } )( $.cleanData );
72
+ })($.cleanData);
61
73
 
62
- $.widget = function( name, base, prototype ) {
74
+ $.widget = function (name, base, prototype) {
63
75
  var existingConstructor, constructor, basePrototype;
64
76
 
65
77
  // ProxiedPrototype allows the provided prototype to remain unmodified
66
78
  // so that it can be used as a mixin for multiple widgets (#8876)
67
79
  var proxiedPrototype = {};
68
80
 
69
- var namespace = name.split( "." )[ 0 ];
70
- name = name.split( "." )[ 1 ];
71
- var fullName = namespace + "-" + name;
81
+ var namespace = name.split('.')[0];
82
+ name = name.split('.')[1];
83
+ var fullName = namespace + '-' + name;
72
84
 
73
- if ( !prototype ) {
85
+ if (!prototype) {
74
86
  prototype = base;
75
87
  base = $.Widget;
76
88
  }
77
89
 
78
- if ( $.isArray( prototype ) ) {
79
- prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
90
+ if ($.isArray(prototype)) {
91
+ prototype = $.extend.apply(null, [{}].concat(prototype));
80
92
  }
81
93
 
82
94
  // Create selector for plugin
83
- $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
84
- return !!$.data( elem, fullName );
95
+ $.expr.pseudos[fullName.toLowerCase()] = function (elem) {
96
+ return !!$.data(elem, fullName);
85
97
  };
86
98
 
87
- $[ namespace ] = $[ namespace ] || {};
88
- existingConstructor = $[ namespace ][ name ];
89
- constructor = $[ namespace ][ name ] = function( options, element ) {
90
-
99
+ $[namespace] = $[namespace] || {};
100
+ existingConstructor = $[namespace][name];
101
+ constructor = $[namespace][name] = function (options, element) {
91
102
  // Allow instantiation without "new" keyword
92
- if ( !this._createWidget ) {
93
- return new constructor( options, element );
103
+ if (!this._createWidget) {
104
+ return new constructor(options, element);
94
105
  }
95
106
 
96
107
  // Allow instantiation without initializing for simple inheritance
97
108
  // must use "new" keyword (the code above always passes args)
98
- if ( arguments.length ) {
99
- this._createWidget( options, element );
109
+ if (arguments.length) {
110
+ this._createWidget(options, element);
100
111
  }
101
112
  };
102
113
 
103
114
  // Extend with the existing constructor to carry over any static properties
104
- $.extend( constructor, existingConstructor, {
115
+ $.extend(constructor, existingConstructor, {
105
116
  version: prototype.version,
106
117
 
107
118
  // Copy the object used to create the prototype in case we need to
108
119
  // redefine the widget later
109
- _proto: $.extend( {}, prototype ),
120
+ _proto: $.extend({}, prototype),
110
121
 
111
122
  // Track widgets that inherit from this widget in case this widget is
112
123
  // redefined after a widget inherits from it
113
124
  _childConstructors: []
114
- } );
125
+ });
115
126
 
116
127
  basePrototype = new base();
117
128
 
118
129
  // We need to make the options hash a property directly on the new instance
119
130
  // otherwise we'll modify the options hash on the prototype that we're
120
131
  // inheriting from
121
- basePrototype.options = $.widget.extend( {}, basePrototype.options );
122
- $.each( prototype, function( prop, value ) {
123
- if ( !$.isFunction( value ) ) {
124
- proxiedPrototype[ prop ] = value;
132
+ basePrototype.options = $.widget.extend({}, basePrototype.options);
133
+ $.each(prototype, function (prop, value) {
134
+ if (!$.isFunction(value)) {
135
+ proxiedPrototype[prop] = value;
125
136
  return;
126
137
  }
127
- proxiedPrototype[ prop ] = ( function() {
138
+ proxiedPrototype[prop] = (function () {
128
139
  function _super() {
129
- return base.prototype[ prop ].apply( this, arguments );
140
+ return base.prototype[prop].apply(this, arguments);
130
141
  }
131
142
 
132
- function _superApply( args ) {
133
- return base.prototype[ prop ].apply( this, args );
143
+ function _superApply(args) {
144
+ return base.prototype[prop].apply(this, args);
134
145
  }
135
146
 
136
- return function() {
147
+ return function () {
137
148
  var __super = this._super;
138
149
  var __superApply = this._superApply;
139
150
  var returnValue;
@@ -141,77 +152,87 @@
141
152
  this._super = _super;
142
153
  this._superApply = _superApply;
143
154
 
144
- returnValue = value.apply( this, arguments );
155
+ returnValue = value.apply(this, arguments);
145
156
 
146
157
  this._super = __super;
147
158
  this._superApply = __superApply;
148
159
 
149
160
  return returnValue;
150
161
  };
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
- } );
162
+ })();
163
+ });
164
+ constructor.prototype = $.widget.extend(
165
+ basePrototype,
166
+ {
167
+ // TODO: remove support for widgetEventPrefix
168
+ // always use the name + a colon as the prefix, e.g., draggable:start
169
+ // don't prefix for widgets that aren't DOM-based
170
+ widgetEventPrefix: existingConstructor
171
+ ? basePrototype.widgetEventPrefix || name
172
+ : name
173
+ },
174
+ proxiedPrototype,
175
+ {
176
+ constructor: constructor,
177
+ namespace: namespace,
178
+ widgetName: name,
179
+ widgetFullName: fullName
180
+ }
181
+ );
165
182
 
166
183
  // If this widget is being redefined then we need to find all widgets that
167
184
  // are inheriting from it and redefine all of them so that they inherit from
168
185
  // the new version of this widget. We're essentially trying to replace one
169
186
  // level in the prototype chain.
170
- if ( existingConstructor ) {
171
- $.each( existingConstructor._childConstructors, function( i, child ) {
187
+ if (existingConstructor) {
188
+ $.each(existingConstructor._childConstructors, function (i, child) {
172
189
  var childPrototype = child.prototype;
173
190
 
174
191
  // Redefine the child widget using the same prototype that was
175
192
  // originally used, but inherit from the new version of the base
176
- $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
177
- child._proto );
178
- } );
193
+ $.widget(
194
+ childPrototype.namespace + '.' + childPrototype.widgetName,
195
+ constructor,
196
+ child._proto
197
+ );
198
+ });
179
199
 
180
200
  // Remove the list of existing child constructors from the old constructor
181
201
  // so the old child constructors can be garbage collected
182
202
  delete existingConstructor._childConstructors;
183
203
  } else {
184
- base._childConstructors.push( constructor );
204
+ base._childConstructors.push(constructor);
185
205
  }
186
206
 
187
- $.widget.bridge( name, constructor );
207
+ $.widget.bridge(name, constructor);
188
208
 
189
209
  return constructor;
190
210
  };
191
211
 
192
- $.widget.extend = function( target ) {
193
- var input = widgetSlice.call( arguments, 1 );
212
+ $.widget.extend = function (target) {
213
+ var input = widgetSlice.call(arguments, 1);
194
214
  var inputIndex = 0;
195
215
  var inputLength = input.length;
196
216
  var key;
197
217
  var value;
198
218
 
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
-
219
+ for (; inputIndex < inputLength; inputIndex++) {
220
+ for (key in input[inputIndex]) {
221
+ value = input[inputIndex][key];
222
+ if (
223
+ widgetHasOwnProperty.call(input[inputIndex], key) &&
224
+ value !== undefined
225
+ ) {
204
226
  // 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 );
227
+ if ($.isPlainObject(value)) {
228
+ target[key] = $.isPlainObject(target[key])
229
+ ? $.widget.extend({}, target[key], value)
230
+ : // Don't extend strings, arrays, etc. with objects
231
+ $.widget.extend({}, value);
211
232
 
212
233
  // Copy everything else by reference
213
234
  } else {
214
- target[ key ] = value;
235
+ target[key] = value;
215
236
  }
216
237
  }
217
238
  }
@@ -219,81 +240,90 @@
219
240
  return target;
220
241
  };
221
242
 
222
- $.widget.bridge = function( name, object ) {
243
+ $.widget.bridge = function (name, object) {
223
244
  var fullName = object.prototype.widgetFullName || name;
224
- $.fn[ name ] = function( options ) {
225
- var isMethodCall = typeof options === "string";
226
- var args = widgetSlice.call( arguments, 1 );
245
+ $.fn[name] = function (options) {
246
+ var isMethodCall = typeof options === 'string';
247
+ var args = widgetSlice.call(arguments, 1);
227
248
  var returnValue = this;
228
249
 
229
- if ( isMethodCall ) {
230
-
250
+ if (isMethodCall) {
231
251
  // If this is an empty collection, we need to have the instance method
232
252
  // return undefined instead of the jQuery instance
233
- if ( !this.length && options === "instance" ) {
253
+ if (!this.length && options === 'instance') {
234
254
  returnValue = undefined;
235
255
  } else {
236
- this.each( function() {
256
+ this.each(function () {
237
257
  var methodValue;
238
- var instance = $.data( this, fullName );
258
+ var instance = $.data(this, fullName);
239
259
 
240
- if ( options === "instance" ) {
260
+ if (options === 'instance') {
241
261
  returnValue = instance;
242
262
  return false;
243
263
  }
244
264
 
245
- if ( !instance ) {
246
- return $.error( "cannot call methods on " + name +
247
- " prior to initialization; " +
248
- "attempted to call method '" + options + "'" );
265
+ if (!instance) {
266
+ return $.error(
267
+ 'cannot call methods on ' +
268
+ name +
269
+ ' prior to initialization; ' +
270
+ "attempted to call method '" +
271
+ options +
272
+ "'"
273
+ );
249
274
  }
250
275
 
251
- if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
252
- return $.error( "no such method '" + options + "' for " + name +
253
- " widget instance" );
276
+ if (!$.isFunction(instance[options]) || options.charAt(0) === '_') {
277
+ return $.error(
278
+ "no such method '" +
279
+ options +
280
+ "' for " +
281
+ name +
282
+ ' widget instance'
283
+ );
254
284
  }
255
285
 
256
- methodValue = instance[ options ].apply( instance, args );
286
+ methodValue = instance[options].apply(instance, args);
257
287
 
258
- if ( methodValue !== instance && methodValue !== undefined ) {
259
- returnValue = methodValue && methodValue.jquery ?
260
- returnValue.pushStack( methodValue.get() ) :
261
- methodValue;
288
+ if (methodValue !== instance && methodValue !== undefined) {
289
+ returnValue =
290
+ methodValue && methodValue.jquery
291
+ ? returnValue.pushStack(methodValue.get())
292
+ : methodValue;
262
293
  return false;
263
294
  }
264
- } );
295
+ });
265
296
  }
266
297
  } else {
267
-
268
298
  // Allow multiple hashes to be passed on init
269
- if ( args.length ) {
270
- options = $.widget.extend.apply( null, [ options ].concat( args ) );
299
+ if (args.length) {
300
+ options = $.widget.extend.apply(null, [options].concat(args));
271
301
  }
272
302
 
273
- this.each( function() {
274
- var instance = $.data( this, fullName );
275
- if ( instance ) {
276
- instance.option( options || {} );
277
- if ( instance._init ) {
303
+ this.each(function () {
304
+ var instance = $.data(this, fullName);
305
+ if (instance) {
306
+ instance.option(options || {});
307
+ if (instance._init) {
278
308
  instance._init();
279
309
  }
280
310
  } else {
281
- $.data( this, fullName, new object( options, this ) );
311
+ $.data(this, fullName, new object(options, this));
282
312
  }
283
- } );
313
+ });
284
314
  }
285
315
 
286
316
  return returnValue;
287
317
  };
288
318
  };
289
319
 
290
- $.Widget = function( /* options, element */ ) {};
320
+ $.Widget = function (/* options, element */) {};
291
321
  $.Widget._childConstructors = [];
292
322
 
293
323
  $.Widget.prototype = {
294
- widgetName: "widget",
295
- widgetEventPrefix: "",
296
- defaultElement: "<div>",
324
+ widgetName: 'widget',
325
+ widgetEventPrefix: '',
326
+ defaultElement: '<div>',
297
327
 
298
328
  options: {
299
329
  classes: {},
@@ -303,52 +333,56 @@
303
333
  create: null
304
334
  },
305
335
 
306
- _createWidget: function( options, element ) {
307
- element = $( element || this.defaultElement || this )[ 0 ];
308
- this.element = $( element );
336
+ _createWidget: function (options, element) {
337
+ element = $(element || this.defaultElement || this)[0];
338
+ this.element = $(element);
309
339
  this.uuid = widgetUuid++;
310
- this.eventNamespace = "." + this.widgetName + this.uuid;
340
+ this.eventNamespace = '.' + this.widgetName + this.uuid;
311
341
 
312
342
  this.bindings = $();
313
343
  this.hoverable = $();
314
344
  this.focusable = $();
315
345
  this.classesElementLookup = {};
316
346
 
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 ) {
347
+ if (element !== this) {
348
+ $.data(element, this.widgetFullName, this);
349
+ this._on(true, this.element, {
350
+ remove: function (event) {
351
+ if (event.target === element) {
322
352
  this.destroy();
323
353
  }
324
354
  }
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 );
355
+ });
356
+ this.document = $(
357
+ element.style
358
+ ? // Element within the document
359
+ element.ownerDocument
360
+ : // Element is window or document
361
+ element.document || element
362
+ );
363
+ this.window = $(
364
+ this.document[0].defaultView || this.document[0].parentWindow
365
+ );
334
366
  }
335
367
 
336
- this.options = $.widget.extend( {},
368
+ this.options = $.widget.extend(
369
+ {},
337
370
  this.options,
338
371
  this._getCreateOptions(),
339
- options );
372
+ options
373
+ );
340
374
 
341
375
  this._create();
342
376
 
343
- if ( this.options.disabled ) {
344
- this._setOptionDisabled( this.options.disabled );
377
+ if (this.options.disabled) {
378
+ this._setOptionDisabled(this.options.disabled);
345
379
  }
346
380
 
347
- this._trigger( "create", null, this._getCreateEventData() );
381
+ this._trigger('create', null, this._getCreateEventData());
348
382
  this._init();
349
383
  },
350
384
 
351
- _getCreateOptions: function() {
385
+ _getCreateOptions: function () {
352
386
  return {};
353
387
  },
354
388
 
@@ -358,107 +392,103 @@
358
392
 
359
393
  _init: $.noop,
360
394
 
361
- destroy: function() {
395
+ destroy: function () {
362
396
  var that = this;
363
397
 
364
398
  this._destroy();
365
- $.each( this.classesElementLookup, function( key, value ) {
366
- that._removeClass( value, key );
367
- } );
399
+ $.each(this.classesElementLookup, function (key, value) {
400
+ that._removeClass(value, key);
401
+ });
368
402
 
369
403
  // We can probably remove the unbind calls in 2.0
370
404
  // 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" );
405
+ this.element.off(this.eventNamespace).removeData(this.widgetFullName);
406
+ this.widget().off(this.eventNamespace).removeAttr('aria-disabled');
377
407
 
378
408
  // Clean up events and states
379
- this.bindings.off( this.eventNamespace );
409
+ this.bindings.off(this.eventNamespace);
380
410
  },
381
411
 
382
412
  _destroy: $.noop,
383
413
 
384
- widget: function() {
414
+ widget: function () {
385
415
  return this.element;
386
416
  },
387
417
 
388
- option: function( key, value ) {
418
+ option: function (key, value) {
389
419
  var options = key;
390
420
  var parts;
391
421
  var curOption;
392
422
  var i;
393
423
 
394
- if ( arguments.length === 0 ) {
395
-
424
+ if (arguments.length === 0) {
396
425
  // Don't return a reference to the internal hash
397
- return $.widget.extend( {}, this.options );
426
+ return $.widget.extend({}, this.options);
398
427
  }
399
428
 
400
- if ( typeof key === "string" ) {
401
-
429
+ if (typeof key === 'string') {
402
430
  // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
403
431
  options = {};
404
- parts = key.split( "." );
432
+ parts = key.split('.');
405
433
  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 ] ];
434
+ if (parts.length) {
435
+ curOption = options[key] = $.widget.extend({}, this.options[key]);
436
+ for (i = 0; i < parts.length - 1; i++) {
437
+ curOption[parts[i]] = curOption[parts[i]] || {};
438
+ curOption = curOption[parts[i]];
411
439
  }
412
440
  key = parts.pop();
413
- if ( arguments.length === 1 ) {
414
- return curOption[ key ] === undefined ? null : curOption[ key ];
441
+ if (arguments.length === 1) {
442
+ return curOption[key] === undefined ? null : curOption[key];
415
443
  }
416
- curOption[ key ] = value;
444
+ curOption[key] = value;
417
445
  } else {
418
- if ( arguments.length === 1 ) {
419
- return this.options[ key ] === undefined ? null : this.options[ key ];
446
+ if (arguments.length === 1) {
447
+ return this.options[key] === undefined ? null : this.options[key];
420
448
  }
421
- options[ key ] = value;
449
+ options[key] = value;
422
450
  }
423
451
  }
424
452
 
425
- this._setOptions( options );
453
+ this._setOptions(options);
426
454
 
427
455
  return this;
428
456
  },
429
457
 
430
- _setOptions: function( options ) {
458
+ _setOptions: function (options) {
431
459
  var key;
432
460
 
433
- for ( key in options ) {
434
- this._setOption( key, options[ key ] );
461
+ for (key in options) {
462
+ this._setOption(key, options[key]);
435
463
  }
436
464
 
437
465
  return this;
438
466
  },
439
467
 
440
- _setOption: function( key, value ) {
441
- if ( key === "classes" ) {
442
- this._setOptionClasses( value );
468
+ _setOption: function (key, value) {
469
+ if (key === 'classes') {
470
+ this._setOptionClasses(value);
443
471
  }
444
472
 
445
- this.options[ key ] = value;
473
+ this.options[key] = value;
446
474
 
447
- if ( key === "disabled" ) {
448
- this._setOptionDisabled( value );
475
+ if (key === 'disabled') {
476
+ this._setOptionDisabled(value);
449
477
  }
450
478
 
451
479
  return this;
452
480
  },
453
481
 
454
- _setOptionClasses: function( value ) {
482
+ _setOptionClasses: function (value) {
455
483
  var classKey, elements, currentElements;
456
484
 
457
- for ( classKey in value ) {
458
- currentElements = this.classesElementLookup[ classKey ];
459
- if ( value[ classKey ] === this.options.classes[ classKey ] ||
485
+ for (classKey in value) {
486
+ currentElements = this.classesElementLookup[classKey];
487
+ if (
488
+ value[classKey] === this.options.classes[classKey] ||
460
489
  !currentElements ||
461
- !currentElements.length ) {
490
+ !currentElements.length
491
+ ) {
462
492
  continue;
463
493
  }
464
494
 
@@ -466,283 +496,310 @@
466
496
  // on the next line is going to destroy the reference to the current elements being
467
497
  // tracked. We need to save a copy of this collection so that we can add the new classes
468
498
  // below.
469
- elements = $( currentElements.get() );
470
- this._removeClass( currentElements, classKey );
499
+ elements = $(currentElements.get());
500
+ this._removeClass(currentElements, classKey);
471
501
 
472
502
  // We don't use _addClass() here, because that uses this.options.classes
473
503
  // for generating the string of classes. We want to use the value passed in from
474
504
  // _setOption(), this is the new value of the classes option which was passed to
475
505
  // _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
- } ) );
506
+ elements.addClass(
507
+ this._classes({
508
+ element: elements,
509
+ keys: classKey,
510
+ classes: value,
511
+ add: true
512
+ })
513
+ );
482
514
  }
483
515
  },
484
516
 
485
- _setOptionDisabled: function( value ) {
486
- this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
517
+ _setOptionDisabled: function (value) {
518
+ this._toggleClass(
519
+ this.widget(),
520
+ this.widgetFullName + '-disabled',
521
+ null,
522
+ !!value
523
+ );
487
524
 
488
525
  // 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" );
526
+ if (value) {
527
+ this._removeClass(this.hoverable, null, 'ui-state-hover');
528
+ this._removeClass(this.focusable, null, 'ui-state-focus');
492
529
  }
493
530
  },
494
531
 
495
- enable: function() {
496
- return this._setOptions( { disabled: false } );
532
+ enable: function () {
533
+ return this._setOptions({ disabled: false });
497
534
  },
498
535
 
499
- disable: function() {
500
- return this._setOptions( { disabled: true } );
536
+ disable: function () {
537
+ return this._setOptions({ disabled: true });
501
538
  },
502
539
 
503
- _classes: function( options ) {
540
+ _classes: function (options) {
504
541
  var full = [];
505
542
  var that = this;
506
543
 
507
- options = $.extend( {
508
- element: this.element,
509
- classes: this.options.classes || {}
510
- }, options );
544
+ options = $.extend(
545
+ {
546
+ element: this.element,
547
+ classes: this.options.classes || {}
548
+ },
549
+ options
550
+ );
551
+
552
+ function bindRemoveEvent() {
553
+ options.element.each(function (_, element) {
554
+ var isTracked = $.map(that.classesElementLookup, function (elements) {
555
+ return elements;
556
+ }).some(function (elements) {
557
+ return elements.is(element);
558
+ });
559
+
560
+ if (!isTracked) {
561
+ that._on($(element), {
562
+ remove: '_untrackClassesElement'
563
+ });
564
+ }
565
+ });
566
+ }
511
567
 
512
- function processClassString( classes, checkOption ) {
568
+ function processClassString(classes, checkOption) {
513
569
  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() ) ) );
570
+ for (i = 0; i < classes.length; i++) {
571
+ current = that.classesElementLookup[classes[i]] || $();
572
+ if (options.add) {
573
+ bindRemoveEvent();
574
+ current = $(
575
+ $.uniqueSort(current.get().concat(options.element.get()))
576
+ );
518
577
  } else {
519
- current = $( current.not( options.element ).get() );
578
+ current = $(current.not(options.element).get());
520
579
  }
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 ] ] );
580
+ that.classesElementLookup[classes[i]] = current;
581
+ full.push(classes[i]);
582
+ if (checkOption && options.classes[classes[i]]) {
583
+ full.push(options.classes[classes[i]]);
525
584
  }
526
585
  }
527
586
  }
528
587
 
529
- this._on( options.element, {
530
- "remove": "_untrackClassesElement"
531
- } );
532
-
533
- if ( options.keys ) {
534
- processClassString( options.keys.match( /\S+/g ) || [], true );
588
+ if (options.keys) {
589
+ processClassString(options.keys.match(/\S+/g) || [], true);
535
590
  }
536
- if ( options.extra ) {
537
- processClassString( options.extra.match( /\S+/g ) || [] );
591
+ if (options.extra) {
592
+ processClassString(options.extra.match(/\S+/g) || []);
538
593
  }
539
594
 
540
- return full.join( " " );
595
+ return full.join(' ');
541
596
  },
542
597
 
543
- _untrackClassesElement: function( event ) {
598
+ _untrackClassesElement: function (event) {
544
599
  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() );
600
+ $.each(that.classesElementLookup, function (key, value) {
601
+ if ($.inArray(event.target, value) !== -1) {
602
+ that.classesElementLookup[key] = $(value.not(event.target).get());
548
603
  }
549
- } );
604
+ });
605
+
606
+ this._off($(event.target));
550
607
  },
551
608
 
552
- _removeClass: function( element, keys, extra ) {
553
- return this._toggleClass( element, keys, extra, false );
609
+ _removeClass: function (element, keys, extra) {
610
+ return this._toggleClass(element, keys, extra, false);
554
611
  },
555
612
 
556
- _addClass: function( element, keys, extra ) {
557
- return this._toggleClass( element, keys, extra, true );
613
+ _addClass: function (element, keys, extra) {
614
+ return this._toggleClass(element, keys, extra, true);
558
615
  },
559
616
 
560
- _toggleClass: function( element, keys, extra, add ) {
561
- add = ( typeof add === "boolean" ) ? add : extra;
562
- var shift = ( typeof element === "string" || element === null ),
617
+ _toggleClass: function (element, keys, extra, add) {
618
+ add = typeof add === 'boolean' ? add : extra;
619
+ var shift = typeof element === 'string' || element === null,
563
620
  options = {
564
621
  extra: shift ? keys : extra,
565
622
  keys: shift ? element : keys,
566
623
  element: shift ? this.element : element,
567
624
  add: add
568
625
  };
569
- options.element.toggleClass( this._classes( options ), add );
626
+ options.element.toggleClass(this._classes(options), add);
570
627
  return this;
571
628
  },
572
629
 
573
- _on: function( suppressDisabledCheck, element, handlers ) {
630
+ _on: function (suppressDisabledCheck, element, handlers) {
574
631
  var delegateElement;
575
632
  var instance = this;
576
633
 
577
634
  // No suppressDisabledCheck flag, shuffle arguments
578
- if ( typeof suppressDisabledCheck !== "boolean" ) {
635
+ if (typeof suppressDisabledCheck !== 'boolean') {
579
636
  handlers = element;
580
637
  element = suppressDisabledCheck;
581
638
  suppressDisabledCheck = false;
582
639
  }
583
640
 
584
641
  // No element argument, shuffle and use this.element
585
- if ( !handlers ) {
642
+ if (!handlers) {
586
643
  handlers = element;
587
644
  element = this.element;
588
645
  delegateElement = this.widget();
589
646
  } else {
590
- element = delegateElement = $( element );
591
- this.bindings = this.bindings.add( element );
647
+ element = delegateElement = $(element);
648
+ this.bindings = this.bindings.add(element);
592
649
  }
593
650
 
594
- $.each( handlers, function( event, handler ) {
651
+ $.each(handlers, function (event, handler) {
595
652
  function handlerProxy() {
596
-
597
653
  // Allow widgets to customize the disabled handling
598
654
  // - disabled as an array instead of boolean
599
655
  // - disabled class as method for disabling individual parts
600
- if ( !suppressDisabledCheck &&
601
- ( instance.options.disabled === true ||
602
- $( this ).hasClass( "ui-state-disabled" ) ) ) {
656
+ if (
657
+ !suppressDisabledCheck &&
658
+ (instance.options.disabled === true ||
659
+ $(this).hasClass('ui-state-disabled'))
660
+ ) {
603
661
  return;
604
662
  }
605
- return ( typeof handler === "string" ? instance[ handler ] : handler )
606
- .apply( instance, arguments );
663
+ return (
664
+ typeof handler === 'string' ? instance[handler] : handler
665
+ ).apply(instance, arguments);
607
666
  }
608
667
 
609
668
  // Copy the guid so direct unbinding works
610
- if ( typeof handler !== "string" ) {
669
+ if (typeof handler !== 'string') {
611
670
  handlerProxy.guid = handler.guid =
612
671
  handler.guid || handlerProxy.guid || $.guid++;
613
672
  }
614
673
 
615
- var match = event.match( /^([\w:-]*)\s*(.*)$/ );
616
- var eventName = match[ 1 ] + instance.eventNamespace;
617
- var selector = match[ 2 ];
674
+ var match = event.match(/^([\w:-]*)\s*(.*)$/);
675
+ var eventName = match[1] + instance.eventNamespace;
676
+ var selector = match[2];
618
677
 
619
- if ( selector ) {
620
- delegateElement.on( eventName, selector, handlerProxy );
678
+ if (selector) {
679
+ delegateElement.on(eventName, selector, handlerProxy);
621
680
  } else {
622
- element.on( eventName, handlerProxy );
681
+ element.on(eventName, handlerProxy);
623
682
  }
624
- } );
683
+ });
625
684
  },
626
685
 
627
- _off: function( element, eventName ) {
628
- eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
686
+ _off: function (element, eventName) {
687
+ eventName =
688
+ (eventName || '').split(' ').join(this.eventNamespace + ' ') +
629
689
  this.eventNamespace;
630
- element.off( eventName ).off( eventName );
690
+ element.off(eventName);
631
691
 
632
692
  // 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() );
693
+ this.bindings = $(this.bindings.not(element).get());
694
+ this.focusable = $(this.focusable.not(element).get());
695
+ this.hoverable = $(this.hoverable.not(element).get());
636
696
  },
637
697
 
638
- _delay: function( handler, delay ) {
698
+ _delay: function (handler, delay) {
699
+ var instance = this;
639
700
  function handlerProxy() {
640
- return ( typeof handler === "string" ? instance[ handler ] : handler )
641
- .apply( instance, arguments );
701
+ return (
702
+ typeof handler === 'string' ? instance[handler] : handler
703
+ ).apply(instance, arguments);
642
704
  }
643
- var instance = this;
644
- return setTimeout( handlerProxy, delay || 0 );
705
+ return setTimeout(handlerProxy, delay || 0);
645
706
  },
646
707
 
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" );
708
+ _hoverable: function (element) {
709
+ this.hoverable = this.hoverable.add(element);
710
+ this._on(element, {
711
+ mouseenter: function (event) {
712
+ this._addClass($(event.currentTarget), null, 'ui-state-hover');
652
713
  },
653
- mouseleave: function( event ) {
654
- this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
714
+ mouseleave: function (event) {
715
+ this._removeClass($(event.currentTarget), null, 'ui-state-hover');
655
716
  }
656
- } );
717
+ });
657
718
  },
658
719
 
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" );
720
+ _focusable: function (element) {
721
+ this.focusable = this.focusable.add(element);
722
+ this._on(element, {
723
+ focusin: function (event) {
724
+ this._addClass($(event.currentTarget), null, 'ui-state-focus');
664
725
  },
665
- focusout: function( event ) {
666
- this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
726
+ focusout: function (event) {
727
+ this._removeClass($(event.currentTarget), null, 'ui-state-focus');
667
728
  }
668
- } );
729
+ });
669
730
  },
670
731
 
671
- _trigger: function( type, event, data ) {
732
+ _trigger: function (type, event, data) {
672
733
  var prop, orig;
673
- var callback = this.options[ type ];
734
+ var callback = this.options[type];
674
735
 
675
736
  data = data || {};
676
- event = $.Event( event );
677
- event.type = ( type === this.widgetEventPrefix ?
678
- type :
679
- this.widgetEventPrefix + type ).toLowerCase();
737
+ event = $.Event(event);
738
+ event.type = (
739
+ type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type
740
+ ).toLowerCase();
680
741
 
681
742
  // The original event may come from any element
682
743
  // so we need to reset the target on the new event
683
- event.target = this.element[ 0 ];
744
+ event.target = this.element[0];
684
745
 
685
746
  // Copy original event properties over to the new event
686
747
  orig = event.originalEvent;
687
- if ( orig ) {
688
- for ( prop in orig ) {
689
- if ( !( prop in event ) ) {
690
- event[ prop ] = orig[ prop ];
748
+ if (orig) {
749
+ for (prop in orig) {
750
+ if (!(prop in event)) {
751
+ event[prop] = orig[prop];
691
752
  }
692
753
  }
693
754
  }
694
755
 
695
- this.element.trigger( event, data );
696
- return !( $.isFunction( callback ) &&
697
- callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
698
- event.isDefaultPrevented() );
756
+ this.element.trigger(event, data);
757
+ return !(
758
+ ($.isFunction(callback) &&
759
+ callback.apply(this.element[0], [event].concat(data)) === false) ||
760
+ event.isDefaultPrevented()
761
+ );
699
762
  }
700
763
  };
701
764
 
702
- $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
703
- $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
704
- if ( typeof options === "string" ) {
765
+ $.each({ show: 'fadeIn', hide: 'fadeOut' }, function (method, defaultEffect) {
766
+ $.Widget.prototype['_' + method] = function (element, options, callback) {
767
+ if (typeof options === 'string') {
705
768
  options = { effect: options };
706
769
  }
707
770
 
708
771
  var hasOptions;
709
- var effectName = !options ?
710
- method :
711
- options === true || typeof options === "number" ?
712
- defaultEffect :
713
- options.effect || defaultEffect;
772
+ var effectName = !options
773
+ ? method
774
+ : options === true || typeof options === 'number'
775
+ ? defaultEffect
776
+ : options.effect || defaultEffect;
714
777
 
715
778
  options = options || {};
716
- if ( typeof options === "number" ) {
779
+ if (typeof options === 'number') {
717
780
  options = { duration: options };
718
781
  }
719
782
 
720
- hasOptions = !$.isEmptyObject( options );
783
+ hasOptions = !$.isEmptyObject(options);
721
784
  options.complete = callback;
722
785
 
723
- if ( options.delay ) {
724
- element.delay( options.delay );
786
+ if (options.delay) {
787
+ element.delay(options.delay);
725
788
  }
726
789
 
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 );
790
+ if (hasOptions && $.effects && $.effects.effect[effectName]) {
791
+ element[method](options);
792
+ } else if (effectName !== method && element[effectName]) {
793
+ element[effectName](options.duration, options.easing, callback);
731
794
  } else {
732
- element.queue( function( next ) {
733
- $( this )[ method ]();
734
- if ( callback ) {
735
- callback.call( element[ 0 ] );
795
+ element.queue(function (next) {
796
+ $(this)[method]();
797
+ if (callback) {
798
+ callback.call(element[0]);
736
799
  }
737
800
  next();
738
- } );
801
+ });
739
802
  }
740
803
  };
741
- } );
742
-
743
- var widget = $.widget;
744
-
745
-
746
-
747
-
748
- }));
804
+ });
805
+ });