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