jquery-ui-rails 2.0.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jquery-ui-rails might be problematic. Click here for more details.
- data/History.md +15 -0
- data/License.txt +2 -3
- data/README.md +17 -19
- data/Rakefile +79 -28
- data/lib/jquery/ui/rails/version.rb +1 -1
- data/vendor/assets/javascripts/jquery.ui.accordion.js +537 -417
- data/vendor/assets/javascripts/jquery.ui.all.js +17 -14
- data/vendor/assets/javascripts/jquery.ui.autocomplete.js +311 -339
- data/vendor/assets/javascripts/jquery.ui.button.js +63 -59
- data/vendor/assets/javascripts/jquery.ui.core.js +134 -112
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +16 -16
- data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +5 -5
- data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +13 -13
- data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +9 -9
- data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +5 -5
- data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +11 -11
- data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +18 -18
- data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +7 -7
- data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +6 -6
- data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +9 -9
- data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +1 -1
- data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +3 -3
- data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +2 -2
- data/vendor/assets/javascripts/jquery.ui.datepicker.js +51 -59
- data/vendor/assets/javascripts/jquery.ui.dialog.js +402 -409
- data/vendor/assets/javascripts/jquery.ui.draggable.js +79 -75
- data/vendor/assets/javascripts/jquery.ui.droppable.js +10 -17
- data/vendor/assets/javascripts/jquery.ui.effect-blind.js +84 -0
- data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
- data/vendor/assets/javascripts/jquery.ui.effect-clip.js +69 -0
- data/vendor/assets/javascripts/jquery.ui.effect-drop.js +67 -0
- data/vendor/assets/javascripts/jquery.ui.effect-explode.js +99 -0
- data/vendor/assets/javascripts/jquery.ui.effect-fade.js +32 -0
- data/vendor/assets/javascripts/jquery.ui.effect-fold.js +78 -0
- data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
- data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
- data/vendor/assets/javascripts/jquery.ui.effect-scale.js +320 -0
- data/vendor/assets/javascripts/jquery.ui.effect-shake.js +76 -0
- data/vendor/assets/javascripts/jquery.ui.effect-slide.js +66 -0
- data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
- data/vendor/assets/javascripts/jquery.ui.effect.all.js +14 -0
- data/vendor/assets/javascripts/jquery.ui.effect.js +1276 -0
- data/vendor/assets/javascripts/jquery.ui.menu.js +614 -0
- data/vendor/assets/javascripts/jquery.ui.mouse.js +22 -20
- data/vendor/assets/javascripts/jquery.ui.position.js +367 -158
- data/vendor/assets/javascripts/jquery.ui.progressbar.js +10 -14
- data/vendor/assets/javascripts/jquery.ui.resizable.js +143 -149
- data/vendor/assets/javascripts/jquery.ui.selectable.js +22 -28
- data/vendor/assets/javascripts/jquery.ui.slider.js +88 -106
- data/vendor/assets/javascripts/jquery.ui.sortable.js +97 -95
- data/vendor/assets/javascripts/jquery.ui.spinner.js +482 -0
- data/vendor/assets/javascripts/jquery.ui.tabs.js +1189 -580
- data/vendor/assets/javascripts/jquery.ui.tooltip.js +402 -0
- data/vendor/assets/javascripts/jquery.ui.widget.js +373 -117
- data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +10 -13
- data/vendor/assets/stylesheets/jquery.ui.all.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +10 -44
- data/vendor/assets/stylesheets/jquery.ui.base.css.erb +7 -3
- data/vendor/assets/stylesheets/jquery.ui.button.css.erb +6 -4
- data/vendor/assets/stylesheets/jquery.ui.core.css.erb +5 -4
- data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +6 -5
- data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +34 -0
- data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +4 -3
- data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +27 -0
- data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +8 -8
- data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +8 -7
- data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +25 -0
- metadata +24 -19
- data/dependencies.js +0 -31
- data/vendor/assets/javascripts/jquery.effects.all.js +0 -14
- data/vendor/assets/javascripts/jquery.effects.blind.js +0 -51
- data/vendor/assets/javascripts/jquery.effects.bounce.js +0 -80
- data/vendor/assets/javascripts/jquery.effects.clip.js +0 -56
- data/vendor/assets/javascripts/jquery.effects.core.js +0 -612
- data/vendor/assets/javascripts/jquery.effects.drop.js +0 -52
- data/vendor/assets/javascripts/jquery.effects.explode.js +0 -81
- data/vendor/assets/javascripts/jquery.effects.fade.js +0 -34
- data/vendor/assets/javascripts/jquery.effects.fold.js +0 -58
- data/vendor/assets/javascripts/jquery.effects.highlight.js +0 -52
- data/vendor/assets/javascripts/jquery.effects.pulsate.js +0 -53
- data/vendor/assets/javascripts/jquery.effects.scale.js +0 -180
- data/vendor/assets/javascripts/jquery.effects.shake.js +0 -59
- data/vendor/assets/javascripts/jquery.effects.slide.js +0 -52
- data/vendor/assets/javascripts/jquery.effects.transfer.js +0 -47
@@ -0,0 +1,402 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
//= require jquery.ui.position
|
4
|
+
|
5
|
+
/*!
|
6
|
+
* jQuery UI Tooltip 1.9.2
|
7
|
+
* http://jqueryui.com
|
8
|
+
*
|
9
|
+
* Copyright 2012 jQuery Foundation and other contributors
|
10
|
+
* Released under the MIT license.
|
11
|
+
* http://jquery.org/license
|
12
|
+
*
|
13
|
+
* http://api.jqueryui.com/tooltip/
|
14
|
+
*
|
15
|
+
* Depends:
|
16
|
+
* jquery.ui.core.js
|
17
|
+
* jquery.ui.widget.js
|
18
|
+
* jquery.ui.position.js
|
19
|
+
*/
|
20
|
+
(function( $ ) {
|
21
|
+
|
22
|
+
var increments = 0;
|
23
|
+
|
24
|
+
function addDescribedBy( elem, id ) {
|
25
|
+
var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
|
26
|
+
describedby.push( id );
|
27
|
+
elem
|
28
|
+
.data( "ui-tooltip-id", id )
|
29
|
+
.attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
|
30
|
+
}
|
31
|
+
|
32
|
+
function removeDescribedBy( elem ) {
|
33
|
+
var id = elem.data( "ui-tooltip-id" ),
|
34
|
+
describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
|
35
|
+
index = $.inArray( id, describedby );
|
36
|
+
if ( index !== -1 ) {
|
37
|
+
describedby.splice( index, 1 );
|
38
|
+
}
|
39
|
+
|
40
|
+
elem.removeData( "ui-tooltip-id" );
|
41
|
+
describedby = $.trim( describedby.join( " " ) );
|
42
|
+
if ( describedby ) {
|
43
|
+
elem.attr( "aria-describedby", describedby );
|
44
|
+
} else {
|
45
|
+
elem.removeAttr( "aria-describedby" );
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
$.widget( "ui.tooltip", {
|
50
|
+
version: "1.9.2",
|
51
|
+
options: {
|
52
|
+
content: function() {
|
53
|
+
return $( this ).attr( "title" );
|
54
|
+
},
|
55
|
+
hide: true,
|
56
|
+
// Disabled elements have inconsistent behavior across browsers (#8661)
|
57
|
+
items: "[title]:not([disabled])",
|
58
|
+
position: {
|
59
|
+
my: "left top+15",
|
60
|
+
at: "left bottom",
|
61
|
+
collision: "flipfit flip"
|
62
|
+
},
|
63
|
+
show: true,
|
64
|
+
tooltipClass: null,
|
65
|
+
track: false,
|
66
|
+
|
67
|
+
// callbacks
|
68
|
+
close: null,
|
69
|
+
open: null
|
70
|
+
},
|
71
|
+
|
72
|
+
_create: function() {
|
73
|
+
this._on({
|
74
|
+
mouseover: "open",
|
75
|
+
focusin: "open"
|
76
|
+
});
|
77
|
+
|
78
|
+
// IDs of generated tooltips, needed for destroy
|
79
|
+
this.tooltips = {};
|
80
|
+
// IDs of parent tooltips where we removed the title attribute
|
81
|
+
this.parents = {};
|
82
|
+
|
83
|
+
if ( this.options.disabled ) {
|
84
|
+
this._disable();
|
85
|
+
}
|
86
|
+
},
|
87
|
+
|
88
|
+
_setOption: function( key, value ) {
|
89
|
+
var that = this;
|
90
|
+
|
91
|
+
if ( key === "disabled" ) {
|
92
|
+
this[ value ? "_disable" : "_enable" ]();
|
93
|
+
this.options[ key ] = value;
|
94
|
+
// disable element style changes
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
|
98
|
+
this._super( key, value );
|
99
|
+
|
100
|
+
if ( key === "content" ) {
|
101
|
+
$.each( this.tooltips, function( id, element ) {
|
102
|
+
that._updateContent( element );
|
103
|
+
});
|
104
|
+
}
|
105
|
+
},
|
106
|
+
|
107
|
+
_disable: function() {
|
108
|
+
var that = this;
|
109
|
+
|
110
|
+
// close open tooltips
|
111
|
+
$.each( this.tooltips, function( id, element ) {
|
112
|
+
var event = $.Event( "blur" );
|
113
|
+
event.target = event.currentTarget = element[0];
|
114
|
+
that.close( event, true );
|
115
|
+
});
|
116
|
+
|
117
|
+
// remove title attributes to prevent native tooltips
|
118
|
+
this.element.find( this.options.items ).andSelf().each(function() {
|
119
|
+
var element = $( this );
|
120
|
+
if ( element.is( "[title]" ) ) {
|
121
|
+
element
|
122
|
+
.data( "ui-tooltip-title", element.attr( "title" ) )
|
123
|
+
.attr( "title", "" );
|
124
|
+
}
|
125
|
+
});
|
126
|
+
},
|
127
|
+
|
128
|
+
_enable: function() {
|
129
|
+
// restore title attributes
|
130
|
+
this.element.find( this.options.items ).andSelf().each(function() {
|
131
|
+
var element = $( this );
|
132
|
+
if ( element.data( "ui-tooltip-title" ) ) {
|
133
|
+
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
134
|
+
}
|
135
|
+
});
|
136
|
+
},
|
137
|
+
|
138
|
+
open: function( event ) {
|
139
|
+
var that = this,
|
140
|
+
target = $( event ? event.target : this.element )
|
141
|
+
// we need closest here due to mouseover bubbling,
|
142
|
+
// but always pointing at the same event target
|
143
|
+
.closest( this.options.items );
|
144
|
+
|
145
|
+
// No element to show a tooltip for or the tooltip is already open
|
146
|
+
if ( !target.length || target.data( "ui-tooltip-id" ) ) {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
|
150
|
+
if ( target.attr( "title" ) ) {
|
151
|
+
target.data( "ui-tooltip-title", target.attr( "title" ) );
|
152
|
+
}
|
153
|
+
|
154
|
+
target.data( "ui-tooltip-open", true );
|
155
|
+
|
156
|
+
// kill parent tooltips, custom or native, for hover
|
157
|
+
if ( event && event.type === "mouseover" ) {
|
158
|
+
target.parents().each(function() {
|
159
|
+
var parent = $( this ),
|
160
|
+
blurEvent;
|
161
|
+
if ( parent.data( "ui-tooltip-open" ) ) {
|
162
|
+
blurEvent = $.Event( "blur" );
|
163
|
+
blurEvent.target = blurEvent.currentTarget = this;
|
164
|
+
that.close( blurEvent, true );
|
165
|
+
}
|
166
|
+
if ( parent.attr( "title" ) ) {
|
167
|
+
parent.uniqueId();
|
168
|
+
that.parents[ this.id ] = {
|
169
|
+
element: this,
|
170
|
+
title: parent.attr( "title" )
|
171
|
+
};
|
172
|
+
parent.attr( "title", "" );
|
173
|
+
}
|
174
|
+
});
|
175
|
+
}
|
176
|
+
|
177
|
+
this._updateContent( target, event );
|
178
|
+
},
|
179
|
+
|
180
|
+
_updateContent: function( target, event ) {
|
181
|
+
var content,
|
182
|
+
contentOption = this.options.content,
|
183
|
+
that = this,
|
184
|
+
eventType = event ? event.type : null;
|
185
|
+
|
186
|
+
if ( typeof contentOption === "string" ) {
|
187
|
+
return this._open( event, target, contentOption );
|
188
|
+
}
|
189
|
+
|
190
|
+
content = contentOption.call( target[0], function( response ) {
|
191
|
+
// ignore async response if tooltip was closed already
|
192
|
+
if ( !target.data( "ui-tooltip-open" ) ) {
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
// IE may instantly serve a cached response for ajax requests
|
196
|
+
// delay this call to _open so the other call to _open runs first
|
197
|
+
that._delay(function() {
|
198
|
+
// jQuery creates a special event for focusin when it doesn't
|
199
|
+
// exist natively. To improve performance, the native event
|
200
|
+
// object is reused and the type is changed. Therefore, we can't
|
201
|
+
// rely on the type being correct after the event finished
|
202
|
+
// bubbling, so we set it back to the previous value. (#8740)
|
203
|
+
if ( event ) {
|
204
|
+
event.type = eventType;
|
205
|
+
}
|
206
|
+
this._open( event, target, response );
|
207
|
+
});
|
208
|
+
});
|
209
|
+
if ( content ) {
|
210
|
+
this._open( event, target, content );
|
211
|
+
}
|
212
|
+
},
|
213
|
+
|
214
|
+
_open: function( event, target, content ) {
|
215
|
+
var tooltip, events, delayedShow,
|
216
|
+
positionOption = $.extend( {}, this.options.position );
|
217
|
+
|
218
|
+
if ( !content ) {
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
|
222
|
+
// Content can be updated multiple times. If the tooltip already
|
223
|
+
// exists, then just update the content and bail.
|
224
|
+
tooltip = this._find( target );
|
225
|
+
if ( tooltip.length ) {
|
226
|
+
tooltip.find( ".ui-tooltip-content" ).html( content );
|
227
|
+
return;
|
228
|
+
}
|
229
|
+
|
230
|
+
// if we have a title, clear it to prevent the native tooltip
|
231
|
+
// we have to check first to avoid defining a title if none exists
|
232
|
+
// (we don't want to cause an element to start matching [title])
|
233
|
+
//
|
234
|
+
// We use removeAttr only for key events, to allow IE to export the correct
|
235
|
+
// accessible attributes. For mouse events, set to empty string to avoid
|
236
|
+
// native tooltip showing up (happens only when removing inside mouseover).
|
237
|
+
if ( target.is( "[title]" ) ) {
|
238
|
+
if ( event && event.type === "mouseover" ) {
|
239
|
+
target.attr( "title", "" );
|
240
|
+
} else {
|
241
|
+
target.removeAttr( "title" );
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
tooltip = this._tooltip( target );
|
246
|
+
addDescribedBy( target, tooltip.attr( "id" ) );
|
247
|
+
tooltip.find( ".ui-tooltip-content" ).html( content );
|
248
|
+
|
249
|
+
function position( event ) {
|
250
|
+
positionOption.of = event;
|
251
|
+
if ( tooltip.is( ":hidden" ) ) {
|
252
|
+
return;
|
253
|
+
}
|
254
|
+
tooltip.position( positionOption );
|
255
|
+
}
|
256
|
+
if ( this.options.track && event && /^mouse/.test( event.type ) ) {
|
257
|
+
this._on( this.document, {
|
258
|
+
mousemove: position
|
259
|
+
});
|
260
|
+
// trigger once to override element-relative positioning
|
261
|
+
position( event );
|
262
|
+
} else {
|
263
|
+
tooltip.position( $.extend({
|
264
|
+
of: target
|
265
|
+
}, this.options.position ) );
|
266
|
+
}
|
267
|
+
|
268
|
+
tooltip.hide();
|
269
|
+
|
270
|
+
this._show( tooltip, this.options.show );
|
271
|
+
// Handle tracking tooltips that are shown with a delay (#8644). As soon
|
272
|
+
// as the tooltip is visible, position the tooltip using the most recent
|
273
|
+
// event.
|
274
|
+
if ( this.options.show && this.options.show.delay ) {
|
275
|
+
delayedShow = setInterval(function() {
|
276
|
+
if ( tooltip.is( ":visible" ) ) {
|
277
|
+
position( positionOption.of );
|
278
|
+
clearInterval( delayedShow );
|
279
|
+
}
|
280
|
+
}, $.fx.interval );
|
281
|
+
}
|
282
|
+
|
283
|
+
this._trigger( "open", event, { tooltip: tooltip } );
|
284
|
+
|
285
|
+
events = {
|
286
|
+
keyup: function( event ) {
|
287
|
+
if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
|
288
|
+
var fakeEvent = $.Event(event);
|
289
|
+
fakeEvent.currentTarget = target[0];
|
290
|
+
this.close( fakeEvent, true );
|
291
|
+
}
|
292
|
+
},
|
293
|
+
remove: function() {
|
294
|
+
this._removeTooltip( tooltip );
|
295
|
+
}
|
296
|
+
};
|
297
|
+
if ( !event || event.type === "mouseover" ) {
|
298
|
+
events.mouseleave = "close";
|
299
|
+
}
|
300
|
+
if ( !event || event.type === "focusin" ) {
|
301
|
+
events.focusout = "close";
|
302
|
+
}
|
303
|
+
this._on( true, target, events );
|
304
|
+
},
|
305
|
+
|
306
|
+
close: function( event ) {
|
307
|
+
var that = this,
|
308
|
+
target = $( event ? event.currentTarget : this.element ),
|
309
|
+
tooltip = this._find( target );
|
310
|
+
|
311
|
+
// disabling closes the tooltip, so we need to track when we're closing
|
312
|
+
// to avoid an infinite loop in case the tooltip becomes disabled on close
|
313
|
+
if ( this.closing ) {
|
314
|
+
return;
|
315
|
+
}
|
316
|
+
|
317
|
+
// only set title if we had one before (see comment in _open())
|
318
|
+
if ( target.data( "ui-tooltip-title" ) ) {
|
319
|
+
target.attr( "title", target.data( "ui-tooltip-title" ) );
|
320
|
+
}
|
321
|
+
|
322
|
+
removeDescribedBy( target );
|
323
|
+
|
324
|
+
tooltip.stop( true );
|
325
|
+
this._hide( tooltip, this.options.hide, function() {
|
326
|
+
that._removeTooltip( $( this ) );
|
327
|
+
});
|
328
|
+
|
329
|
+
target.removeData( "ui-tooltip-open" );
|
330
|
+
this._off( target, "mouseleave focusout keyup" );
|
331
|
+
// Remove 'remove' binding only on delegated targets
|
332
|
+
if ( target[0] !== this.element[0] ) {
|
333
|
+
this._off( target, "remove" );
|
334
|
+
}
|
335
|
+
this._off( this.document, "mousemove" );
|
336
|
+
|
337
|
+
if ( event && event.type === "mouseleave" ) {
|
338
|
+
$.each( this.parents, function( id, parent ) {
|
339
|
+
$( parent.element ).attr( "title", parent.title );
|
340
|
+
delete that.parents[ id ];
|
341
|
+
});
|
342
|
+
}
|
343
|
+
|
344
|
+
this.closing = true;
|
345
|
+
this._trigger( "close", event, { tooltip: tooltip } );
|
346
|
+
this.closing = false;
|
347
|
+
},
|
348
|
+
|
349
|
+
_tooltip: function( element ) {
|
350
|
+
var id = "ui-tooltip-" + increments++,
|
351
|
+
tooltip = $( "<div>" )
|
352
|
+
.attr({
|
353
|
+
id: id,
|
354
|
+
role: "tooltip"
|
355
|
+
})
|
356
|
+
.addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
|
357
|
+
( this.options.tooltipClass || "" ) );
|
358
|
+
$( "<div>" )
|
359
|
+
.addClass( "ui-tooltip-content" )
|
360
|
+
.appendTo( tooltip );
|
361
|
+
tooltip.appendTo( this.document[0].body );
|
362
|
+
if ( $.fn.bgiframe ) {
|
363
|
+
tooltip.bgiframe();
|
364
|
+
}
|
365
|
+
this.tooltips[ id ] = element;
|
366
|
+
return tooltip;
|
367
|
+
},
|
368
|
+
|
369
|
+
_find: function( target ) {
|
370
|
+
var id = target.data( "ui-tooltip-id" );
|
371
|
+
return id ? $( "#" + id ) : $();
|
372
|
+
},
|
373
|
+
|
374
|
+
_removeTooltip: function( tooltip ) {
|
375
|
+
tooltip.remove();
|
376
|
+
delete this.tooltips[ tooltip.attr( "id" ) ];
|
377
|
+
},
|
378
|
+
|
379
|
+
_destroy: function() {
|
380
|
+
var that = this;
|
381
|
+
|
382
|
+
// close open tooltips
|
383
|
+
$.each( this.tooltips, function( id, element ) {
|
384
|
+
// Delegate to close method to handle common cleanup
|
385
|
+
var event = $.Event( "blur" );
|
386
|
+
event.target = event.currentTarget = element[0];
|
387
|
+
that.close( event, true );
|
388
|
+
|
389
|
+
// Remove immediately; destroying an open tooltip doesn't use the
|
390
|
+
// hide animation
|
391
|
+
$( "#" + id ).remove();
|
392
|
+
|
393
|
+
// Restore the title
|
394
|
+
if ( element.data( "ui-tooltip-title" ) ) {
|
395
|
+
element.attr( "title", element.data( "ui-tooltip-title" ) );
|
396
|
+
element.removeData( "ui-tooltip-title" );
|
397
|
+
}
|
398
|
+
});
|
399
|
+
}
|
400
|
+
});
|
401
|
+
|
402
|
+
}( jQuery ) );
|
@@ -1,48 +1,32 @@
|
|
1
1
|
/*!
|
2
|
-
* jQuery UI Widget 1.
|
2
|
+
* jQuery UI Widget 1.9.2
|
3
|
+
* http://jqueryui.com
|
3
4
|
*
|
4
|
-
* Copyright 2012
|
5
|
-
*
|
5
|
+
* Copyright 2012 jQuery Foundation and other contributors
|
6
|
+
* Released under the MIT license.
|
6
7
|
* http://jquery.org/license
|
7
8
|
*
|
8
|
-
* http://
|
9
|
+
* http://api.jqueryui.com/jQuery.widget/
|
9
10
|
*/
|
10
11
|
(function( $, undefined ) {
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
} else {
|
25
|
-
var _remove = $.fn.remove;
|
26
|
-
$.fn.remove = function( selector, keepData ) {
|
27
|
-
return this.each(function() {
|
28
|
-
if ( !keepData ) {
|
29
|
-
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
30
|
-
$( "*", this ).add( [ this ] ).each(function() {
|
31
|
-
try {
|
32
|
-
$( this ).triggerHandler( "remove" );
|
33
|
-
// http://bugs.jquery.com/ticket/8235
|
34
|
-
} catch( e ) {}
|
35
|
-
});
|
36
|
-
}
|
37
|
-
}
|
38
|
-
return _remove.call( $(this), selector, keepData );
|
39
|
-
});
|
40
|
-
};
|
41
|
-
}
|
13
|
+
var uuid = 0,
|
14
|
+
slice = Array.prototype.slice,
|
15
|
+
_cleanData = $.cleanData;
|
16
|
+
$.cleanData = function( elems ) {
|
17
|
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
18
|
+
try {
|
19
|
+
$( elem ).triggerHandler( "remove" );
|
20
|
+
// http://bugs.jquery.com/ticket/8235
|
21
|
+
} catch( e ) {}
|
22
|
+
}
|
23
|
+
_cleanData( elems );
|
24
|
+
};
|
42
25
|
|
43
26
|
$.widget = function( name, base, prototype ) {
|
44
|
-
var
|
45
|
-
|
27
|
+
var fullName, existingConstructor, constructor, basePrototype,
|
28
|
+
namespace = name.split( "." )[ 0 ];
|
29
|
+
|
46
30
|
name = name.split( "." )[ 1 ];
|
47
31
|
fullName = namespace + "-" + name;
|
48
32
|
|
@@ -52,81 +36,167 @@ $.widget = function( name, base, prototype ) {
|
|
52
36
|
}
|
53
37
|
|
54
38
|
// create selector for plugin
|
55
|
-
$.expr[ ":" ][ fullName ] = function( elem ) {
|
56
|
-
return !!$.data( elem,
|
39
|
+
$.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
|
40
|
+
return !!$.data( elem, fullName );
|
57
41
|
};
|
58
42
|
|
59
43
|
$[ namespace ] = $[ namespace ] || {};
|
60
|
-
$[ namespace ][ name ]
|
44
|
+
existingConstructor = $[ namespace ][ name ];
|
45
|
+
constructor = $[ namespace ][ name ] = function( options, element ) {
|
46
|
+
// allow instantiation without "new" keyword
|
47
|
+
if ( !this._createWidget ) {
|
48
|
+
return new constructor( options, element );
|
49
|
+
}
|
50
|
+
|
61
51
|
// allow instantiation without initializing for simple inheritance
|
52
|
+
// must use "new" keyword (the code above always passes args)
|
62
53
|
if ( arguments.length ) {
|
63
54
|
this._createWidget( options, element );
|
64
55
|
}
|
65
56
|
};
|
66
|
-
|
67
|
-
|
57
|
+
// extend with the existing constructor to carry over any static properties
|
58
|
+
$.extend( constructor, existingConstructor, {
|
59
|
+
version: prototype.version,
|
60
|
+
// copy the object used to create the prototype in case we need to
|
61
|
+
// redefine the widget later
|
62
|
+
_proto: $.extend( {}, prototype ),
|
63
|
+
// track widgets that inherit from this widget in case this widget is
|
64
|
+
// redefined after a widget inherits from it
|
65
|
+
_childConstructors: []
|
66
|
+
});
|
67
|
+
|
68
|
+
basePrototype = new base();
|
68
69
|
// we need to make the options hash a property directly on the new instance
|
69
70
|
// otherwise we'll modify the options hash on the prototype that we're
|
70
71
|
// inheriting from
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
basePrototype.options = $.widget.extend( {}, basePrototype.options );
|
73
|
+
$.each( prototype, function( prop, value ) {
|
74
|
+
if ( $.isFunction( value ) ) {
|
75
|
+
prototype[ prop ] = (function() {
|
76
|
+
var _super = function() {
|
77
|
+
return base.prototype[ prop ].apply( this, arguments );
|
78
|
+
},
|
79
|
+
_superApply = function( args ) {
|
80
|
+
return base.prototype[ prop ].apply( this, args );
|
81
|
+
};
|
82
|
+
return function() {
|
83
|
+
var __super = this._super,
|
84
|
+
__superApply = this._superApply,
|
85
|
+
returnValue;
|
86
|
+
|
87
|
+
this._super = _super;
|
88
|
+
this._superApply = _superApply;
|
89
|
+
|
90
|
+
returnValue = value.apply( this, arguments );
|
91
|
+
|
92
|
+
this._super = __super;
|
93
|
+
this._superApply = __superApply;
|
94
|
+
|
95
|
+
return returnValue;
|
96
|
+
};
|
97
|
+
})();
|
98
|
+
}
|
99
|
+
});
|
100
|
+
constructor.prototype = $.widget.extend( basePrototype, {
|
101
|
+
// TODO: remove support for widgetEventPrefix
|
102
|
+
// always use the name + a colon as the prefix, e.g., draggable:start
|
103
|
+
// don't prefix for widgets that aren't DOM-based
|
104
|
+
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
|
105
|
+
}, prototype, {
|
106
|
+
constructor: constructor,
|
78
107
|
namespace: namespace,
|
79
108
|
widgetName: name,
|
80
|
-
|
81
|
-
widgetBaseClass: fullName
|
82
|
-
|
109
|
+
// TODO remove widgetBaseClass, see #8155
|
110
|
+
widgetBaseClass: fullName,
|
111
|
+
widgetFullName: fullName
|
112
|
+
});
|
113
|
+
|
114
|
+
// If this widget is being redefined then we need to find all widgets that
|
115
|
+
// are inheriting from it and redefine all of them so that they inherit from
|
116
|
+
// the new version of this widget. We're essentially trying to replace one
|
117
|
+
// level in the prototype chain.
|
118
|
+
if ( existingConstructor ) {
|
119
|
+
$.each( existingConstructor._childConstructors, function( i, child ) {
|
120
|
+
var childPrototype = child.prototype;
|
121
|
+
|
122
|
+
// redefine the child widget using the same prototype that was
|
123
|
+
// originally used, but inherit from the new version of the base
|
124
|
+
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
|
125
|
+
});
|
126
|
+
// remove the list of existing child constructors from the old constructor
|
127
|
+
// so the old child constructors can be garbage collected
|
128
|
+
delete existingConstructor._childConstructors;
|
129
|
+
} else {
|
130
|
+
base._childConstructors.push( constructor );
|
131
|
+
}
|
83
132
|
|
84
|
-
$.widget.bridge( name,
|
133
|
+
$.widget.bridge( name, constructor );
|
134
|
+
};
|
135
|
+
|
136
|
+
$.widget.extend = function( target ) {
|
137
|
+
var input = slice.call( arguments, 1 ),
|
138
|
+
inputIndex = 0,
|
139
|
+
inputLength = input.length,
|
140
|
+
key,
|
141
|
+
value;
|
142
|
+
for ( ; inputIndex < inputLength; inputIndex++ ) {
|
143
|
+
for ( key in input[ inputIndex ] ) {
|
144
|
+
value = input[ inputIndex ][ key ];
|
145
|
+
if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
|
146
|
+
// Clone objects
|
147
|
+
if ( $.isPlainObject( value ) ) {
|
148
|
+
target[ key ] = $.isPlainObject( target[ key ] ) ?
|
149
|
+
$.widget.extend( {}, target[ key ], value ) :
|
150
|
+
// Don't extend strings, arrays, etc. with objects
|
151
|
+
$.widget.extend( {}, value );
|
152
|
+
// Copy everything else by reference
|
153
|
+
} else {
|
154
|
+
target[ key ] = value;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
return target;
|
85
160
|
};
|
86
161
|
|
87
162
|
$.widget.bridge = function( name, object ) {
|
163
|
+
var fullName = object.prototype.widgetFullName || name;
|
88
164
|
$.fn[ name ] = function( options ) {
|
89
165
|
var isMethodCall = typeof options === "string",
|
90
|
-
args =
|
166
|
+
args = slice.call( arguments, 1 ),
|
91
167
|
returnValue = this;
|
92
168
|
|
93
169
|
// allow multiple hashes to be passed on init
|
94
170
|
options = !isMethodCall && args.length ?
|
95
|
-
$.extend.apply( null, [
|
171
|
+
$.widget.extend.apply( null, [ options ].concat(args) ) :
|
96
172
|
options;
|
97
173
|
|
98
|
-
// prevent calls to internal methods
|
99
|
-
if ( isMethodCall && options.charAt( 0 ) === "_" ) {
|
100
|
-
return returnValue;
|
101
|
-
}
|
102
|
-
|
103
174
|
if ( isMethodCall ) {
|
104
175
|
this.each(function() {
|
105
|
-
var
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
// throw "no such method '" + options + "' for " + name + " widget instance";
|
116
|
-
// }
|
117
|
-
// var methodValue = instance[ options ].apply( instance, args );
|
176
|
+
var methodValue,
|
177
|
+
instance = $.data( this, fullName );
|
178
|
+
if ( !instance ) {
|
179
|
+
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
180
|
+
"attempted to call method '" + options + "'" );
|
181
|
+
}
|
182
|
+
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
|
183
|
+
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
|
184
|
+
}
|
185
|
+
methodValue = instance[ options ].apply( instance, args );
|
118
186
|
if ( methodValue !== instance && methodValue !== undefined ) {
|
119
|
-
returnValue = methodValue
|
187
|
+
returnValue = methodValue && methodValue.jquery ?
|
188
|
+
returnValue.pushStack( methodValue.get() ) :
|
189
|
+
methodValue;
|
120
190
|
return false;
|
121
191
|
}
|
122
192
|
});
|
123
193
|
} else {
|
124
194
|
this.each(function() {
|
125
|
-
var instance = $.data( this,
|
195
|
+
var instance = $.data( this, fullName );
|
126
196
|
if ( instance ) {
|
127
197
|
instance.option( options || {} )._init();
|
128
198
|
} else {
|
129
|
-
$.data( this,
|
199
|
+
$.data( this, fullName, new object( options, this ) );
|
130
200
|
}
|
131
201
|
});
|
132
202
|
}
|
@@ -135,74 +205,126 @@ $.widget.bridge = function( name, object ) {
|
|
135
205
|
};
|
136
206
|
};
|
137
207
|
|
138
|
-
$.Widget = function( options, element ) {
|
139
|
-
|
140
|
-
if ( arguments.length ) {
|
141
|
-
this._createWidget( options, element );
|
142
|
-
}
|
143
|
-
};
|
208
|
+
$.Widget = function( /* options, element */ ) {};
|
209
|
+
$.Widget._childConstructors = [];
|
144
210
|
|
145
211
|
$.Widget.prototype = {
|
146
212
|
widgetName: "widget",
|
147
213
|
widgetEventPrefix: "",
|
214
|
+
defaultElement: "<div>",
|
148
215
|
options: {
|
149
|
-
disabled: false
|
216
|
+
disabled: false,
|
217
|
+
|
218
|
+
// callbacks
|
219
|
+
create: null
|
150
220
|
},
|
151
221
|
_createWidget: function( options, element ) {
|
152
|
-
|
153
|
-
// so that it's stored even before the _create function runs
|
154
|
-
$.data( element, this.widgetName, this );
|
222
|
+
element = $( element || this.defaultElement || this )[ 0 ];
|
155
223
|
this.element = $( element );
|
156
|
-
this.
|
224
|
+
this.uuid = uuid++;
|
225
|
+
this.eventNamespace = "." + this.widgetName + this.uuid;
|
226
|
+
this.options = $.widget.extend( {},
|
157
227
|
this.options,
|
158
228
|
this._getCreateOptions(),
|
159
229
|
options );
|
160
230
|
|
161
|
-
|
162
|
-
this.
|
163
|
-
|
164
|
-
|
231
|
+
this.bindings = $();
|
232
|
+
this.hoverable = $();
|
233
|
+
this.focusable = $();
|
234
|
+
|
235
|
+
if ( element !== this ) {
|
236
|
+
// 1.9 BC for #7810
|
237
|
+
// TODO remove dual storage
|
238
|
+
$.data( element, this.widgetName, this );
|
239
|
+
$.data( element, this.widgetFullName, this );
|
240
|
+
this._on( true, this.element, {
|
241
|
+
remove: function( event ) {
|
242
|
+
if ( event.target === element ) {
|
243
|
+
this.destroy();
|
244
|
+
}
|
245
|
+
}
|
246
|
+
});
|
247
|
+
this.document = $( element.style ?
|
248
|
+
// element within the document
|
249
|
+
element.ownerDocument :
|
250
|
+
// element is window or document
|
251
|
+
element.document || element );
|
252
|
+
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
|
253
|
+
}
|
165
254
|
|
166
255
|
this._create();
|
167
|
-
this._trigger( "create" );
|
256
|
+
this._trigger( "create", null, this._getCreateEventData() );
|
168
257
|
this._init();
|
169
258
|
},
|
170
|
-
_getCreateOptions:
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
_init: function() {},
|
259
|
+
_getCreateOptions: $.noop,
|
260
|
+
_getCreateEventData: $.noop,
|
261
|
+
_create: $.noop,
|
262
|
+
_init: $.noop,
|
175
263
|
|
176
264
|
destroy: function() {
|
265
|
+
this._destroy();
|
266
|
+
// we can probably remove the unbind calls in 2.0
|
267
|
+
// all event bindings should go through this._on()
|
177
268
|
this.element
|
178
|
-
.unbind(
|
179
|
-
|
269
|
+
.unbind( this.eventNamespace )
|
270
|
+
// 1.9 BC for #7810
|
271
|
+
// TODO remove dual storage
|
272
|
+
.removeData( this.widgetName )
|
273
|
+
.removeData( this.widgetFullName )
|
274
|
+
// support: jquery <1.6.3
|
275
|
+
// http://bugs.jquery.com/ticket/9413
|
276
|
+
.removeData( $.camelCase( this.widgetFullName ) );
|
180
277
|
this.widget()
|
181
|
-
.unbind(
|
278
|
+
.unbind( this.eventNamespace )
|
182
279
|
.removeAttr( "aria-disabled" )
|
183
280
|
.removeClass(
|
184
|
-
this.
|
281
|
+
this.widgetFullName + "-disabled " +
|
185
282
|
"ui-state-disabled" );
|
283
|
+
|
284
|
+
// clean up events and states
|
285
|
+
this.bindings.unbind( this.eventNamespace );
|
286
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
287
|
+
this.focusable.removeClass( "ui-state-focus" );
|
186
288
|
},
|
289
|
+
_destroy: $.noop,
|
187
290
|
|
188
291
|
widget: function() {
|
189
292
|
return this.element;
|
190
293
|
},
|
191
294
|
|
192
295
|
option: function( key, value ) {
|
193
|
-
var options = key
|
296
|
+
var options = key,
|
297
|
+
parts,
|
298
|
+
curOption,
|
299
|
+
i;
|
194
300
|
|
195
301
|
if ( arguments.length === 0 ) {
|
196
302
|
// don't return a reference to the internal hash
|
197
|
-
return $.extend( {}, this.options );
|
303
|
+
return $.widget.extend( {}, this.options );
|
198
304
|
}
|
199
305
|
|
200
|
-
if
|
201
|
-
|
202
|
-
return this.options[ key ];
|
203
|
-
}
|
306
|
+
if ( typeof key === "string" ) {
|
307
|
+
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
204
308
|
options = {};
|
205
|
-
|
309
|
+
parts = key.split( "." );
|
310
|
+
key = parts.shift();
|
311
|
+
if ( parts.length ) {
|
312
|
+
curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
|
313
|
+
for ( i = 0; i < parts.length - 1; i++ ) {
|
314
|
+
curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
|
315
|
+
curOption = curOption[ parts[ i ] ];
|
316
|
+
}
|
317
|
+
key = parts.pop();
|
318
|
+
if ( value === undefined ) {
|
319
|
+
return curOption[ key ] === undefined ? null : curOption[ key ];
|
320
|
+
}
|
321
|
+
curOption[ key ] = value;
|
322
|
+
} else {
|
323
|
+
if ( value === undefined ) {
|
324
|
+
return this.options[ key ] === undefined ? null : this.options[ key ];
|
325
|
+
}
|
326
|
+
options[ key ] = value;
|
327
|
+
}
|
206
328
|
}
|
207
329
|
|
208
330
|
this._setOptions( options );
|
@@ -210,10 +332,11 @@ $.Widget.prototype = {
|
|
210
332
|
return this;
|
211
333
|
},
|
212
334
|
_setOptions: function( options ) {
|
213
|
-
var
|
214
|
-
|
215
|
-
|
216
|
-
|
335
|
+
var key;
|
336
|
+
|
337
|
+
for ( key in options ) {
|
338
|
+
this._setOption( key, options[ key ] );
|
339
|
+
}
|
217
340
|
|
218
341
|
return this;
|
219
342
|
},
|
@@ -222,10 +345,10 @@ $.Widget.prototype = {
|
|
222
345
|
|
223
346
|
if ( key === "disabled" ) {
|
224
347
|
this.widget()
|
225
|
-
|
226
|
-
this.widgetBaseClass + "-disabled" + " " +
|
227
|
-
"ui-state-disabled" )
|
348
|
+
.toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
|
228
349
|
.attr( "aria-disabled", value );
|
350
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
351
|
+
this.focusable.removeClass( "ui-state-focus" );
|
229
352
|
}
|
230
353
|
|
231
354
|
return this;
|
@@ -238,6 +361,97 @@ $.Widget.prototype = {
|
|
238
361
|
return this._setOption( "disabled", true );
|
239
362
|
},
|
240
363
|
|
364
|
+
_on: function( suppressDisabledCheck, element, handlers ) {
|
365
|
+
var delegateElement,
|
366
|
+
instance = this;
|
367
|
+
|
368
|
+
// no suppressDisabledCheck flag, shuffle arguments
|
369
|
+
if ( typeof suppressDisabledCheck !== "boolean" ) {
|
370
|
+
handlers = element;
|
371
|
+
element = suppressDisabledCheck;
|
372
|
+
suppressDisabledCheck = false;
|
373
|
+
}
|
374
|
+
|
375
|
+
// no element argument, shuffle and use this.element
|
376
|
+
if ( !handlers ) {
|
377
|
+
handlers = element;
|
378
|
+
element = this.element;
|
379
|
+
delegateElement = this.widget();
|
380
|
+
} else {
|
381
|
+
// accept selectors, DOM elements
|
382
|
+
element = delegateElement = $( element );
|
383
|
+
this.bindings = this.bindings.add( element );
|
384
|
+
}
|
385
|
+
|
386
|
+
$.each( handlers, function( event, handler ) {
|
387
|
+
function handlerProxy() {
|
388
|
+
// allow widgets to customize the disabled handling
|
389
|
+
// - disabled as an array instead of boolean
|
390
|
+
// - disabled class as method for disabling individual parts
|
391
|
+
if ( !suppressDisabledCheck &&
|
392
|
+
( instance.options.disabled === true ||
|
393
|
+
$( this ).hasClass( "ui-state-disabled" ) ) ) {
|
394
|
+
return;
|
395
|
+
}
|
396
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
397
|
+
.apply( instance, arguments );
|
398
|
+
}
|
399
|
+
|
400
|
+
// copy the guid so direct unbinding works
|
401
|
+
if ( typeof handler !== "string" ) {
|
402
|
+
handlerProxy.guid = handler.guid =
|
403
|
+
handler.guid || handlerProxy.guid || $.guid++;
|
404
|
+
}
|
405
|
+
|
406
|
+
var match = event.match( /^(\w+)\s*(.*)$/ ),
|
407
|
+
eventName = match[1] + instance.eventNamespace,
|
408
|
+
selector = match[2];
|
409
|
+
if ( selector ) {
|
410
|
+
delegateElement.delegate( selector, eventName, handlerProxy );
|
411
|
+
} else {
|
412
|
+
element.bind( eventName, handlerProxy );
|
413
|
+
}
|
414
|
+
});
|
415
|
+
},
|
416
|
+
|
417
|
+
_off: function( element, eventName ) {
|
418
|
+
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
|
419
|
+
element.unbind( eventName ).undelegate( eventName );
|
420
|
+
},
|
421
|
+
|
422
|
+
_delay: function( handler, delay ) {
|
423
|
+
function handlerProxy() {
|
424
|
+
return ( typeof handler === "string" ? instance[ handler ] : handler )
|
425
|
+
.apply( instance, arguments );
|
426
|
+
}
|
427
|
+
var instance = this;
|
428
|
+
return setTimeout( handlerProxy, delay || 0 );
|
429
|
+
},
|
430
|
+
|
431
|
+
_hoverable: function( element ) {
|
432
|
+
this.hoverable = this.hoverable.add( element );
|
433
|
+
this._on( element, {
|
434
|
+
mouseenter: function( event ) {
|
435
|
+
$( event.currentTarget ).addClass( "ui-state-hover" );
|
436
|
+
},
|
437
|
+
mouseleave: function( event ) {
|
438
|
+
$( event.currentTarget ).removeClass( "ui-state-hover" );
|
439
|
+
}
|
440
|
+
});
|
441
|
+
},
|
442
|
+
|
443
|
+
_focusable: function( element ) {
|
444
|
+
this.focusable = this.focusable.add( element );
|
445
|
+
this._on( element, {
|
446
|
+
focusin: function( event ) {
|
447
|
+
$( event.currentTarget ).addClass( "ui-state-focus" );
|
448
|
+
},
|
449
|
+
focusout: function( event ) {
|
450
|
+
$( event.currentTarget ).removeClass( "ui-state-focus" );
|
451
|
+
}
|
452
|
+
});
|
453
|
+
},
|
454
|
+
|
241
455
|
_trigger: function( type, event, data ) {
|
242
456
|
var prop, orig,
|
243
457
|
callback = this.options[ type ];
|
@@ -262,11 +476,53 @@ $.Widget.prototype = {
|
|
262
476
|
}
|
263
477
|
|
264
478
|
this.element.trigger( event, data );
|
265
|
-
|
266
|
-
|
267
|
-
callback.call( this.element[0], event, data ) === false ||
|
479
|
+
return !( $.isFunction( callback ) &&
|
480
|
+
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
|
268
481
|
event.isDefaultPrevented() );
|
269
482
|
}
|
270
483
|
};
|
271
484
|
|
485
|
+
$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
486
|
+
$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
|
487
|
+
if ( typeof options === "string" ) {
|
488
|
+
options = { effect: options };
|
489
|
+
}
|
490
|
+
var hasOptions,
|
491
|
+
effectName = !options ?
|
492
|
+
method :
|
493
|
+
options === true || typeof options === "number" ?
|
494
|
+
defaultEffect :
|
495
|
+
options.effect || defaultEffect;
|
496
|
+
options = options || {};
|
497
|
+
if ( typeof options === "number" ) {
|
498
|
+
options = { duration: options };
|
499
|
+
}
|
500
|
+
hasOptions = !$.isEmptyObject( options );
|
501
|
+
options.complete = callback;
|
502
|
+
if ( options.delay ) {
|
503
|
+
element.delay( options.delay );
|
504
|
+
}
|
505
|
+
if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
|
506
|
+
element[ method ]( options );
|
507
|
+
} else if ( effectName !== method && element[ effectName ] ) {
|
508
|
+
element[ effectName ]( options.duration, options.easing, callback );
|
509
|
+
} else {
|
510
|
+
element.queue(function( next ) {
|
511
|
+
$( this )[ method ]();
|
512
|
+
if ( callback ) {
|
513
|
+
callback.call( element[ 0 ] );
|
514
|
+
}
|
515
|
+
next();
|
516
|
+
});
|
517
|
+
}
|
518
|
+
};
|
519
|
+
});
|
520
|
+
|
521
|
+
// DEPRECATED
|
522
|
+
if ( $.uiBackCompat !== false ) {
|
523
|
+
$.Widget.prototype._getCreateOptions = function() {
|
524
|
+
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
|
525
|
+
};
|
526
|
+
}
|
527
|
+
|
272
528
|
})( jQuery );
|