emphatic_invalids 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/emphatic_invalids/jquery-ui.js +1839 -0
- data/app/assets/javascripts/emphatic_invalids/script.js.coffee +1 -1
- data/app/assets/stylesheets/emphatic_invalids/jquery-ui.css +534 -0
- data/app/assets/stylesheets/emphatic_invalids/style.css +3 -1
- data/lib/emphatic_invalids/engine.rb +0 -1
- data/lib/emphatic_invalids/version.rb +1 -1
- metadata +8 -20
@@ -0,0 +1,1839 @@
|
|
1
|
+
/*! jQuery UI - v1.13.0 - 2021-12-09
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Includes: widget.js, position.js, keycode.js, unique-id.js, widgets/tooltip.js
|
4
|
+
* Copyright jQuery Foundation and other contributors; Licensed MIT */
|
5
|
+
|
6
|
+
( function( factory ) {
|
7
|
+
"use strict";
|
8
|
+
|
9
|
+
if ( typeof define === "function" && define.amd ) {
|
10
|
+
|
11
|
+
// AMD. Register as an anonymous module.
|
12
|
+
define( [ "jquery" ], factory );
|
13
|
+
} else {
|
14
|
+
|
15
|
+
// Browser globals
|
16
|
+
factory( jQuery );
|
17
|
+
}
|
18
|
+
} )( function( $ ) {
|
19
|
+
"use strict";
|
20
|
+
|
21
|
+
$.ui = $.ui || {};
|
22
|
+
|
23
|
+
var version = $.ui.version = "1.13.0";
|
24
|
+
|
25
|
+
|
26
|
+
/*!
|
27
|
+
* jQuery UI Widget 1.13.0
|
28
|
+
* http://jqueryui.com
|
29
|
+
*
|
30
|
+
* Copyright jQuery Foundation and other contributors
|
31
|
+
* Released under the MIT license.
|
32
|
+
* http://jquery.org/license
|
33
|
+
*/
|
34
|
+
|
35
|
+
//>>label: Widget
|
36
|
+
//>>group: Core
|
37
|
+
//>>description: Provides a factory for creating stateful widgets with a common API.
|
38
|
+
//>>docs: http://api.jqueryui.com/jQuery.widget/
|
39
|
+
//>>demos: http://jqueryui.com/widget/
|
40
|
+
|
41
|
+
|
42
|
+
var widgetUuid = 0;
|
43
|
+
var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
|
44
|
+
var widgetSlice = Array.prototype.slice;
|
45
|
+
|
46
|
+
$.cleanData = ( function( orig ) {
|
47
|
+
return function( elems ) {
|
48
|
+
var events, elem, i;
|
49
|
+
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
|
50
|
+
|
51
|
+
// Only trigger remove when necessary to save time
|
52
|
+
events = $._data( elem, "events" );
|
53
|
+
if ( events && events.remove ) {
|
54
|
+
$( elem ).triggerHandler( "remove" );
|
55
|
+
}
|
56
|
+
}
|
57
|
+
orig( elems );
|
58
|
+
};
|
59
|
+
} )( $.cleanData );
|
60
|
+
|
61
|
+
$.widget = function( name, base, prototype ) {
|
62
|
+
var existingConstructor, constructor, basePrototype;
|
63
|
+
|
64
|
+
// ProxiedPrototype allows the provided prototype to remain unmodified
|
65
|
+
// so that it can be used as a mixin for multiple widgets (#8876)
|
66
|
+
var proxiedPrototype = {};
|
67
|
+
|
68
|
+
var namespace = name.split( "." )[ 0 ];
|
69
|
+
name = name.split( "." )[ 1 ];
|
70
|
+
var fullName = namespace + "-" + name;
|
71
|
+
|
72
|
+
if ( !prototype ) {
|
73
|
+
prototype = base;
|
74
|
+
base = $.Widget;
|
75
|
+
}
|
76
|
+
|
77
|
+
if ( Array.isArray( prototype ) ) {
|
78
|
+
prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
|
79
|
+
}
|
80
|
+
|
81
|
+
// Create selector for plugin
|
82
|
+
$.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
|
83
|
+
return !!$.data( elem, fullName );
|
84
|
+
};
|
85
|
+
|
86
|
+
$[ namespace ] = $[ namespace ] || {};
|
87
|
+
existingConstructor = $[ namespace ][ name ];
|
88
|
+
constructor = $[ namespace ][ name ] = function( options, element ) {
|
89
|
+
|
90
|
+
// Allow instantiation without "new" keyword
|
91
|
+
if ( !this._createWidget ) {
|
92
|
+
return new constructor( options, element );
|
93
|
+
}
|
94
|
+
|
95
|
+
// Allow instantiation without initializing for simple inheritance
|
96
|
+
// must use "new" keyword (the code above always passes args)
|
97
|
+
if ( arguments.length ) {
|
98
|
+
this._createWidget( options, element );
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
// Extend with the existing constructor to carry over any static properties
|
103
|
+
$.extend( constructor, existingConstructor, {
|
104
|
+
version: prototype.version,
|
105
|
+
|
106
|
+
// Copy the object used to create the prototype in case we need to
|
107
|
+
// redefine the widget later
|
108
|
+
_proto: $.extend( {}, prototype ),
|
109
|
+
|
110
|
+
// Track widgets that inherit from this widget in case this widget is
|
111
|
+
// redefined after a widget inherits from it
|
112
|
+
_childConstructors: []
|
113
|
+
} );
|
114
|
+
|
115
|
+
basePrototype = new base();
|
116
|
+
|
117
|
+
// We need to make the options hash a property directly on the new instance
|
118
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
119
|
+
// inheriting from
|
120
|
+
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
121
|
+
$.each( prototype, function( prop, value ) {
|
122
|
+
if ( typeof value !== "function" ) {
|
123
|
+
proxiedPrototype[ prop ] = value;
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
proxiedPrototype[ prop ] = ( function() {
|
127
|
+
function _super() {
|
128
|
+
return base.prototype[ prop ].apply( this, arguments );
|
129
|
+
}
|
130
|
+
|
131
|
+
function _superApply( args ) {
|
132
|
+
return base.prototype[ prop ].apply( this, args );
|
133
|
+
}
|
134
|
+
|
135
|
+
return function() {
|
136
|
+
var __super = this._super;
|
137
|
+
var __superApply = this._superApply;
|
138
|
+
var returnValue;
|
139
|
+
|
140
|
+
this._super = _super;
|
141
|
+
this._superApply = _superApply;
|
142
|
+
|
143
|
+
returnValue = value.apply( this, arguments );
|
144
|
+
|
145
|
+
this._super = __super;
|
146
|
+
this._superApply = __superApply;
|
147
|
+
|
148
|
+
return returnValue;
|
149
|
+
};
|
150
|
+
} )();
|
151
|
+
} );
|
152
|
+
constructor.prototype = $.widget.extend( basePrototype, {
|
153
|
+
|
154
|
+
// TODO: remove support for widgetEventPrefix
|
155
|
+
// always use the name + a colon as the prefix, e.g., draggable:start
|
156
|
+
// don't prefix for widgets that aren't DOM-based
|
157
|
+
widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
|
158
|
+
}, proxiedPrototype, {
|
159
|
+
constructor: constructor,
|
160
|
+
namespace: namespace,
|
161
|
+
widgetName: name,
|
162
|
+
widgetFullName: fullName
|
163
|
+
} );
|
164
|
+
|
165
|
+
// If this widget is being redefined then we need to find all widgets that
|
166
|
+
// are inheriting from it and redefine all of them so that they inherit from
|
167
|
+
// the new version of this widget. We're essentially trying to replace one
|
168
|
+
// level in the prototype chain.
|
169
|
+
if ( existingConstructor ) {
|
170
|
+
$.each( existingConstructor._childConstructors, function( i, child ) {
|
171
|
+
var childPrototype = child.prototype;
|
172
|
+
|
173
|
+
// Redefine the child widget using the same prototype that was
|
174
|
+
// originally used, but inherit from the new version of the base
|
175
|
+
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
|
176
|
+
child._proto );
|
177
|
+
} );
|
178
|
+
|
179
|
+
// Remove the list of existing child constructors from the old constructor
|
180
|
+
// so the old child constructors can be garbage collected
|
181
|
+
delete existingConstructor._childConstructors;
|
182
|
+
} else {
|
183
|
+
base._childConstructors.push( constructor );
|
184
|
+
}
|
185
|
+
|
186
|
+
$.widget.bridge( name, constructor );
|
187
|
+
|
188
|
+
return constructor;
|
189
|
+
};
|
190
|
+
|
191
|
+
$.widget.extend = function( target ) {
|
192
|
+
var input = widgetSlice.call( arguments, 1 );
|
193
|
+
var inputIndex = 0;
|
194
|
+
var inputLength = input.length;
|
195
|
+
var key;
|
196
|
+
var value;
|
197
|
+
|
198
|
+
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
199
|
+
for ( key in input[ inputIndex ] ) {
|
200
|
+
value = input[ inputIndex ][ key ];
|
201
|
+
if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
|
202
|
+
|
203
|
+
// Clone objects
|
204
|
+
if ( $.isPlainObject( value ) ) {
|
205
|
+
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
206
|
+
$.widget.extend( {}, target[ key ], value ) :
|
207
|
+
|
208
|
+
// Don't extend strings, arrays, etc. with objects
|
209
|
+
$.widget.extend( {}, value );
|
210
|
+
|
211
|
+
// Copy everything else by reference
|
212
|
+
} else {
|
213
|
+
target[ key ] = value;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
return target;
|
219
|
+
};
|
220
|
+
|
221
|
+
$.widget.bridge = function( name, object ) {
|
222
|
+
var fullName = object.prototype.widgetFullName || name;
|
223
|
+
$.fn[ name ] = function( options ) {
|
224
|
+
var isMethodCall = typeof options === "string";
|
225
|
+
var args = widgetSlice.call( arguments, 1 );
|
226
|
+
var returnValue = this;
|
227
|
+
|
228
|
+
if ( isMethodCall ) {
|
229
|
+
|
230
|
+
// If this is an empty collection, we need to have the instance method
|
231
|
+
// return undefined instead of the jQuery instance
|
232
|
+
if ( !this.length && options === "instance" ) {
|
233
|
+
returnValue = undefined;
|
234
|
+
} else {
|
235
|
+
this.each( function() {
|
236
|
+
var methodValue;
|
237
|
+
var instance = $.data( this, fullName );
|
238
|
+
|
239
|
+
if ( options === "instance" ) {
|
240
|
+
returnValue = instance;
|
241
|
+
return false;
|
242
|
+
}
|
243
|
+
|
244
|
+
if ( !instance ) {
|
245
|
+
return $.error( "cannot call methods on " + name +
|
246
|
+
" prior to initialization; " +
|
247
|
+
"attempted to call method '" + options + "'" );
|
248
|
+
}
|
249
|
+
|
250
|
+
if ( typeof instance[ options ] !== "function" ||
|
251
|
+
options.charAt( 0 ) === "_" ) {
|
252
|
+
return $.error( "no such method '" + options + "' for " + name +
|
253
|
+
" widget instance" );
|
254
|
+
}
|
255
|
+
|
256
|
+
methodValue = instance[ options ].apply( instance, args );
|
257
|
+
|
258
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
259
|
+
returnValue = methodValue && methodValue.jquery ?
|
260
|
+
returnValue.pushStack( methodValue.get() ) :
|
261
|
+
methodValue;
|
262
|
+
return false;
|
263
|
+
}
|
264
|
+
} );
|
265
|
+
}
|
266
|
+
} else {
|
267
|
+
|
268
|
+
// Allow multiple hashes to be passed on init
|
269
|
+
if ( args.length ) {
|
270
|
+
options = $.widget.extend.apply( null, [ options ].concat( args ) );
|
271
|
+
}
|
272
|
+
|
273
|
+
this.each( function() {
|
274
|
+
var instance = $.data( this, fullName );
|
275
|
+
if ( instance ) {
|
276
|
+
instance.option( options || {} );
|
277
|
+
if ( instance._init ) {
|
278
|
+
instance._init();
|
279
|
+
}
|
280
|
+
} else {
|
281
|
+
$.data( this, fullName, new object( options, this ) );
|
282
|
+
}
|
283
|
+
} );
|
284
|
+
}
|
285
|
+
|
286
|
+
return returnValue;
|
287
|
+
};
|
288
|
+
};
|
289
|
+
|
290
|
+
$.Widget = function( /* options, element */ ) {};
|
291
|
+
$.Widget._childConstructors = [];
|
292
|
+
|
293
|
+
$.Widget.prototype = {
|
294
|
+
widgetName: "widget",
|
295
|
+
widgetEventPrefix: "",
|
296
|
+
defaultElement: "<div>",
|
297
|
+
|
298
|
+
options: {
|
299
|
+
classes: {},
|
300
|
+
disabled: false,
|
301
|
+
|
302
|
+
// Callbacks
|
303
|
+
create: null
|
304
|
+
},
|
305
|
+
|
306
|
+
_createWidget: function( options, element ) {
|
307
|
+
element = $( element || this.defaultElement || this )[ 0 ];
|
308
|
+
this.element = $( element );
|
309
|
+
this.uuid = widgetUuid++;
|
310
|
+
this.eventNamespace = "." + this.widgetName + this.uuid;
|
311
|
+
|
312
|
+
this.bindings = $();
|
313
|
+
this.hoverable = $();
|
314
|
+
this.focusable = $();
|
315
|
+
this.classesElementLookup = {};
|
316
|
+
|
317
|
+
if ( element !== this ) {
|
318
|
+
$.data( element, this.widgetFullName, this );
|
319
|
+
this._on( true, this.element, {
|
320
|
+
remove: function( event ) {
|
321
|
+
if ( event.target === element ) {
|
322
|
+
this.destroy();
|
323
|
+
}
|
324
|
+
}
|
325
|
+
} );
|
326
|
+
this.document = $( element.style ?
|
327
|
+
|
328
|
+
// Element within the document
|
329
|
+
element.ownerDocument :
|
330
|
+
|
331
|
+
// Element is window or document
|
332
|
+
element.document || element );
|
333
|
+
this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
|
334
|
+
}
|
335
|
+
|
336
|
+
this.options = $.widget.extend( {},
|
337
|
+
this.options,
|
338
|
+
this._getCreateOptions(),
|
339
|
+
options );
|
340
|
+
|
341
|
+
this._create();
|
342
|
+
|
343
|
+
if ( this.options.disabled ) {
|
344
|
+
this._setOptionDisabled( this.options.disabled );
|
345
|
+
}
|
346
|
+
|
347
|
+
this._trigger( "create", null, this._getCreateEventData() );
|
348
|
+
this._init();
|
349
|
+
},
|
350
|
+
|
351
|
+
_getCreateOptions: function() {
|
352
|
+
return {};
|
353
|
+
},
|
354
|
+
|
355
|
+
_getCreateEventData: $.noop,
|
356
|
+
|
357
|
+
_create: $.noop,
|
358
|
+
|
359
|
+
_init: $.noop,
|
360
|
+
|
361
|
+
destroy: function() {
|
362
|
+
var that = this;
|
363
|
+
|
364
|
+
this._destroy();
|
365
|
+
$.each( this.classesElementLookup, function( key, value ) {
|
366
|
+
that._removeClass( value, key );
|
367
|
+
} );
|
368
|
+
|
369
|
+
// We can probably remove the unbind calls in 2.0
|
370
|
+
// all event bindings should go through this._on()
|
371
|
+
this.element
|
372
|
+
.off( this.eventNamespace )
|
373
|
+
.removeData( this.widgetFullName );
|
374
|
+
this.widget()
|
375
|
+
.off( this.eventNamespace )
|
376
|
+
.removeAttr( "aria-disabled" );
|
377
|
+
|
378
|
+
// Clean up events and states
|
379
|
+
this.bindings.off( this.eventNamespace );
|
380
|
+
},
|
381
|
+
|
382
|
+
_destroy: $.noop,
|
383
|
+
|
384
|
+
widget: function() {
|
385
|
+
return this.element;
|
386
|
+
},
|
387
|
+
|
388
|
+
option: function( key, value ) {
|
389
|
+
var options = key;
|
390
|
+
var parts;
|
391
|
+
var curOption;
|
392
|
+
var i;
|
393
|
+
|
394
|
+
if ( arguments.length === 0 ) {
|
395
|
+
|
396
|
+
// Don't return a reference to the internal hash
|
397
|
+
return $.widget.extend( {}, this.options );
|
398
|
+
}
|
399
|
+
|
400
|
+
if ( typeof key === "string" ) {
|
401
|
+
|
402
|
+
// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
403
|
+
options = {};
|
404
|
+
parts = key.split( "." );
|
405
|
+
key = parts.shift();
|
406
|
+
if ( parts.length ) {
|
407
|
+
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
408
|
+
for ( i = 0; i < parts.length - 1; i++ ) {
|
409
|
+
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
410
|
+
curOption = curOption[ parts[ i ] ];
|
411
|
+
}
|
412
|
+
key = parts.pop();
|
413
|
+
if ( arguments.length === 1 ) {
|
414
|
+
return curOption[ key ] === undefined ? null : curOption[ key ];
|
415
|
+
}
|
416
|
+
curOption[ key ] = value;
|
417
|
+
} else {
|
418
|
+
if ( arguments.length === 1 ) {
|
419
|
+
return this.options[ key ] === undefined ? null : this.options[ key ];
|
420
|
+
}
|
421
|
+
options[ key ] = value;
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
this._setOptions( options );
|
426
|
+
|
427
|
+
return this;
|
428
|
+
},
|
429
|
+
|
430
|
+
_setOptions: function( options ) {
|
431
|
+
var key;
|
432
|
+
|
433
|
+
for ( key in options ) {
|
434
|
+
this._setOption( key, options[ key ] );
|
435
|
+
}
|
436
|
+
|
437
|
+
return this;
|
438
|
+
},
|
439
|
+
|
440
|
+
_setOption: function( key, value ) {
|
441
|
+
if ( key === "classes" ) {
|
442
|
+
this._setOptionClasses( value );
|
443
|
+
}
|
444
|
+
|
445
|
+
this.options[ key ] = value;
|
446
|
+
|
447
|
+
if ( key === "disabled" ) {
|
448
|
+
this._setOptionDisabled( value );
|
449
|
+
}
|
450
|
+
|
451
|
+
return this;
|
452
|
+
},
|
453
|
+
|
454
|
+
_setOptionClasses: function( value ) {
|
455
|
+
var classKey, elements, currentElements;
|
456
|
+
|
457
|
+
for ( classKey in value ) {
|
458
|
+
currentElements = this.classesElementLookup[ classKey ];
|
459
|
+
if ( value[ classKey ] === this.options.classes[ classKey ] ||
|
460
|
+
!currentElements ||
|
461
|
+
!currentElements.length ) {
|
462
|
+
continue;
|
463
|
+
}
|
464
|
+
|
465
|
+
// We are doing this to create a new jQuery object because the _removeClass() call
|
466
|
+
// on the next line is going to destroy the reference to the current elements being
|
467
|
+
// tracked. We need to save a copy of this collection so that we can add the new classes
|
468
|
+
// below.
|
469
|
+
elements = $( currentElements.get() );
|
470
|
+
this._removeClass( currentElements, classKey );
|
471
|
+
|
472
|
+
// We don't use _addClass() here, because that uses this.options.classes
|
473
|
+
// for generating the string of classes. We want to use the value passed in from
|
474
|
+
// _setOption(), this is the new value of the classes option which was passed to
|
475
|
+
// _setOption(). We pass this value directly to _classes().
|
476
|
+
elements.addClass( this._classes( {
|
477
|
+
element: elements,
|
478
|
+
keys: classKey,
|
479
|
+
classes: value,
|
480
|
+
add: true
|
481
|
+
} ) );
|
482
|
+
}
|
483
|
+
},
|
484
|
+
|
485
|
+
_setOptionDisabled: function( value ) {
|
486
|
+
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
|
487
|
+
|
488
|
+
// If the widget is becoming disabled, then nothing is interactive
|
489
|
+
if ( value ) {
|
490
|
+
this._removeClass( this.hoverable, null, "ui-state-hover" );
|
491
|
+
this._removeClass( this.focusable, null, "ui-state-focus" );
|
492
|
+
}
|
493
|
+
},
|
494
|
+
|
495
|
+
enable: function() {
|
496
|
+
return this._setOptions( { disabled: false } );
|
497
|
+
},
|
498
|
+
|
499
|
+
disable: function() {
|
500
|
+
return this._setOptions( { disabled: true } );
|
501
|
+
},
|
502
|
+
|
503
|
+
_classes: function( options ) {
|
504
|
+
var full = [];
|
505
|
+
var that = this;
|
506
|
+
|
507
|
+
options = $.extend( {
|
508
|
+
element: this.element,
|
509
|
+
classes: this.options.classes || {}
|
510
|
+
}, options );
|
511
|
+
|
512
|
+
function bindRemoveEvent() {
|
513
|
+
options.element.each( function( _, element ) {
|
514
|
+
var isTracked = $.map( that.classesElementLookup, function( elements ) {
|
515
|
+
return elements;
|
516
|
+
} )
|
517
|
+
.some( function( elements ) {
|
518
|
+
return elements.is( element );
|
519
|
+
} );
|
520
|
+
|
521
|
+
if ( !isTracked ) {
|
522
|
+
that._on( $( element ), {
|
523
|
+
remove: "_untrackClassesElement"
|
524
|
+
} );
|
525
|
+
}
|
526
|
+
} );
|
527
|
+
}
|
528
|
+
|
529
|
+
function processClassString( classes, checkOption ) {
|
530
|
+
var current, i;
|
531
|
+
for ( i = 0; i < classes.length; i++ ) {
|
532
|
+
current = that.classesElementLookup[ classes[ i ] ] || $();
|
533
|
+
if ( options.add ) {
|
534
|
+
bindRemoveEvent();
|
535
|
+
current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
|
536
|
+
} else {
|
537
|
+
current = $( current.not( options.element ).get() );
|
538
|
+
}
|
539
|
+
that.classesElementLookup[ classes[ i ] ] = current;
|
540
|
+
full.push( classes[ i ] );
|
541
|
+
if ( checkOption && options.classes[ classes[ i ] ] ) {
|
542
|
+
full.push( options.classes[ classes[ i ] ] );
|
543
|
+
}
|
544
|
+
}
|
545
|
+
}
|
546
|
+
|
547
|
+
if ( options.keys ) {
|
548
|
+
processClassString( options.keys.match( /\S+/g ) || [], true );
|
549
|
+
}
|
550
|
+
if ( options.extra ) {
|
551
|
+
processClassString( options.extra.match( /\S+/g ) || [] );
|
552
|
+
}
|
553
|
+
|
554
|
+
return full.join( " " );
|
555
|
+
},
|
556
|
+
|
557
|
+
_untrackClassesElement: function( event ) {
|
558
|
+
var that = this;
|
559
|
+
$.each( that.classesElementLookup, function( key, value ) {
|
560
|
+
if ( $.inArray( event.target, value ) !== -1 ) {
|
561
|
+
that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
|
562
|
+
}
|
563
|
+
} );
|
564
|
+
|
565
|
+
this._off( $( event.target ) );
|
566
|
+
},
|
567
|
+
|
568
|
+
_removeClass: function( element, keys, extra ) {
|
569
|
+
return this._toggleClass( element, keys, extra, false );
|
570
|
+
},
|
571
|
+
|
572
|
+
_addClass: function( element, keys, extra ) {
|
573
|
+
return this._toggleClass( element, keys, extra, true );
|
574
|
+
},
|
575
|
+
|
576
|
+
_toggleClass: function( element, keys, extra, add ) {
|
577
|
+
add = ( typeof add === "boolean" ) ? add : extra;
|
578
|
+
var shift = ( typeof element === "string" || element === null ),
|
579
|
+
options = {
|
580
|
+
extra: shift ? keys : extra,
|
581
|
+
keys: shift ? element : keys,
|
582
|
+
element: shift ? this.element : element,
|
583
|
+
add: add
|
584
|
+
};
|
585
|
+
options.element.toggleClass( this._classes( options ), add );
|
586
|
+
return this;
|
587
|
+
},
|
588
|
+
|
589
|
+
_on: function( suppressDisabledCheck, element, handlers ) {
|
590
|
+
var delegateElement;
|
591
|
+
var instance = this;
|
592
|
+
|
593
|
+
// No suppressDisabledCheck flag, shuffle arguments
|
594
|
+
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
595
|
+
handlers = element;
|
596
|
+
element = suppressDisabledCheck;
|
597
|
+
suppressDisabledCheck = false;
|
598
|
+
}
|
599
|
+
|
600
|
+
// No element argument, shuffle and use this.element
|
601
|
+
if ( !handlers ) {
|
602
|
+
handlers = element;
|
603
|
+
element = this.element;
|
604
|
+
delegateElement = this.widget();
|
605
|
+
} else {
|
606
|
+
element = delegateElement = $( element );
|
607
|
+
this.bindings = this.bindings.add( element );
|
608
|
+
}
|
609
|
+
|
610
|
+
$.each( handlers, function( event, handler ) {
|
611
|
+
function handlerProxy() {
|
612
|
+
|
613
|
+
// Allow widgets to customize the disabled handling
|
614
|
+
// - disabled as an array instead of boolean
|
615
|
+
// - disabled class as method for disabling individual parts
|
616
|
+
if ( !suppressDisabledCheck &&
|
617
|
+
( instance.options.disabled === true ||
|
618
|
+
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
619
|
+
return;
|
620
|
+
}
|
621
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
622
|
+
.apply( instance, arguments );
|
623
|
+
}
|
624
|
+
|
625
|
+
// Copy the guid so direct unbinding works
|
626
|
+
if ( typeof handler !== "string" ) {
|
627
|
+
handlerProxy.guid = handler.guid =
|
628
|
+
handler.guid || handlerProxy.guid || $.guid++;
|
629
|
+
}
|
630
|
+
|
631
|
+
var match = event.match( /^([\w:-]*)\s*(.*)$/ );
|
632
|
+
var eventName = match[ 1 ] + instance.eventNamespace;
|
633
|
+
var selector = match[ 2 ];
|
634
|
+
|
635
|
+
if ( selector ) {
|
636
|
+
delegateElement.on( eventName, selector, handlerProxy );
|
637
|
+
} else {
|
638
|
+
element.on( eventName, handlerProxy );
|
639
|
+
}
|
640
|
+
} );
|
641
|
+
},
|
642
|
+
|
643
|
+
_off: function( element, eventName ) {
|
644
|
+
eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
|
645
|
+
this.eventNamespace;
|
646
|
+
element.off( eventName );
|
647
|
+
|
648
|
+
// Clear the stack to avoid memory leaks (#10056)
|
649
|
+
this.bindings = $( this.bindings.not( element ).get() );
|
650
|
+
this.focusable = $( this.focusable.not( element ).get() );
|
651
|
+
this.hoverable = $( this.hoverable.not( element ).get() );
|
652
|
+
},
|
653
|
+
|
654
|
+
_delay: function( handler, delay ) {
|
655
|
+
function handlerProxy() {
|
656
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
657
|
+
.apply( instance, arguments );
|
658
|
+
}
|
659
|
+
var instance = this;
|
660
|
+
return setTimeout( handlerProxy, delay || 0 );
|
661
|
+
},
|
662
|
+
|
663
|
+
_hoverable: function( element ) {
|
664
|
+
this.hoverable = this.hoverable.add( element );
|
665
|
+
this._on( element, {
|
666
|
+
mouseenter: function( event ) {
|
667
|
+
this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
|
668
|
+
},
|
669
|
+
mouseleave: function( event ) {
|
670
|
+
this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
|
671
|
+
}
|
672
|
+
} );
|
673
|
+
},
|
674
|
+
|
675
|
+
_focusable: function( element ) {
|
676
|
+
this.focusable = this.focusable.add( element );
|
677
|
+
this._on( element, {
|
678
|
+
focusin: function( event ) {
|
679
|
+
this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
|
680
|
+
},
|
681
|
+
focusout: function( event ) {
|
682
|
+
this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
|
683
|
+
}
|
684
|
+
} );
|
685
|
+
},
|
686
|
+
|
687
|
+
_trigger: function( type, event, data ) {
|
688
|
+
var prop, orig;
|
689
|
+
var callback = this.options[ type ];
|
690
|
+
|
691
|
+
data = data || {};
|
692
|
+
event = $.Event( event );
|
693
|
+
event.type = ( type === this.widgetEventPrefix ?
|
694
|
+
type :
|
695
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
696
|
+
|
697
|
+
// The original event may come from any element
|
698
|
+
// so we need to reset the target on the new event
|
699
|
+
event.target = this.element[ 0 ];
|
700
|
+
|
701
|
+
// Copy original event properties over to the new event
|
702
|
+
orig = event.originalEvent;
|
703
|
+
if ( orig ) {
|
704
|
+
for ( prop in orig ) {
|
705
|
+
if ( !( prop in event ) ) {
|
706
|
+
event[ prop ] = orig[ prop ];
|
707
|
+
}
|
708
|
+
}
|
709
|
+
}
|
710
|
+
|
711
|
+
this.element.trigger( event, data );
|
712
|
+
return !( typeof callback === "function" &&
|
713
|
+
callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
|
714
|
+
event.isDefaultPrevented() );
|
715
|
+
}
|
716
|
+
};
|
717
|
+
|
718
|
+
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
719
|
+
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
720
|
+
if ( typeof options === "string" ) {
|
721
|
+
options = { effect: options };
|
722
|
+
}
|
723
|
+
|
724
|
+
var hasOptions;
|
725
|
+
var effectName = !options ?
|
726
|
+
method :
|
727
|
+
options === true || typeof options === "number" ?
|
728
|
+
defaultEffect :
|
729
|
+
options.effect || defaultEffect;
|
730
|
+
|
731
|
+
options = options || {};
|
732
|
+
if ( typeof options === "number" ) {
|
733
|
+
options = { duration: options };
|
734
|
+
} else if ( options === true ) {
|
735
|
+
options = {};
|
736
|
+
}
|
737
|
+
|
738
|
+
hasOptions = !$.isEmptyObject( options );
|
739
|
+
options.complete = callback;
|
740
|
+
|
741
|
+
if ( options.delay ) {
|
742
|
+
element.delay( options.delay );
|
743
|
+
}
|
744
|
+
|
745
|
+
if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
|
746
|
+
element[ method ]( options );
|
747
|
+
} else if ( effectName !== method && element[ effectName ] ) {
|
748
|
+
element[ effectName ]( options.duration, options.easing, callback );
|
749
|
+
} else {
|
750
|
+
element.queue( function( next ) {
|
751
|
+
$( this )[ method ]();
|
752
|
+
if ( callback ) {
|
753
|
+
callback.call( element[ 0 ] );
|
754
|
+
}
|
755
|
+
next();
|
756
|
+
} );
|
757
|
+
}
|
758
|
+
};
|
759
|
+
} );
|
760
|
+
|
761
|
+
var widget = $.widget;
|
762
|
+
|
763
|
+
|
764
|
+
/*!
|
765
|
+
* jQuery UI Position 1.13.0
|
766
|
+
* http://jqueryui.com
|
767
|
+
*
|
768
|
+
* Copyright jQuery Foundation and other contributors
|
769
|
+
* Released under the MIT license.
|
770
|
+
* http://jquery.org/license
|
771
|
+
*
|
772
|
+
* http://api.jqueryui.com/position/
|
773
|
+
*/
|
774
|
+
|
775
|
+
//>>label: Position
|
776
|
+
//>>group: Core
|
777
|
+
//>>description: Positions elements relative to other elements.
|
778
|
+
//>>docs: http://api.jqueryui.com/position/
|
779
|
+
//>>demos: http://jqueryui.com/position/
|
780
|
+
|
781
|
+
|
782
|
+
( function() {
|
783
|
+
var cachedScrollbarWidth,
|
784
|
+
max = Math.max,
|
785
|
+
abs = Math.abs,
|
786
|
+
rhorizontal = /left|center|right/,
|
787
|
+
rvertical = /top|center|bottom/,
|
788
|
+
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
|
789
|
+
rposition = /^\w+/,
|
790
|
+
rpercent = /%$/,
|
791
|
+
_position = $.fn.position;
|
792
|
+
|
793
|
+
function getOffsets( offsets, width, height ) {
|
794
|
+
return [
|
795
|
+
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
|
796
|
+
parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
|
797
|
+
];
|
798
|
+
}
|
799
|
+
|
800
|
+
function parseCss( element, property ) {
|
801
|
+
return parseInt( $.css( element, property ), 10 ) || 0;
|
802
|
+
}
|
803
|
+
|
804
|
+
function isWindow( obj ) {
|
805
|
+
return obj != null && obj === obj.window;
|
806
|
+
}
|
807
|
+
|
808
|
+
function getDimensions( elem ) {
|
809
|
+
var raw = elem[ 0 ];
|
810
|
+
if ( raw.nodeType === 9 ) {
|
811
|
+
return {
|
812
|
+
width: elem.width(),
|
813
|
+
height: elem.height(),
|
814
|
+
offset: { top: 0, left: 0 }
|
815
|
+
};
|
816
|
+
}
|
817
|
+
if ( isWindow( raw ) ) {
|
818
|
+
return {
|
819
|
+
width: elem.width(),
|
820
|
+
height: elem.height(),
|
821
|
+
offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
|
822
|
+
};
|
823
|
+
}
|
824
|
+
if ( raw.preventDefault ) {
|
825
|
+
return {
|
826
|
+
width: 0,
|
827
|
+
height: 0,
|
828
|
+
offset: { top: raw.pageY, left: raw.pageX }
|
829
|
+
};
|
830
|
+
}
|
831
|
+
return {
|
832
|
+
width: elem.outerWidth(),
|
833
|
+
height: elem.outerHeight(),
|
834
|
+
offset: elem.offset()
|
835
|
+
};
|
836
|
+
}
|
837
|
+
|
838
|
+
$.position = {
|
839
|
+
scrollbarWidth: function() {
|
840
|
+
if ( cachedScrollbarWidth !== undefined ) {
|
841
|
+
return cachedScrollbarWidth;
|
842
|
+
}
|
843
|
+
var w1, w2,
|
844
|
+
div = $( "<div style=" +
|
845
|
+
"'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
|
846
|
+
"<div style='height:300px;width:auto;'></div></div>" ),
|
847
|
+
innerDiv = div.children()[ 0 ];
|
848
|
+
|
849
|
+
$( "body" ).append( div );
|
850
|
+
w1 = innerDiv.offsetWidth;
|
851
|
+
div.css( "overflow", "scroll" );
|
852
|
+
|
853
|
+
w2 = innerDiv.offsetWidth;
|
854
|
+
|
855
|
+
if ( w1 === w2 ) {
|
856
|
+
w2 = div[ 0 ].clientWidth;
|
857
|
+
}
|
858
|
+
|
859
|
+
div.remove();
|
860
|
+
|
861
|
+
return ( cachedScrollbarWidth = w1 - w2 );
|
862
|
+
},
|
863
|
+
getScrollInfo: function( within ) {
|
864
|
+
var overflowX = within.isWindow || within.isDocument ? "" :
|
865
|
+
within.element.css( "overflow-x" ),
|
866
|
+
overflowY = within.isWindow || within.isDocument ? "" :
|
867
|
+
within.element.css( "overflow-y" ),
|
868
|
+
hasOverflowX = overflowX === "scroll" ||
|
869
|
+
( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
|
870
|
+
hasOverflowY = overflowY === "scroll" ||
|
871
|
+
( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
|
872
|
+
return {
|
873
|
+
width: hasOverflowY ? $.position.scrollbarWidth() : 0,
|
874
|
+
height: hasOverflowX ? $.position.scrollbarWidth() : 0
|
875
|
+
};
|
876
|
+
},
|
877
|
+
getWithinInfo: function( element ) {
|
878
|
+
var withinElement = $( element || window ),
|
879
|
+
isElemWindow = isWindow( withinElement[ 0 ] ),
|
880
|
+
isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
|
881
|
+
hasOffset = !isElemWindow && !isDocument;
|
882
|
+
return {
|
883
|
+
element: withinElement,
|
884
|
+
isWindow: isElemWindow,
|
885
|
+
isDocument: isDocument,
|
886
|
+
offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
|
887
|
+
scrollLeft: withinElement.scrollLeft(),
|
888
|
+
scrollTop: withinElement.scrollTop(),
|
889
|
+
width: withinElement.outerWidth(),
|
890
|
+
height: withinElement.outerHeight()
|
891
|
+
};
|
892
|
+
}
|
893
|
+
};
|
894
|
+
|
895
|
+
$.fn.position = function( options ) {
|
896
|
+
if ( !options || !options.of ) {
|
897
|
+
return _position.apply( this, arguments );
|
898
|
+
}
|
899
|
+
|
900
|
+
// Make a copy, we don't want to modify arguments
|
901
|
+
options = $.extend( {}, options );
|
902
|
+
|
903
|
+
var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
|
904
|
+
|
905
|
+
// Make sure string options are treated as CSS selectors
|
906
|
+
target = typeof options.of === "string" ?
|
907
|
+
$( document ).find( options.of ) :
|
908
|
+
$( options.of ),
|
909
|
+
|
910
|
+
within = $.position.getWithinInfo( options.within ),
|
911
|
+
scrollInfo = $.position.getScrollInfo( within ),
|
912
|
+
collision = ( options.collision || "flip" ).split( " " ),
|
913
|
+
offsets = {};
|
914
|
+
|
915
|
+
dimensions = getDimensions( target );
|
916
|
+
if ( target[ 0 ].preventDefault ) {
|
917
|
+
|
918
|
+
// Force left top to allow flipping
|
919
|
+
options.at = "left top";
|
920
|
+
}
|
921
|
+
targetWidth = dimensions.width;
|
922
|
+
targetHeight = dimensions.height;
|
923
|
+
targetOffset = dimensions.offset;
|
924
|
+
|
925
|
+
// Clone to reuse original targetOffset later
|
926
|
+
basePosition = $.extend( {}, targetOffset );
|
927
|
+
|
928
|
+
// Force my and at to have valid horizontal and vertical positions
|
929
|
+
// if a value is missing or invalid, it will be converted to center
|
930
|
+
$.each( [ "my", "at" ], function() {
|
931
|
+
var pos = ( options[ this ] || "" ).split( " " ),
|
932
|
+
horizontalOffset,
|
933
|
+
verticalOffset;
|
934
|
+
|
935
|
+
if ( pos.length === 1 ) {
|
936
|
+
pos = rhorizontal.test( pos[ 0 ] ) ?
|
937
|
+
pos.concat( [ "center" ] ) :
|
938
|
+
rvertical.test( pos[ 0 ] ) ?
|
939
|
+
[ "center" ].concat( pos ) :
|
940
|
+
[ "center", "center" ];
|
941
|
+
}
|
942
|
+
pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
|
943
|
+
pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
|
944
|
+
|
945
|
+
// Calculate offsets
|
946
|
+
horizontalOffset = roffset.exec( pos[ 0 ] );
|
947
|
+
verticalOffset = roffset.exec( pos[ 1 ] );
|
948
|
+
offsets[ this ] = [
|
949
|
+
horizontalOffset ? horizontalOffset[ 0 ] : 0,
|
950
|
+
verticalOffset ? verticalOffset[ 0 ] : 0
|
951
|
+
];
|
952
|
+
|
953
|
+
// Reduce to just the positions without the offsets
|
954
|
+
options[ this ] = [
|
955
|
+
rposition.exec( pos[ 0 ] )[ 0 ],
|
956
|
+
rposition.exec( pos[ 1 ] )[ 0 ]
|
957
|
+
];
|
958
|
+
} );
|
959
|
+
|
960
|
+
// Normalize collision option
|
961
|
+
if ( collision.length === 1 ) {
|
962
|
+
collision[ 1 ] = collision[ 0 ];
|
963
|
+
}
|
964
|
+
|
965
|
+
if ( options.at[ 0 ] === "right" ) {
|
966
|
+
basePosition.left += targetWidth;
|
967
|
+
} else if ( options.at[ 0 ] === "center" ) {
|
968
|
+
basePosition.left += targetWidth / 2;
|
969
|
+
}
|
970
|
+
|
971
|
+
if ( options.at[ 1 ] === "bottom" ) {
|
972
|
+
basePosition.top += targetHeight;
|
973
|
+
} else if ( options.at[ 1 ] === "center" ) {
|
974
|
+
basePosition.top += targetHeight / 2;
|
975
|
+
}
|
976
|
+
|
977
|
+
atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
|
978
|
+
basePosition.left += atOffset[ 0 ];
|
979
|
+
basePosition.top += atOffset[ 1 ];
|
980
|
+
|
981
|
+
return this.each( function() {
|
982
|
+
var collisionPosition, using,
|
983
|
+
elem = $( this ),
|
984
|
+
elemWidth = elem.outerWidth(),
|
985
|
+
elemHeight = elem.outerHeight(),
|
986
|
+
marginLeft = parseCss( this, "marginLeft" ),
|
987
|
+
marginTop = parseCss( this, "marginTop" ),
|
988
|
+
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
|
989
|
+
scrollInfo.width,
|
990
|
+
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
|
991
|
+
scrollInfo.height,
|
992
|
+
position = $.extend( {}, basePosition ),
|
993
|
+
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
|
994
|
+
|
995
|
+
if ( options.my[ 0 ] === "right" ) {
|
996
|
+
position.left -= elemWidth;
|
997
|
+
} else if ( options.my[ 0 ] === "center" ) {
|
998
|
+
position.left -= elemWidth / 2;
|
999
|
+
}
|
1000
|
+
|
1001
|
+
if ( options.my[ 1 ] === "bottom" ) {
|
1002
|
+
position.top -= elemHeight;
|
1003
|
+
} else if ( options.my[ 1 ] === "center" ) {
|
1004
|
+
position.top -= elemHeight / 2;
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
position.left += myOffset[ 0 ];
|
1008
|
+
position.top += myOffset[ 1 ];
|
1009
|
+
|
1010
|
+
collisionPosition = {
|
1011
|
+
marginLeft: marginLeft,
|
1012
|
+
marginTop: marginTop
|
1013
|
+
};
|
1014
|
+
|
1015
|
+
$.each( [ "left", "top" ], function( i, dir ) {
|
1016
|
+
if ( $.ui.position[ collision[ i ] ] ) {
|
1017
|
+
$.ui.position[ collision[ i ] ][ dir ]( position, {
|
1018
|
+
targetWidth: targetWidth,
|
1019
|
+
targetHeight: targetHeight,
|
1020
|
+
elemWidth: elemWidth,
|
1021
|
+
elemHeight: elemHeight,
|
1022
|
+
collisionPosition: collisionPosition,
|
1023
|
+
collisionWidth: collisionWidth,
|
1024
|
+
collisionHeight: collisionHeight,
|
1025
|
+
offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
|
1026
|
+
my: options.my,
|
1027
|
+
at: options.at,
|
1028
|
+
within: within,
|
1029
|
+
elem: elem
|
1030
|
+
} );
|
1031
|
+
}
|
1032
|
+
} );
|
1033
|
+
|
1034
|
+
if ( options.using ) {
|
1035
|
+
|
1036
|
+
// Adds feedback as second argument to using callback, if present
|
1037
|
+
using = function( props ) {
|
1038
|
+
var left = targetOffset.left - position.left,
|
1039
|
+
right = left + targetWidth - elemWidth,
|
1040
|
+
top = targetOffset.top - position.top,
|
1041
|
+
bottom = top + targetHeight - elemHeight,
|
1042
|
+
feedback = {
|
1043
|
+
target: {
|
1044
|
+
element: target,
|
1045
|
+
left: targetOffset.left,
|
1046
|
+
top: targetOffset.top,
|
1047
|
+
width: targetWidth,
|
1048
|
+
height: targetHeight
|
1049
|
+
},
|
1050
|
+
element: {
|
1051
|
+
element: elem,
|
1052
|
+
left: position.left,
|
1053
|
+
top: position.top,
|
1054
|
+
width: elemWidth,
|
1055
|
+
height: elemHeight
|
1056
|
+
},
|
1057
|
+
horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
|
1058
|
+
vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
|
1059
|
+
};
|
1060
|
+
if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
|
1061
|
+
feedback.horizontal = "center";
|
1062
|
+
}
|
1063
|
+
if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
|
1064
|
+
feedback.vertical = "middle";
|
1065
|
+
}
|
1066
|
+
if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
|
1067
|
+
feedback.important = "horizontal";
|
1068
|
+
} else {
|
1069
|
+
feedback.important = "vertical";
|
1070
|
+
}
|
1071
|
+
options.using.call( this, props, feedback );
|
1072
|
+
};
|
1073
|
+
}
|
1074
|
+
|
1075
|
+
elem.offset( $.extend( position, { using: using } ) );
|
1076
|
+
} );
|
1077
|
+
};
|
1078
|
+
|
1079
|
+
$.ui.position = {
|
1080
|
+
fit: {
|
1081
|
+
left: function( position, data ) {
|
1082
|
+
var within = data.within,
|
1083
|
+
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
|
1084
|
+
outerWidth = within.width,
|
1085
|
+
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
|
1086
|
+
overLeft = withinOffset - collisionPosLeft,
|
1087
|
+
overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
|
1088
|
+
newOverRight;
|
1089
|
+
|
1090
|
+
// Element is wider than within
|
1091
|
+
if ( data.collisionWidth > outerWidth ) {
|
1092
|
+
|
1093
|
+
// Element is initially over the left side of within
|
1094
|
+
if ( overLeft > 0 && overRight <= 0 ) {
|
1095
|
+
newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
|
1096
|
+
withinOffset;
|
1097
|
+
position.left += overLeft - newOverRight;
|
1098
|
+
|
1099
|
+
// Element is initially over right side of within
|
1100
|
+
} else if ( overRight > 0 && overLeft <= 0 ) {
|
1101
|
+
position.left = withinOffset;
|
1102
|
+
|
1103
|
+
// Element is initially over both left and right sides of within
|
1104
|
+
} else {
|
1105
|
+
if ( overLeft > overRight ) {
|
1106
|
+
position.left = withinOffset + outerWidth - data.collisionWidth;
|
1107
|
+
} else {
|
1108
|
+
position.left = withinOffset;
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
// Too far left -> align with left edge
|
1113
|
+
} else if ( overLeft > 0 ) {
|
1114
|
+
position.left += overLeft;
|
1115
|
+
|
1116
|
+
// Too far right -> align with right edge
|
1117
|
+
} else if ( overRight > 0 ) {
|
1118
|
+
position.left -= overRight;
|
1119
|
+
|
1120
|
+
// Adjust based on position and margin
|
1121
|
+
} else {
|
1122
|
+
position.left = max( position.left - collisionPosLeft, position.left );
|
1123
|
+
}
|
1124
|
+
},
|
1125
|
+
top: function( position, data ) {
|
1126
|
+
var within = data.within,
|
1127
|
+
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
|
1128
|
+
outerHeight = data.within.height,
|
1129
|
+
collisionPosTop = position.top - data.collisionPosition.marginTop,
|
1130
|
+
overTop = withinOffset - collisionPosTop,
|
1131
|
+
overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
|
1132
|
+
newOverBottom;
|
1133
|
+
|
1134
|
+
// Element is taller than within
|
1135
|
+
if ( data.collisionHeight > outerHeight ) {
|
1136
|
+
|
1137
|
+
// Element is initially over the top of within
|
1138
|
+
if ( overTop > 0 && overBottom <= 0 ) {
|
1139
|
+
newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
|
1140
|
+
withinOffset;
|
1141
|
+
position.top += overTop - newOverBottom;
|
1142
|
+
|
1143
|
+
// Element is initially over bottom of within
|
1144
|
+
} else if ( overBottom > 0 && overTop <= 0 ) {
|
1145
|
+
position.top = withinOffset;
|
1146
|
+
|
1147
|
+
// Element is initially over both top and bottom of within
|
1148
|
+
} else {
|
1149
|
+
if ( overTop > overBottom ) {
|
1150
|
+
position.top = withinOffset + outerHeight - data.collisionHeight;
|
1151
|
+
} else {
|
1152
|
+
position.top = withinOffset;
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
// Too far up -> align with top
|
1157
|
+
} else if ( overTop > 0 ) {
|
1158
|
+
position.top += overTop;
|
1159
|
+
|
1160
|
+
// Too far down -> align with bottom edge
|
1161
|
+
} else if ( overBottom > 0 ) {
|
1162
|
+
position.top -= overBottom;
|
1163
|
+
|
1164
|
+
// Adjust based on position and margin
|
1165
|
+
} else {
|
1166
|
+
position.top = max( position.top - collisionPosTop, position.top );
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
},
|
1170
|
+
flip: {
|
1171
|
+
left: function( position, data ) {
|
1172
|
+
var within = data.within,
|
1173
|
+
withinOffset = within.offset.left + within.scrollLeft,
|
1174
|
+
outerWidth = within.width,
|
1175
|
+
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
|
1176
|
+
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
|
1177
|
+
overLeft = collisionPosLeft - offsetLeft,
|
1178
|
+
overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
|
1179
|
+
myOffset = data.my[ 0 ] === "left" ?
|
1180
|
+
-data.elemWidth :
|
1181
|
+
data.my[ 0 ] === "right" ?
|
1182
|
+
data.elemWidth :
|
1183
|
+
0,
|
1184
|
+
atOffset = data.at[ 0 ] === "left" ?
|
1185
|
+
data.targetWidth :
|
1186
|
+
data.at[ 0 ] === "right" ?
|
1187
|
+
-data.targetWidth :
|
1188
|
+
0,
|
1189
|
+
offset = -2 * data.offset[ 0 ],
|
1190
|
+
newOverRight,
|
1191
|
+
newOverLeft;
|
1192
|
+
|
1193
|
+
if ( overLeft < 0 ) {
|
1194
|
+
newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
|
1195
|
+
outerWidth - withinOffset;
|
1196
|
+
if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
|
1197
|
+
position.left += myOffset + atOffset + offset;
|
1198
|
+
}
|
1199
|
+
} else if ( overRight > 0 ) {
|
1200
|
+
newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
|
1201
|
+
atOffset + offset - offsetLeft;
|
1202
|
+
if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
|
1203
|
+
position.left += myOffset + atOffset + offset;
|
1204
|
+
}
|
1205
|
+
}
|
1206
|
+
},
|
1207
|
+
top: function( position, data ) {
|
1208
|
+
var within = data.within,
|
1209
|
+
withinOffset = within.offset.top + within.scrollTop,
|
1210
|
+
outerHeight = within.height,
|
1211
|
+
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
|
1212
|
+
collisionPosTop = position.top - data.collisionPosition.marginTop,
|
1213
|
+
overTop = collisionPosTop - offsetTop,
|
1214
|
+
overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
|
1215
|
+
top = data.my[ 1 ] === "top",
|
1216
|
+
myOffset = top ?
|
1217
|
+
-data.elemHeight :
|
1218
|
+
data.my[ 1 ] === "bottom" ?
|
1219
|
+
data.elemHeight :
|
1220
|
+
0,
|
1221
|
+
atOffset = data.at[ 1 ] === "top" ?
|
1222
|
+
data.targetHeight :
|
1223
|
+
data.at[ 1 ] === "bottom" ?
|
1224
|
+
-data.targetHeight :
|
1225
|
+
0,
|
1226
|
+
offset = -2 * data.offset[ 1 ],
|
1227
|
+
newOverTop,
|
1228
|
+
newOverBottom;
|
1229
|
+
if ( overTop < 0 ) {
|
1230
|
+
newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
|
1231
|
+
outerHeight - withinOffset;
|
1232
|
+
if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
|
1233
|
+
position.top += myOffset + atOffset + offset;
|
1234
|
+
}
|
1235
|
+
} else if ( overBottom > 0 ) {
|
1236
|
+
newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
|
1237
|
+
offset - offsetTop;
|
1238
|
+
if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
|
1239
|
+
position.top += myOffset + atOffset + offset;
|
1240
|
+
}
|
1241
|
+
}
|
1242
|
+
}
|
1243
|
+
},
|
1244
|
+
flipfit: {
|
1245
|
+
left: function() {
|
1246
|
+
$.ui.position.flip.left.apply( this, arguments );
|
1247
|
+
$.ui.position.fit.left.apply( this, arguments );
|
1248
|
+
},
|
1249
|
+
top: function() {
|
1250
|
+
$.ui.position.flip.top.apply( this, arguments );
|
1251
|
+
$.ui.position.fit.top.apply( this, arguments );
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
};
|
1255
|
+
|
1256
|
+
} )();
|
1257
|
+
|
1258
|
+
var position = $.ui.position;
|
1259
|
+
|
1260
|
+
|
1261
|
+
/*!
|
1262
|
+
* jQuery UI Keycode 1.13.0
|
1263
|
+
* http://jqueryui.com
|
1264
|
+
*
|
1265
|
+
* Copyright jQuery Foundation and other contributors
|
1266
|
+
* Released under the MIT license.
|
1267
|
+
* http://jquery.org/license
|
1268
|
+
*/
|
1269
|
+
|
1270
|
+
//>>label: Keycode
|
1271
|
+
//>>group: Core
|
1272
|
+
//>>description: Provide keycodes as keynames
|
1273
|
+
//>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
|
1274
|
+
|
1275
|
+
|
1276
|
+
var keycode = $.ui.keyCode = {
|
1277
|
+
BACKSPACE: 8,
|
1278
|
+
COMMA: 188,
|
1279
|
+
DELETE: 46,
|
1280
|
+
DOWN: 40,
|
1281
|
+
END: 35,
|
1282
|
+
ENTER: 13,
|
1283
|
+
ESCAPE: 27,
|
1284
|
+
HOME: 36,
|
1285
|
+
LEFT: 37,
|
1286
|
+
PAGE_DOWN: 34,
|
1287
|
+
PAGE_UP: 33,
|
1288
|
+
PERIOD: 190,
|
1289
|
+
RIGHT: 39,
|
1290
|
+
SPACE: 32,
|
1291
|
+
TAB: 9,
|
1292
|
+
UP: 38
|
1293
|
+
};
|
1294
|
+
|
1295
|
+
|
1296
|
+
/*!
|
1297
|
+
* jQuery UI Unique ID 1.13.0
|
1298
|
+
* http://jqueryui.com
|
1299
|
+
*
|
1300
|
+
* Copyright jQuery Foundation and other contributors
|
1301
|
+
* Released under the MIT license.
|
1302
|
+
* http://jquery.org/license
|
1303
|
+
*/
|
1304
|
+
|
1305
|
+
//>>label: uniqueId
|
1306
|
+
//>>group: Core
|
1307
|
+
//>>description: Functions to generate and remove uniqueId's
|
1308
|
+
//>>docs: http://api.jqueryui.com/uniqueId/
|
1309
|
+
|
1310
|
+
|
1311
|
+
var uniqueId = $.fn.extend( {
|
1312
|
+
uniqueId: ( function() {
|
1313
|
+
var uuid = 0;
|
1314
|
+
|
1315
|
+
return function() {
|
1316
|
+
return this.each( function() {
|
1317
|
+
if ( !this.id ) {
|
1318
|
+
this.id = "ui-id-" + ( ++uuid );
|
1319
|
+
}
|
1320
|
+
} );
|
1321
|
+
};
|
1322
|
+
} )(),
|
1323
|
+
|
1324
|
+
removeUniqueId: function() {
|
1325
|
+
return this.each( function() {
|
1326
|
+
if ( /^ui-id-\d+$/.test( this.id ) ) {
|
1327
|
+
$( this ).removeAttr( "id" );
|
1328
|
+
}
|
1329
|
+
} );
|
1330
|
+
}
|
1331
|
+
} );
|
1332
|
+
|
1333
|
+
|
1334
|
+
/*!
|
1335
|
+
* jQuery UI Tooltip 1.13.0
|
1336
|
+
* http://jqueryui.com
|
1337
|
+
*
|
1338
|
+
* Copyright jQuery Foundation and other contributors
|
1339
|
+
* Released under the MIT license.
|
1340
|
+
* http://jquery.org/license
|
1341
|
+
*/
|
1342
|
+
|
1343
|
+
//>>label: Tooltip
|
1344
|
+
//>>group: Widgets
|
1345
|
+
//>>description: Shows additional information for any element on hover or focus.
|
1346
|
+
//>>docs: http://api.jqueryui.com/tooltip/
|
1347
|
+
//>>demos: http://jqueryui.com/tooltip/
|
1348
|
+
//>>css.structure: ../../themes/base/core.css
|
1349
|
+
//>>css.structure: ../../themes/base/tooltip.css
|
1350
|
+
//>>css.theme: ../../themes/base/theme.css
|
1351
|
+
|
1352
|
+
|
1353
|
+
$.widget( "ui.tooltip", {
|
1354
|
+
version: "1.13.0",
|
1355
|
+
options: {
|
1356
|
+
classes: {
|
1357
|
+
"ui-tooltip": "ui-corner-all ui-widget-shadow"
|
1358
|
+
},
|
1359
|
+
content: function() {
|
1360
|
+
var title = $( this ).attr( "title" );
|
1361
|
+
|
1362
|
+
// Escape title, since we're going from an attribute to raw HTML
|
1363
|
+
return $( "<a>" ).text( title ).html();
|
1364
|
+
},
|
1365
|
+
hide: true,
|
1366
|
+
|
1367
|
+
// Disabled elements have inconsistent behavior across browsers (#8661)
|
1368
|
+
items: "[title]:not([disabled])",
|
1369
|
+
position: {
|
1370
|
+
my: "left top+15",
|
1371
|
+
at: "left bottom",
|
1372
|
+
collision: "flipfit flip"
|
1373
|
+
},
|
1374
|
+
show: true,
|
1375
|
+
track: false,
|
1376
|
+
|
1377
|
+
// Callbacks
|
1378
|
+
close: null,
|
1379
|
+
open: null
|
1380
|
+
},
|
1381
|
+
|
1382
|
+
_addDescribedBy: function( elem, id ) {
|
1383
|
+
var describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ );
|
1384
|
+
describedby.push( id );
|
1385
|
+
elem
|
1386
|
+
.data( "ui-tooltip-id", id )
|
1387
|
+
.attr( "aria-describedby", String.prototype.trim.call( describedby.join( " " ) ) );
|
1388
|
+
},
|
1389
|
+
|
1390
|
+
_removeDescribedBy: function( elem ) {
|
1391
|
+
var id = elem.data( "ui-tooltip-id" ),
|
1392
|
+
describedby = ( elem.attr( "aria-describedby" ) || "" ).split( /\s+/ ),
|
1393
|
+
index = $.inArray( id, describedby );
|
1394
|
+
|
1395
|
+
if ( index !== -1 ) {
|
1396
|
+
describedby.splice( index, 1 );
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
elem.removeData( "ui-tooltip-id" );
|
1400
|
+
describedby = String.prototype.trim.call( describedby.join( " " ) );
|
1401
|
+
if ( describedby ) {
|
1402
|
+
elem.attr( "aria-describedby", describedby );
|
1403
|
+
} else {
|
1404
|
+
elem.removeAttr( "aria-describedby" );
|
1405
|
+
}
|
1406
|
+
},
|
1407
|
+
|
1408
|
+
_create: function() {
|
1409
|
+
this._on( {
|
1410
|
+
mouseover: "open",
|
1411
|
+
focusin: "open"
|
1412
|
+
} );
|
1413
|
+
|
1414
|
+
// IDs of generated tooltips, needed for destroy
|
1415
|
+
this.tooltips = {};
|
1416
|
+
|
1417
|
+
// IDs of parent tooltips where we removed the title attribute
|
1418
|
+
this.parents = {};
|
1419
|
+
|
1420
|
+
// Append the aria-live region so tooltips announce correctly
|
1421
|
+
this.liveRegion = $( "<div>" )
|
1422
|
+
.attr( {
|
1423
|
+
role: "log",
|
1424
|
+
"aria-live": "assertive",
|
1425
|
+
"aria-relevant": "additions"
|
1426
|
+
} )
|
1427
|
+
.appendTo( this.document[ 0 ].body );
|
1428
|
+
this._addClass( this.liveRegion, null, "ui-helper-hidden-accessible" );
|
1429
|
+
|
1430
|
+
this.disabledTitles = $( [] );
|
1431
|
+
},
|
1432
|
+
|
1433
|
+
_setOption: function( key, value ) {
|
1434
|
+
var that = this;
|
1435
|
+
|
1436
|
+
this._super( key, value );
|
1437
|
+
|
1438
|
+
if ( key === "content" ) {
|
1439
|
+
$.each( this.tooltips, function( id, tooltipData ) {
|
1440
|
+
that._updateContent( tooltipData.element );
|
1441
|
+
} );
|
1442
|
+
}
|
1443
|
+
},
|
1444
|
+
|
1445
|
+
_setOptionDisabled: function( value ) {
|
1446
|
+
this[ value ? "_disable" : "_enable" ]();
|
1447
|
+
},
|
1448
|
+
|
1449
|
+
_disable: function() {
|
1450
|
+
var that = this;
|
1451
|
+
|
1452
|
+
// Close open tooltips
|
1453
|
+
$.each( this.tooltips, function( id, tooltipData ) {
|
1454
|
+
var event = $.Event( "blur" );
|
1455
|
+
event.target = event.currentTarget = tooltipData.element[ 0 ];
|
1456
|
+
that.close( event, true );
|
1457
|
+
} );
|
1458
|
+
|
1459
|
+
// Remove title attributes to prevent native tooltips
|
1460
|
+
this.disabledTitles = this.disabledTitles.add(
|
1461
|
+
this.element.find( this.options.items ).addBack()
|
1462
|
+
.filter( function() {
|
1463
|
+
var element = $( this );
|
1464
|
+
if ( element.is( "[title]" ) ) {
|
1465
|
+
return element
|
1466
|
+
.data( "ui-tooltip-title", element.attr( "title" ) )
|
1467
|
+
.removeAttr( "title" );
|
1468
|
+
}
|
1469
|
+
} )
|
1470
|
+
);
|
1471
|
+
},
|
1472
|
+
|
1473
|
+
_enable: function() {
|
1474
|
+
|
1475
|
+
// restore title attributes
|
1476
|
+
this.disabledTitles.each( function() {
|
1477
|
+
var element = $( this );
|
1478
|
+
if ( element.data( "ui-tooltip-title" ) ) {
|
1479
|
+
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
1480
|
+
}
|
1481
|
+
} );
|
1482
|
+
this.disabledTitles = $( [] );
|
1483
|
+
},
|
1484
|
+
|
1485
|
+
open: function( event ) {
|
1486
|
+
var that = this,
|
1487
|
+
target = $( event ? event.target : this.element )
|
1488
|
+
|
1489
|
+
// we need closest here due to mouseover bubbling,
|
1490
|
+
// but always pointing at the same event target
|
1491
|
+
.closest( this.options.items );
|
1492
|
+
|
1493
|
+
// No element to show a tooltip for or the tooltip is already open
|
1494
|
+
if ( !target.length || target.data( "ui-tooltip-id" ) ) {
|
1495
|
+
return;
|
1496
|
+
}
|
1497
|
+
|
1498
|
+
if ( target.attr( "title" ) ) {
|
1499
|
+
target.data( "ui-tooltip-title", target.attr( "title" ) );
|
1500
|
+
}
|
1501
|
+
|
1502
|
+
target.data( "ui-tooltip-open", true );
|
1503
|
+
|
1504
|
+
// Kill parent tooltips, custom or native, for hover
|
1505
|
+
if ( event && event.type === "mouseover" ) {
|
1506
|
+
target.parents().each( function() {
|
1507
|
+
var parent = $( this ),
|
1508
|
+
blurEvent;
|
1509
|
+
if ( parent.data( "ui-tooltip-open" ) ) {
|
1510
|
+
blurEvent = $.Event( "blur" );
|
1511
|
+
blurEvent.target = blurEvent.currentTarget = this;
|
1512
|
+
that.close( blurEvent, true );
|
1513
|
+
}
|
1514
|
+
if ( parent.attr( "title" ) ) {
|
1515
|
+
parent.uniqueId();
|
1516
|
+
that.parents[ this.id ] = {
|
1517
|
+
element: this,
|
1518
|
+
title: parent.attr( "title" )
|
1519
|
+
};
|
1520
|
+
parent.attr( "title", "" );
|
1521
|
+
}
|
1522
|
+
} );
|
1523
|
+
}
|
1524
|
+
|
1525
|
+
this._registerCloseHandlers( event, target );
|
1526
|
+
this._updateContent( target, event );
|
1527
|
+
},
|
1528
|
+
|
1529
|
+
_updateContent: function( target, event ) {
|
1530
|
+
var content,
|
1531
|
+
contentOption = this.options.content,
|
1532
|
+
that = this,
|
1533
|
+
eventType = event ? event.type : null;
|
1534
|
+
|
1535
|
+
if ( typeof contentOption === "string" || contentOption.nodeType ||
|
1536
|
+
contentOption.jquery ) {
|
1537
|
+
return this._open( event, target, contentOption );
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
content = contentOption.call( target[ 0 ], function( response ) {
|
1541
|
+
|
1542
|
+
// IE may instantly serve a cached response for ajax requests
|
1543
|
+
// delay this call to _open so the other call to _open runs first
|
1544
|
+
that._delay( function() {
|
1545
|
+
|
1546
|
+
// Ignore async response if tooltip was closed already
|
1547
|
+
if ( !target.data( "ui-tooltip-open" ) ) {
|
1548
|
+
return;
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
// JQuery creates a special event for focusin when it doesn't
|
1552
|
+
// exist natively. To improve performance, the native event
|
1553
|
+
// object is reused and the type is changed. Therefore, we can't
|
1554
|
+
// rely on the type being correct after the event finished
|
1555
|
+
// bubbling, so we set it back to the previous value. (#8740)
|
1556
|
+
if ( event ) {
|
1557
|
+
event.type = eventType;
|
1558
|
+
}
|
1559
|
+
this._open( event, target, response );
|
1560
|
+
} );
|
1561
|
+
} );
|
1562
|
+
if ( content ) {
|
1563
|
+
this._open( event, target, content );
|
1564
|
+
}
|
1565
|
+
},
|
1566
|
+
|
1567
|
+
_open: function( event, target, content ) {
|
1568
|
+
var tooltipData, tooltip, delayedShow, a11yContent,
|
1569
|
+
positionOption = $.extend( {}, this.options.position );
|
1570
|
+
|
1571
|
+
if ( !content ) {
|
1572
|
+
return;
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
// Content can be updated multiple times. If the tooltip already
|
1576
|
+
// exists, then just update the content and bail.
|
1577
|
+
tooltipData = this._find( target );
|
1578
|
+
if ( tooltipData ) {
|
1579
|
+
tooltipData.tooltip.find( ".ui-tooltip-content" ).html( content );
|
1580
|
+
return;
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
// If we have a title, clear it to prevent the native tooltip
|
1584
|
+
// we have to check first to avoid defining a title if none exists
|
1585
|
+
// (we don't want to cause an element to start matching [title])
|
1586
|
+
//
|
1587
|
+
// We use removeAttr only for key events, to allow IE to export the correct
|
1588
|
+
// accessible attributes. For mouse events, set to empty string to avoid
|
1589
|
+
// native tooltip showing up (happens only when removing inside mouseover).
|
1590
|
+
if ( target.is( "[title]" ) ) {
|
1591
|
+
if ( event && event.type === "mouseover" ) {
|
1592
|
+
target.attr( "title", "" );
|
1593
|
+
} else {
|
1594
|
+
target.removeAttr( "title" );
|
1595
|
+
}
|
1596
|
+
}
|
1597
|
+
|
1598
|
+
tooltipData = this._tooltip( target );
|
1599
|
+
tooltip = tooltipData.tooltip;
|
1600
|
+
this._addDescribedBy( target, tooltip.attr( "id" ) );
|
1601
|
+
tooltip.find( ".ui-tooltip-content" ).html( content );
|
1602
|
+
|
1603
|
+
// Support: Voiceover on OS X, JAWS on IE <= 9
|
1604
|
+
// JAWS announces deletions even when aria-relevant="additions"
|
1605
|
+
// Voiceover will sometimes re-read the entire log region's contents from the beginning
|
1606
|
+
this.liveRegion.children().hide();
|
1607
|
+
a11yContent = $( "<div>" ).html( tooltip.find( ".ui-tooltip-content" ).html() );
|
1608
|
+
a11yContent.removeAttr( "name" ).find( "[name]" ).removeAttr( "name" );
|
1609
|
+
a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" );
|
1610
|
+
a11yContent.appendTo( this.liveRegion );
|
1611
|
+
|
1612
|
+
function position( event ) {
|
1613
|
+
positionOption.of = event;
|
1614
|
+
if ( tooltip.is( ":hidden" ) ) {
|
1615
|
+
return;
|
1616
|
+
}
|
1617
|
+
tooltip.position( positionOption );
|
1618
|
+
}
|
1619
|
+
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
|
1620
|
+
this._on( this.document, {
|
1621
|
+
mousemove: position
|
1622
|
+
} );
|
1623
|
+
|
1624
|
+
// trigger once to override element-relative positioning
|
1625
|
+
position( event );
|
1626
|
+
} else {
|
1627
|
+
tooltip.position( $.extend( {
|
1628
|
+
of: target
|
1629
|
+
}, this.options.position ) );
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
tooltip.hide();
|
1633
|
+
|
1634
|
+
this._show( tooltip, this.options.show );
|
1635
|
+
|
1636
|
+
// Handle tracking tooltips that are shown with a delay (#8644). As soon
|
1637
|
+
// as the tooltip is visible, position the tooltip using the most recent
|
1638
|
+
// event.
|
1639
|
+
// Adds the check to add the timers only when both delay and track options are set (#14682)
|
1640
|
+
if ( this.options.track && this.options.show && this.options.show.delay ) {
|
1641
|
+
delayedShow = this.delayedShow = setInterval( function() {
|
1642
|
+
if ( tooltip.is( ":visible" ) ) {
|
1643
|
+
position( positionOption.of );
|
1644
|
+
clearInterval( delayedShow );
|
1645
|
+
}
|
1646
|
+
}, 13 );
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
this._trigger( "open", event, { tooltip: tooltip } );
|
1650
|
+
},
|
1651
|
+
|
1652
|
+
_registerCloseHandlers: function( event, target ) {
|
1653
|
+
var events = {
|
1654
|
+
keyup: function( event ) {
|
1655
|
+
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
|
1656
|
+
var fakeEvent = $.Event( event );
|
1657
|
+
fakeEvent.currentTarget = target[ 0 ];
|
1658
|
+
this.close( fakeEvent, true );
|
1659
|
+
}
|
1660
|
+
}
|
1661
|
+
};
|
1662
|
+
|
1663
|
+
// Only bind remove handler for delegated targets. Non-delegated
|
1664
|
+
// tooltips will handle this in destroy.
|
1665
|
+
if ( target[ 0 ] !== this.element[ 0 ] ) {
|
1666
|
+
events.remove = function() {
|
1667
|
+
this._removeTooltip( this._find( target ).tooltip );
|
1668
|
+
};
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
if ( !event || event.type === "mouseover" ) {
|
1672
|
+
events.mouseleave = "close";
|
1673
|
+
}
|
1674
|
+
if ( !event || event.type === "focusin" ) {
|
1675
|
+
events.focusout = "close";
|
1676
|
+
}
|
1677
|
+
this._on( true, target, events );
|
1678
|
+
},
|
1679
|
+
|
1680
|
+
close: function( event ) {
|
1681
|
+
var tooltip,
|
1682
|
+
that = this,
|
1683
|
+
target = $( event ? event.currentTarget : this.element ),
|
1684
|
+
tooltipData = this._find( target );
|
1685
|
+
|
1686
|
+
// The tooltip may already be closed
|
1687
|
+
if ( !tooltipData ) {
|
1688
|
+
|
1689
|
+
// We set ui-tooltip-open immediately upon open (in open()), but only set the
|
1690
|
+
// additional data once there's actually content to show (in _open()). So even if the
|
1691
|
+
// tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
|
1692
|
+
// the period between open() and _open().
|
1693
|
+
target.removeData( "ui-tooltip-open" );
|
1694
|
+
return;
|
1695
|
+
}
|
1696
|
+
|
1697
|
+
tooltip = tooltipData.tooltip;
|
1698
|
+
|
1699
|
+
// Disabling closes the tooltip, so we need to track when we're closing
|
1700
|
+
// to avoid an infinite loop in case the tooltip becomes disabled on close
|
1701
|
+
if ( tooltipData.closing ) {
|
1702
|
+
return;
|
1703
|
+
}
|
1704
|
+
|
1705
|
+
// Clear the interval for delayed tracking tooltips
|
1706
|
+
clearInterval( this.delayedShow );
|
1707
|
+
|
1708
|
+
// Only set title if we had one before (see comment in _open())
|
1709
|
+
// If the title attribute has changed since open(), don't restore
|
1710
|
+
if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) {
|
1711
|
+
target.attr( "title", target.data( "ui-tooltip-title" ) );
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
this._removeDescribedBy( target );
|
1715
|
+
|
1716
|
+
tooltipData.hiding = true;
|
1717
|
+
tooltip.stop( true );
|
1718
|
+
this._hide( tooltip, this.options.hide, function() {
|
1719
|
+
that._removeTooltip( $( this ) );
|
1720
|
+
} );
|
1721
|
+
|
1722
|
+
target.removeData( "ui-tooltip-open" );
|
1723
|
+
this._off( target, "mouseleave focusout keyup" );
|
1724
|
+
|
1725
|
+
// Remove 'remove' binding only on delegated targets
|
1726
|
+
if ( target[ 0 ] !== this.element[ 0 ] ) {
|
1727
|
+
this._off( target, "remove" );
|
1728
|
+
}
|
1729
|
+
this._off( this.document, "mousemove" );
|
1730
|
+
|
1731
|
+
if ( event && event.type === "mouseleave" ) {
|
1732
|
+
$.each( this.parents, function( id, parent ) {
|
1733
|
+
$( parent.element ).attr( "title", parent.title );
|
1734
|
+
delete that.parents[ id ];
|
1735
|
+
} );
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
tooltipData.closing = true;
|
1739
|
+
this._trigger( "close", event, { tooltip: tooltip } );
|
1740
|
+
if ( !tooltipData.hiding ) {
|
1741
|
+
tooltipData.closing = false;
|
1742
|
+
}
|
1743
|
+
},
|
1744
|
+
|
1745
|
+
_tooltip: function( element ) {
|
1746
|
+
var tooltip = $( "<div>" ).attr( "role", "tooltip" ),
|
1747
|
+
content = $( "<div>" ).appendTo( tooltip ),
|
1748
|
+
id = tooltip.uniqueId().attr( "id" );
|
1749
|
+
|
1750
|
+
this._addClass( content, "ui-tooltip-content" );
|
1751
|
+
this._addClass( tooltip, "ui-tooltip", "ui-widget ui-widget-content" );
|
1752
|
+
|
1753
|
+
tooltip.appendTo( this._appendTo( element ) );
|
1754
|
+
|
1755
|
+
return this.tooltips[ id ] = {
|
1756
|
+
element: element,
|
1757
|
+
tooltip: tooltip
|
1758
|
+
};
|
1759
|
+
},
|
1760
|
+
|
1761
|
+
_find: function( target ) {
|
1762
|
+
var id = target.data( "ui-tooltip-id" );
|
1763
|
+
return id ? this.tooltips[ id ] : null;
|
1764
|
+
},
|
1765
|
+
|
1766
|
+
_removeTooltip: function( tooltip ) {
|
1767
|
+
|
1768
|
+
// Clear the interval for delayed tracking tooltips
|
1769
|
+
clearInterval( this.delayedShow );
|
1770
|
+
|
1771
|
+
tooltip.remove();
|
1772
|
+
delete this.tooltips[ tooltip.attr( "id" ) ];
|
1773
|
+
},
|
1774
|
+
|
1775
|
+
_appendTo: function( target ) {
|
1776
|
+
var element = target.closest( ".ui-front, dialog" );
|
1777
|
+
|
1778
|
+
if ( !element.length ) {
|
1779
|
+
element = this.document[ 0 ].body;
|
1780
|
+
}
|
1781
|
+
|
1782
|
+
return element;
|
1783
|
+
},
|
1784
|
+
|
1785
|
+
_destroy: function() {
|
1786
|
+
var that = this;
|
1787
|
+
|
1788
|
+
// Close open tooltips
|
1789
|
+
$.each( this.tooltips, function( id, tooltipData ) {
|
1790
|
+
|
1791
|
+
// Delegate to close method to handle common cleanup
|
1792
|
+
var event = $.Event( "blur" ),
|
1793
|
+
element = tooltipData.element;
|
1794
|
+
event.target = event.currentTarget = element[ 0 ];
|
1795
|
+
that.close( event, true );
|
1796
|
+
|
1797
|
+
// Remove immediately; destroying an open tooltip doesn't use the
|
1798
|
+
// hide animation
|
1799
|
+
$( "#" + id ).remove();
|
1800
|
+
|
1801
|
+
// Restore the title
|
1802
|
+
if ( element.data( "ui-tooltip-title" ) ) {
|
1803
|
+
|
1804
|
+
// If the title attribute has changed since open(), don't restore
|
1805
|
+
if ( !element.attr( "title" ) ) {
|
1806
|
+
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
1807
|
+
}
|
1808
|
+
element.removeData( "ui-tooltip-title" );
|
1809
|
+
}
|
1810
|
+
} );
|
1811
|
+
this.liveRegion.remove();
|
1812
|
+
}
|
1813
|
+
} );
|
1814
|
+
|
1815
|
+
// DEPRECATED
|
1816
|
+
// TODO: Switch return back to widget declaration at top of file when this is removed
|
1817
|
+
if ( $.uiBackCompat !== false ) {
|
1818
|
+
|
1819
|
+
// Backcompat for tooltipClass option
|
1820
|
+
$.widget( "ui.tooltip", $.ui.tooltip, {
|
1821
|
+
options: {
|
1822
|
+
tooltipClass: null
|
1823
|
+
},
|
1824
|
+
_tooltip: function() {
|
1825
|
+
var tooltipData = this._superApply( arguments );
|
1826
|
+
if ( this.options.tooltipClass ) {
|
1827
|
+
tooltipData.tooltip.addClass( this.options.tooltipClass );
|
1828
|
+
}
|
1829
|
+
return tooltipData;
|
1830
|
+
}
|
1831
|
+
} );
|
1832
|
+
}
|
1833
|
+
|
1834
|
+
var widgetsTooltip = $.ui.tooltip;
|
1835
|
+
|
1836
|
+
|
1837
|
+
|
1838
|
+
|
1839
|
+
} );
|