jquery-ui-middleman 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.travis.yml +2 -0
- data/Gemfile +3 -0
- data/History.md +115 -0
- data/License.txt +2 -0
- data/README.md +226 -0
- data/Rakefile +221 -0
- data/VERSIONS.md +27 -0
- data/app/assets/images/jquery-ui/animated-overlay.gif +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/javascripts/jquery.ui.accordion.js +575 -0
- data/app/assets/javascripts/jquery.ui.all.js +34 -0
- data/app/assets/javascripts/jquery.ui.autocomplete.js +615 -0
- data/app/assets/javascripts/jquery.ui.button.js +422 -0
- data/app/assets/javascripts/jquery.ui.core.js +320 -0
- data/app/assets/javascripts/jquery.ui.datepicker-af.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ar.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-az.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-bg.js +24 -0
- data/app/assets/javascripts/jquery.ui.datepicker-bs.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ca.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-cs.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-cy-GB.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-da.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-de.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-el.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-en-AU.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-en-GB.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-en-NZ.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-eo.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-es.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-et.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-eu.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-fa.js +59 -0
- data/app/assets/javascripts/jquery.ui.datepicker-fi.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-fo.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-fr.js +25 -0
- data/app/assets/javascripts/jquery.ui.datepicker-gl.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-he.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-hi.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-hr.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-hu.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-hy.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-id.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-is.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-it.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ja.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ka.js +21 -0
- data/app/assets/javascripts/jquery.ui.datepicker-kk.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-km.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ko.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
- data/app/assets/javascripts/jquery.ui.datepicker-lb.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-lt.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-lv.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-mk.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ml.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ms.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
- data/app/assets/javascripts/jquery.ui.datepicker-nl-BE.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-nl.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
- data/app/assets/javascripts/jquery.ui.datepicker-no.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-pl.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-pt-BR.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-pt.js +22 -0
- data/app/assets/javascripts/jquery.ui.datepicker-rm.js +21 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ro.js +26 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ru.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-sk.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-sl.js +24 -0
- data/app/assets/javascripts/jquery.ui.datepicker-sq.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-sr-SR.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-sr.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-sv.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-ta.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-th.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-tj.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-tr.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-uk.js +24 -0
- data/app/assets/javascripts/jquery.ui.datepicker-vi.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-zh-CN.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-zh-HK.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker-zh-TW.js +23 -0
- data/app/assets/javascripts/jquery.ui.datepicker.js +2040 -0
- data/app/assets/javascripts/jquery.ui.dialog.js +815 -0
- data/app/assets/javascripts/jquery.ui.draggable.js +962 -0
- data/app/assets/javascripts/jquery.ui.droppable.js +377 -0
- data/app/assets/javascripts/jquery.ui.effect-blind.js +84 -0
- data/app/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
- data/app/assets/javascripts/jquery.ui.effect-clip.js +69 -0
- data/app/assets/javascripts/jquery.ui.effect-drop.js +67 -0
- data/app/assets/javascripts/jquery.ui.effect-explode.js +99 -0
- data/app/assets/javascripts/jquery.ui.effect-fade.js +32 -0
- data/app/assets/javascripts/jquery.ui.effect-fold.js +78 -0
- data/app/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
- data/app/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
- data/app/assets/javascripts/jquery.ui.effect-scale.js +320 -0
- data/app/assets/javascripts/jquery.ui.effect-shake.js +76 -0
- data/app/assets/javascripts/jquery.ui.effect-slide.js +66 -0
- data/app/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
- data/app/assets/javascripts/jquery.ui.effect.all.js +14 -0
- data/app/assets/javascripts/jquery.ui.effect.js +1289 -0
- data/app/assets/javascripts/jquery.ui.menu.js +625 -0
- data/app/assets/javascripts/jquery.ui.mouse.js +172 -0
- data/app/assets/javascripts/jquery.ui.position.js +497 -0
- data/app/assets/javascripts/jquery.ui.progressbar.js +148 -0
- data/app/assets/javascripts/jquery.ui.resizable.js +972 -0
- data/app/assets/javascripts/jquery.ui.selectable.js +281 -0
- data/app/assets/javascripts/jquery.ui.slider.js +676 -0
- data/app/assets/javascripts/jquery.ui.sortable.js +1289 -0
- data/app/assets/javascripts/jquery.ui.spinner.js +497 -0
- data/app/assets/javascripts/jquery.ui.tabs.js +849 -0
- data/app/assets/javascripts/jquery.ui.tooltip.js +406 -0
- data/app/assets/javascripts/jquery.ui.widget.js +521 -0
- data/app/assets/stylesheets/jquery.ui.accordion.css.erb +42 -0
- data/app/assets/stylesheets/jquery.ui.all.css.erb +14 -0
- data/app/assets/stylesheets/jquery.ui.autocomplete.css.erb +21 -0
- data/app/assets/stylesheets/jquery.ui.base.css.erb +27 -0
- data/app/assets/stylesheets/jquery.ui.button.css.erb +118 -0
- data/app/assets/stylesheets/jquery.ui.core.css.erb +93 -0
- data/app/assets/stylesheets/jquery.ui.datepicker.css.erb +182 -0
- data/app/assets/stylesheets/jquery.ui.dialog.css.erb +75 -0
- data/app/assets/stylesheets/jquery.ui.menu.css.erb +83 -0
- data/app/assets/stylesheets/jquery.ui.progressbar.css.erb +32 -0
- data/app/assets/stylesheets/jquery.ui.resizable.css.erb +82 -0
- data/app/assets/stylesheets/jquery.ui.selectable.css.erb +19 -0
- data/app/assets/stylesheets/jquery.ui.slider.css.erb +77 -0
- data/app/assets/stylesheets/jquery.ui.spinner.css.erb +70 -0
- data/app/assets/stylesheets/jquery.ui.tabs.css.erb +56 -0
- data/app/assets/stylesheets/jquery.ui.theme.css.erb +409 -0
- data/app/assets/stylesheets/jquery.ui.tooltip.css.erb +23 -0
- data/lib/jquery-ui-middleman.rb +1 -0
- data/lib/jquery/ui/version.rb +6 -0
- metadata +209 -0
@@ -0,0 +1,815 @@
|
|
1
|
+
//= require jquery.ui.core
|
2
|
+
//= require jquery.ui.widget
|
3
|
+
//= require jquery.ui.button
|
4
|
+
//= require jquery.ui.draggable
|
5
|
+
//= require jquery.ui.position
|
6
|
+
//= require jquery.ui.resizable
|
7
|
+
|
8
|
+
/*!
|
9
|
+
* jQuery UI Dialog 1.10.3
|
10
|
+
* http://jqueryui.com
|
11
|
+
*
|
12
|
+
* Copyright 2013 jQuery Foundation and other contributors
|
13
|
+
* Released under the MIT license.
|
14
|
+
* http://jquery.org/license
|
15
|
+
*
|
16
|
+
* http://api.jqueryui.com/dialog/
|
17
|
+
*
|
18
|
+
* Depends:
|
19
|
+
* jquery.ui.core.js
|
20
|
+
* jquery.ui.widget.js
|
21
|
+
* jquery.ui.button.js
|
22
|
+
* jquery.ui.draggable.js
|
23
|
+
* jquery.ui.mouse.js
|
24
|
+
* jquery.ui.position.js
|
25
|
+
* jquery.ui.resizable.js
|
26
|
+
*/
|
27
|
+
(function( $, undefined ) {
|
28
|
+
|
29
|
+
var sizeRelatedOptions = {
|
30
|
+
buttons: true,
|
31
|
+
height: true,
|
32
|
+
maxHeight: true,
|
33
|
+
maxWidth: true,
|
34
|
+
minHeight: true,
|
35
|
+
minWidth: true,
|
36
|
+
width: true
|
37
|
+
},
|
38
|
+
resizableRelatedOptions = {
|
39
|
+
maxHeight: true,
|
40
|
+
maxWidth: true,
|
41
|
+
minHeight: true,
|
42
|
+
minWidth: true
|
43
|
+
};
|
44
|
+
|
45
|
+
$.widget( "ui.dialog", {
|
46
|
+
version: "1.10.3",
|
47
|
+
options: {
|
48
|
+
appendTo: "body",
|
49
|
+
autoOpen: true,
|
50
|
+
buttons: [],
|
51
|
+
closeOnEscape: true,
|
52
|
+
closeText: "close",
|
53
|
+
dialogClass: "",
|
54
|
+
draggable: true,
|
55
|
+
hide: null,
|
56
|
+
height: "auto",
|
57
|
+
maxHeight: null,
|
58
|
+
maxWidth: null,
|
59
|
+
minHeight: 150,
|
60
|
+
minWidth: 150,
|
61
|
+
modal: false,
|
62
|
+
position: {
|
63
|
+
my: "center",
|
64
|
+
at: "center",
|
65
|
+
of: window,
|
66
|
+
collision: "fit",
|
67
|
+
// Ensure the titlebar is always visible
|
68
|
+
using: function( pos ) {
|
69
|
+
var topOffset = $( this ).css( pos ).offset().top;
|
70
|
+
if ( topOffset < 0 ) {
|
71
|
+
$( this ).css( "top", pos.top - topOffset );
|
72
|
+
}
|
73
|
+
}
|
74
|
+
},
|
75
|
+
resizable: true,
|
76
|
+
show: null,
|
77
|
+
title: null,
|
78
|
+
width: 300,
|
79
|
+
|
80
|
+
// callbacks
|
81
|
+
beforeClose: null,
|
82
|
+
close: null,
|
83
|
+
drag: null,
|
84
|
+
dragStart: null,
|
85
|
+
dragStop: null,
|
86
|
+
focus: null,
|
87
|
+
open: null,
|
88
|
+
resize: null,
|
89
|
+
resizeStart: null,
|
90
|
+
resizeStop: null
|
91
|
+
},
|
92
|
+
|
93
|
+
_create: function() {
|
94
|
+
this.originalCss = {
|
95
|
+
display: this.element[0].style.display,
|
96
|
+
width: this.element[0].style.width,
|
97
|
+
minHeight: this.element[0].style.minHeight,
|
98
|
+
maxHeight: this.element[0].style.maxHeight,
|
99
|
+
height: this.element[0].style.height
|
100
|
+
};
|
101
|
+
this.originalPosition = {
|
102
|
+
parent: this.element.parent(),
|
103
|
+
index: this.element.parent().children().index( this.element )
|
104
|
+
};
|
105
|
+
this.originalTitle = this.element.attr("title");
|
106
|
+
this.options.title = this.options.title || this.originalTitle;
|
107
|
+
|
108
|
+
this._createWrapper();
|
109
|
+
|
110
|
+
this.element
|
111
|
+
.show()
|
112
|
+
.removeAttr("title")
|
113
|
+
.addClass("ui-dialog-content ui-widget-content")
|
114
|
+
.appendTo( this.uiDialog );
|
115
|
+
|
116
|
+
this._createTitlebar();
|
117
|
+
this._createButtonPane();
|
118
|
+
|
119
|
+
if ( this.options.draggable && $.fn.draggable ) {
|
120
|
+
this._makeDraggable();
|
121
|
+
}
|
122
|
+
if ( this.options.resizable && $.fn.resizable ) {
|
123
|
+
this._makeResizable();
|
124
|
+
}
|
125
|
+
|
126
|
+
this._isOpen = false;
|
127
|
+
},
|
128
|
+
|
129
|
+
_init: function() {
|
130
|
+
if ( this.options.autoOpen ) {
|
131
|
+
this.open();
|
132
|
+
}
|
133
|
+
},
|
134
|
+
|
135
|
+
_appendTo: function() {
|
136
|
+
var element = this.options.appendTo;
|
137
|
+
if ( element && (element.jquery || element.nodeType) ) {
|
138
|
+
return $( element );
|
139
|
+
}
|
140
|
+
return this.document.find( element || "body" ).eq( 0 );
|
141
|
+
},
|
142
|
+
|
143
|
+
_destroy: function() {
|
144
|
+
var next,
|
145
|
+
originalPosition = this.originalPosition;
|
146
|
+
|
147
|
+
this._destroyOverlay();
|
148
|
+
|
149
|
+
this.element
|
150
|
+
.removeUniqueId()
|
151
|
+
.removeClass("ui-dialog-content ui-widget-content")
|
152
|
+
.css( this.originalCss )
|
153
|
+
// Without detaching first, the following becomes really slow
|
154
|
+
.detach();
|
155
|
+
|
156
|
+
this.uiDialog.stop( true, true ).remove();
|
157
|
+
|
158
|
+
if ( this.originalTitle ) {
|
159
|
+
this.element.attr( "title", this.originalTitle );
|
160
|
+
}
|
161
|
+
|
162
|
+
next = originalPosition.parent.children().eq( originalPosition.index );
|
163
|
+
// Don't try to place the dialog next to itself (#8613)
|
164
|
+
if ( next.length && next[0] !== this.element[0] ) {
|
165
|
+
next.before( this.element );
|
166
|
+
} else {
|
167
|
+
originalPosition.parent.append( this.element );
|
168
|
+
}
|
169
|
+
},
|
170
|
+
|
171
|
+
widget: function() {
|
172
|
+
return this.uiDialog;
|
173
|
+
},
|
174
|
+
|
175
|
+
disable: $.noop,
|
176
|
+
enable: $.noop,
|
177
|
+
|
178
|
+
close: function( event ) {
|
179
|
+
var that = this;
|
180
|
+
|
181
|
+
if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
|
185
|
+
this._isOpen = false;
|
186
|
+
this._destroyOverlay();
|
187
|
+
|
188
|
+
if ( !this.opener.filter(":focusable").focus().length ) {
|
189
|
+
// Hiding a focused element doesn't trigger blur in WebKit
|
190
|
+
// so in case we have nothing to focus on, explicitly blur the active element
|
191
|
+
// https://bugs.webkit.org/show_bug.cgi?id=47182
|
192
|
+
$( this.document[0].activeElement ).blur();
|
193
|
+
}
|
194
|
+
|
195
|
+
this._hide( this.uiDialog, this.options.hide, function() {
|
196
|
+
that._trigger( "close", event );
|
197
|
+
});
|
198
|
+
},
|
199
|
+
|
200
|
+
isOpen: function() {
|
201
|
+
return this._isOpen;
|
202
|
+
},
|
203
|
+
|
204
|
+
moveToTop: function() {
|
205
|
+
this._moveToTop();
|
206
|
+
},
|
207
|
+
|
208
|
+
_moveToTop: function( event, silent ) {
|
209
|
+
var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length;
|
210
|
+
if ( moved && !silent ) {
|
211
|
+
this._trigger( "focus", event );
|
212
|
+
}
|
213
|
+
return moved;
|
214
|
+
},
|
215
|
+
|
216
|
+
open: function() {
|
217
|
+
var that = this;
|
218
|
+
if ( this._isOpen ) {
|
219
|
+
if ( this._moveToTop() ) {
|
220
|
+
this._focusTabbable();
|
221
|
+
}
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
|
225
|
+
this._isOpen = true;
|
226
|
+
this.opener = $( this.document[0].activeElement );
|
227
|
+
|
228
|
+
this._size();
|
229
|
+
this._position();
|
230
|
+
this._createOverlay();
|
231
|
+
this._moveToTop( null, true );
|
232
|
+
this._show( this.uiDialog, this.options.show, function() {
|
233
|
+
that._focusTabbable();
|
234
|
+
that._trigger("focus");
|
235
|
+
});
|
236
|
+
|
237
|
+
this._trigger("open");
|
238
|
+
},
|
239
|
+
|
240
|
+
_focusTabbable: function() {
|
241
|
+
// Set focus to the first match:
|
242
|
+
// 1. First element inside the dialog matching [autofocus]
|
243
|
+
// 2. Tabbable element inside the content element
|
244
|
+
// 3. Tabbable element inside the buttonpane
|
245
|
+
// 4. The close button
|
246
|
+
// 5. The dialog itself
|
247
|
+
var hasFocus = this.element.find("[autofocus]");
|
248
|
+
if ( !hasFocus.length ) {
|
249
|
+
hasFocus = this.element.find(":tabbable");
|
250
|
+
}
|
251
|
+
if ( !hasFocus.length ) {
|
252
|
+
hasFocus = this.uiDialogButtonPane.find(":tabbable");
|
253
|
+
}
|
254
|
+
if ( !hasFocus.length ) {
|
255
|
+
hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
|
256
|
+
}
|
257
|
+
if ( !hasFocus.length ) {
|
258
|
+
hasFocus = this.uiDialog;
|
259
|
+
}
|
260
|
+
hasFocus.eq( 0 ).focus();
|
261
|
+
},
|
262
|
+
|
263
|
+
_keepFocus: function( event ) {
|
264
|
+
function checkFocus() {
|
265
|
+
var activeElement = this.document[0].activeElement,
|
266
|
+
isActive = this.uiDialog[0] === activeElement ||
|
267
|
+
$.contains( this.uiDialog[0], activeElement );
|
268
|
+
if ( !isActive ) {
|
269
|
+
this._focusTabbable();
|
270
|
+
}
|
271
|
+
}
|
272
|
+
event.preventDefault();
|
273
|
+
checkFocus.call( this );
|
274
|
+
// support: IE
|
275
|
+
// IE <= 8 doesn't prevent moving focus even with event.preventDefault()
|
276
|
+
// so we check again later
|
277
|
+
this._delay( checkFocus );
|
278
|
+
},
|
279
|
+
|
280
|
+
_createWrapper: function() {
|
281
|
+
this.uiDialog = $("<div>")
|
282
|
+
.addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
|
283
|
+
this.options.dialogClass )
|
284
|
+
.hide()
|
285
|
+
.attr({
|
286
|
+
// Setting tabIndex makes the div focusable
|
287
|
+
tabIndex: -1,
|
288
|
+
role: "dialog"
|
289
|
+
})
|
290
|
+
.appendTo( this._appendTo() );
|
291
|
+
|
292
|
+
this._on( this.uiDialog, {
|
293
|
+
keydown: function( event ) {
|
294
|
+
if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
|
295
|
+
event.keyCode === $.ui.keyCode.ESCAPE ) {
|
296
|
+
event.preventDefault();
|
297
|
+
this.close( event );
|
298
|
+
return;
|
299
|
+
}
|
300
|
+
|
301
|
+
// prevent tabbing out of dialogs
|
302
|
+
if ( event.keyCode !== $.ui.keyCode.TAB ) {
|
303
|
+
return;
|
304
|
+
}
|
305
|
+
var tabbables = this.uiDialog.find(":tabbable"),
|
306
|
+
first = tabbables.filter(":first"),
|
307
|
+
last = tabbables.filter(":last");
|
308
|
+
|
309
|
+
if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
|
310
|
+
first.focus( 1 );
|
311
|
+
event.preventDefault();
|
312
|
+
} else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
|
313
|
+
last.focus( 1 );
|
314
|
+
event.preventDefault();
|
315
|
+
}
|
316
|
+
},
|
317
|
+
mousedown: function( event ) {
|
318
|
+
if ( this._moveToTop( event ) ) {
|
319
|
+
this._focusTabbable();
|
320
|
+
}
|
321
|
+
}
|
322
|
+
});
|
323
|
+
|
324
|
+
// We assume that any existing aria-describedby attribute means
|
325
|
+
// that the dialog content is marked up properly
|
326
|
+
// otherwise we brute force the content as the description
|
327
|
+
if ( !this.element.find("[aria-describedby]").length ) {
|
328
|
+
this.uiDialog.attr({
|
329
|
+
"aria-describedby": this.element.uniqueId().attr("id")
|
330
|
+
});
|
331
|
+
}
|
332
|
+
},
|
333
|
+
|
334
|
+
_createTitlebar: function() {
|
335
|
+
var uiDialogTitle;
|
336
|
+
|
337
|
+
this.uiDialogTitlebar = $("<div>")
|
338
|
+
.addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix")
|
339
|
+
.prependTo( this.uiDialog );
|
340
|
+
this._on( this.uiDialogTitlebar, {
|
341
|
+
mousedown: function( event ) {
|
342
|
+
// Don't prevent click on close button (#8838)
|
343
|
+
// Focusing a dialog that is partially scrolled out of view
|
344
|
+
// causes the browser to scroll it into view, preventing the click event
|
345
|
+
if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) {
|
346
|
+
// Dialog isn't getting focus when dragging (#8063)
|
347
|
+
this.uiDialog.focus();
|
348
|
+
}
|
349
|
+
}
|
350
|
+
});
|
351
|
+
|
352
|
+
this.uiDialogTitlebarClose = $("<button></button>")
|
353
|
+
.button({
|
354
|
+
label: this.options.closeText,
|
355
|
+
icons: {
|
356
|
+
primary: "ui-icon-closethick"
|
357
|
+
},
|
358
|
+
text: false
|
359
|
+
})
|
360
|
+
.addClass("ui-dialog-titlebar-close")
|
361
|
+
.appendTo( this.uiDialogTitlebar );
|
362
|
+
this._on( this.uiDialogTitlebarClose, {
|
363
|
+
click: function( event ) {
|
364
|
+
event.preventDefault();
|
365
|
+
this.close( event );
|
366
|
+
}
|
367
|
+
});
|
368
|
+
|
369
|
+
uiDialogTitle = $("<span>")
|
370
|
+
.uniqueId()
|
371
|
+
.addClass("ui-dialog-title")
|
372
|
+
.prependTo( this.uiDialogTitlebar );
|
373
|
+
this._title( uiDialogTitle );
|
374
|
+
|
375
|
+
this.uiDialog.attr({
|
376
|
+
"aria-labelledby": uiDialogTitle.attr("id")
|
377
|
+
});
|
378
|
+
},
|
379
|
+
|
380
|
+
_title: function( title ) {
|
381
|
+
if ( !this.options.title ) {
|
382
|
+
title.html(" ");
|
383
|
+
}
|
384
|
+
title.text( this.options.title );
|
385
|
+
},
|
386
|
+
|
387
|
+
_createButtonPane: function() {
|
388
|
+
this.uiDialogButtonPane = $("<div>")
|
389
|
+
.addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
|
390
|
+
|
391
|
+
this.uiButtonSet = $("<div>")
|
392
|
+
.addClass("ui-dialog-buttonset")
|
393
|
+
.appendTo( this.uiDialogButtonPane );
|
394
|
+
|
395
|
+
this._createButtons();
|
396
|
+
},
|
397
|
+
|
398
|
+
_createButtons: function() {
|
399
|
+
var that = this,
|
400
|
+
buttons = this.options.buttons;
|
401
|
+
|
402
|
+
// if we already have a button pane, remove it
|
403
|
+
this.uiDialogButtonPane.remove();
|
404
|
+
this.uiButtonSet.empty();
|
405
|
+
|
406
|
+
if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
|
407
|
+
this.uiDialog.removeClass("ui-dialog-buttons");
|
408
|
+
return;
|
409
|
+
}
|
410
|
+
|
411
|
+
$.each( buttons, function( name, props ) {
|
412
|
+
var click, buttonOptions;
|
413
|
+
props = $.isFunction( props ) ?
|
414
|
+
{ click: props, text: name } :
|
415
|
+
props;
|
416
|
+
// Default to a non-submitting button
|
417
|
+
props = $.extend( { type: "button" }, props );
|
418
|
+
// Change the context for the click callback to be the main element
|
419
|
+
click = props.click;
|
420
|
+
props.click = function() {
|
421
|
+
click.apply( that.element[0], arguments );
|
422
|
+
};
|
423
|
+
buttonOptions = {
|
424
|
+
icons: props.icons,
|
425
|
+
text: props.showText
|
426
|
+
};
|
427
|
+
delete props.icons;
|
428
|
+
delete props.showText;
|
429
|
+
$( "<button></button>", props )
|
430
|
+
.button( buttonOptions )
|
431
|
+
.appendTo( that.uiButtonSet );
|
432
|
+
});
|
433
|
+
this.uiDialog.addClass("ui-dialog-buttons");
|
434
|
+
this.uiDialogButtonPane.appendTo( this.uiDialog );
|
435
|
+
},
|
436
|
+
|
437
|
+
_makeDraggable: function() {
|
438
|
+
var that = this,
|
439
|
+
options = this.options;
|
440
|
+
|
441
|
+
function filteredUi( ui ) {
|
442
|
+
return {
|
443
|
+
position: ui.position,
|
444
|
+
offset: ui.offset
|
445
|
+
};
|
446
|
+
}
|
447
|
+
|
448
|
+
this.uiDialog.draggable({
|
449
|
+
cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
|
450
|
+
handle: ".ui-dialog-titlebar",
|
451
|
+
containment: "document",
|
452
|
+
start: function( event, ui ) {
|
453
|
+
$( this ).addClass("ui-dialog-dragging");
|
454
|
+
that._blockFrames();
|
455
|
+
that._trigger( "dragStart", event, filteredUi( ui ) );
|
456
|
+
},
|
457
|
+
drag: function( event, ui ) {
|
458
|
+
that._trigger( "drag", event, filteredUi( ui ) );
|
459
|
+
},
|
460
|
+
stop: function( event, ui ) {
|
461
|
+
options.position = [
|
462
|
+
ui.position.left - that.document.scrollLeft(),
|
463
|
+
ui.position.top - that.document.scrollTop()
|
464
|
+
];
|
465
|
+
$( this ).removeClass("ui-dialog-dragging");
|
466
|
+
that._unblockFrames();
|
467
|
+
that._trigger( "dragStop", event, filteredUi( ui ) );
|
468
|
+
}
|
469
|
+
});
|
470
|
+
},
|
471
|
+
|
472
|
+
_makeResizable: function() {
|
473
|
+
var that = this,
|
474
|
+
options = this.options,
|
475
|
+
handles = options.resizable,
|
476
|
+
// .ui-resizable has position: relative defined in the stylesheet
|
477
|
+
// but dialogs have to use absolute or fixed positioning
|
478
|
+
position = this.uiDialog.css("position"),
|
479
|
+
resizeHandles = typeof handles === "string" ?
|
480
|
+
handles :
|
481
|
+
"n,e,s,w,se,sw,ne,nw";
|
482
|
+
|
483
|
+
function filteredUi( ui ) {
|
484
|
+
return {
|
485
|
+
originalPosition: ui.originalPosition,
|
486
|
+
originalSize: ui.originalSize,
|
487
|
+
position: ui.position,
|
488
|
+
size: ui.size
|
489
|
+
};
|
490
|
+
}
|
491
|
+
|
492
|
+
this.uiDialog.resizable({
|
493
|
+
cancel: ".ui-dialog-content",
|
494
|
+
containment: "document",
|
495
|
+
alsoResize: this.element,
|
496
|
+
maxWidth: options.maxWidth,
|
497
|
+
maxHeight: options.maxHeight,
|
498
|
+
minWidth: options.minWidth,
|
499
|
+
minHeight: this._minHeight(),
|
500
|
+
handles: resizeHandles,
|
501
|
+
start: function( event, ui ) {
|
502
|
+
$( this ).addClass("ui-dialog-resizing");
|
503
|
+
that._blockFrames();
|
504
|
+
that._trigger( "resizeStart", event, filteredUi( ui ) );
|
505
|
+
},
|
506
|
+
resize: function( event, ui ) {
|
507
|
+
that._trigger( "resize", event, filteredUi( ui ) );
|
508
|
+
},
|
509
|
+
stop: function( event, ui ) {
|
510
|
+
options.height = $( this ).height();
|
511
|
+
options.width = $( this ).width();
|
512
|
+
$( this ).removeClass("ui-dialog-resizing");
|
513
|
+
that._unblockFrames();
|
514
|
+
that._trigger( "resizeStop", event, filteredUi( ui ) );
|
515
|
+
}
|
516
|
+
})
|
517
|
+
.css( "position", position );
|
518
|
+
},
|
519
|
+
|
520
|
+
_minHeight: function() {
|
521
|
+
var options = this.options;
|
522
|
+
|
523
|
+
return options.height === "auto" ?
|
524
|
+
options.minHeight :
|
525
|
+
Math.min( options.minHeight, options.height );
|
526
|
+
},
|
527
|
+
|
528
|
+
_position: function() {
|
529
|
+
// Need to show the dialog to get the actual offset in the position plugin
|
530
|
+
var isVisible = this.uiDialog.is(":visible");
|
531
|
+
if ( !isVisible ) {
|
532
|
+
this.uiDialog.show();
|
533
|
+
}
|
534
|
+
this.uiDialog.position( this.options.position );
|
535
|
+
if ( !isVisible ) {
|
536
|
+
this.uiDialog.hide();
|
537
|
+
}
|
538
|
+
},
|
539
|
+
|
540
|
+
_setOptions: function( options ) {
|
541
|
+
var that = this,
|
542
|
+
resize = false,
|
543
|
+
resizableOptions = {};
|
544
|
+
|
545
|
+
$.each( options, function( key, value ) {
|
546
|
+
that._setOption( key, value );
|
547
|
+
|
548
|
+
if ( key in sizeRelatedOptions ) {
|
549
|
+
resize = true;
|
550
|
+
}
|
551
|
+
if ( key in resizableRelatedOptions ) {
|
552
|
+
resizableOptions[ key ] = value;
|
553
|
+
}
|
554
|
+
});
|
555
|
+
|
556
|
+
if ( resize ) {
|
557
|
+
this._size();
|
558
|
+
this._position();
|
559
|
+
}
|
560
|
+
if ( this.uiDialog.is(":data(ui-resizable)") ) {
|
561
|
+
this.uiDialog.resizable( "option", resizableOptions );
|
562
|
+
}
|
563
|
+
},
|
564
|
+
|
565
|
+
_setOption: function( key, value ) {
|
566
|
+
/*jshint maxcomplexity:15*/
|
567
|
+
var isDraggable, isResizable,
|
568
|
+
uiDialog = this.uiDialog;
|
569
|
+
|
570
|
+
if ( key === "dialogClass" ) {
|
571
|
+
uiDialog
|
572
|
+
.removeClass( this.options.dialogClass )
|
573
|
+
.addClass( value );
|
574
|
+
}
|
575
|
+
|
576
|
+
if ( key === "disabled" ) {
|
577
|
+
return;
|
578
|
+
}
|
579
|
+
|
580
|
+
this._super( key, value );
|
581
|
+
|
582
|
+
if ( key === "appendTo" ) {
|
583
|
+
this.uiDialog.appendTo( this._appendTo() );
|
584
|
+
}
|
585
|
+
|
586
|
+
if ( key === "buttons" ) {
|
587
|
+
this._createButtons();
|
588
|
+
}
|
589
|
+
|
590
|
+
if ( key === "closeText" ) {
|
591
|
+
this.uiDialogTitlebarClose.button({
|
592
|
+
// Ensure that we always pass a string
|
593
|
+
label: "" + value
|
594
|
+
});
|
595
|
+
}
|
596
|
+
|
597
|
+
if ( key === "draggable" ) {
|
598
|
+
isDraggable = uiDialog.is(":data(ui-draggable)");
|
599
|
+
if ( isDraggable && !value ) {
|
600
|
+
uiDialog.draggable("destroy");
|
601
|
+
}
|
602
|
+
|
603
|
+
if ( !isDraggable && value ) {
|
604
|
+
this._makeDraggable();
|
605
|
+
}
|
606
|
+
}
|
607
|
+
|
608
|
+
if ( key === "position" ) {
|
609
|
+
this._position();
|
610
|
+
}
|
611
|
+
|
612
|
+
if ( key === "resizable" ) {
|
613
|
+
// currently resizable, becoming non-resizable
|
614
|
+
isResizable = uiDialog.is(":data(ui-resizable)");
|
615
|
+
if ( isResizable && !value ) {
|
616
|
+
uiDialog.resizable("destroy");
|
617
|
+
}
|
618
|
+
|
619
|
+
// currently resizable, changing handles
|
620
|
+
if ( isResizable && typeof value === "string" ) {
|
621
|
+
uiDialog.resizable( "option", "handles", value );
|
622
|
+
}
|
623
|
+
|
624
|
+
// currently non-resizable, becoming resizable
|
625
|
+
if ( !isResizable && value !== false ) {
|
626
|
+
this._makeResizable();
|
627
|
+
}
|
628
|
+
}
|
629
|
+
|
630
|
+
if ( key === "title" ) {
|
631
|
+
this._title( this.uiDialogTitlebar.find(".ui-dialog-title") );
|
632
|
+
}
|
633
|
+
},
|
634
|
+
|
635
|
+
_size: function() {
|
636
|
+
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
|
637
|
+
// divs will both have width and height set, so we need to reset them
|
638
|
+
var nonContentHeight, minContentHeight, maxContentHeight,
|
639
|
+
options = this.options;
|
640
|
+
|
641
|
+
// Reset content sizing
|
642
|
+
this.element.show().css({
|
643
|
+
width: "auto",
|
644
|
+
minHeight: 0,
|
645
|
+
maxHeight: "none",
|
646
|
+
height: 0
|
647
|
+
});
|
648
|
+
|
649
|
+
if ( options.minWidth > options.width ) {
|
650
|
+
options.width = options.minWidth;
|
651
|
+
}
|
652
|
+
|
653
|
+
// reset wrapper sizing
|
654
|
+
// determine the height of all the non-content elements
|
655
|
+
nonContentHeight = this.uiDialog.css({
|
656
|
+
height: "auto",
|
657
|
+
width: options.width
|
658
|
+
})
|
659
|
+
.outerHeight();
|
660
|
+
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
|
661
|
+
maxContentHeight = typeof options.maxHeight === "number" ?
|
662
|
+
Math.max( 0, options.maxHeight - nonContentHeight ) :
|
663
|
+
"none";
|
664
|
+
|
665
|
+
if ( options.height === "auto" ) {
|
666
|
+
this.element.css({
|
667
|
+
minHeight: minContentHeight,
|
668
|
+
maxHeight: maxContentHeight,
|
669
|
+
height: "auto"
|
670
|
+
});
|
671
|
+
} else {
|
672
|
+
this.element.height( Math.max( 0, options.height - nonContentHeight ) );
|
673
|
+
}
|
674
|
+
|
675
|
+
if (this.uiDialog.is(":data(ui-resizable)") ) {
|
676
|
+
this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
|
677
|
+
}
|
678
|
+
},
|
679
|
+
|
680
|
+
_blockFrames: function() {
|
681
|
+
this.iframeBlocks = this.document.find( "iframe" ).map(function() {
|
682
|
+
var iframe = $( this );
|
683
|
+
|
684
|
+
return $( "<div>" )
|
685
|
+
.css({
|
686
|
+
position: "absolute",
|
687
|
+
width: iframe.outerWidth(),
|
688
|
+
height: iframe.outerHeight()
|
689
|
+
})
|
690
|
+
.appendTo( iframe.parent() )
|
691
|
+
.offset( iframe.offset() )[0];
|
692
|
+
});
|
693
|
+
},
|
694
|
+
|
695
|
+
_unblockFrames: function() {
|
696
|
+
if ( this.iframeBlocks ) {
|
697
|
+
this.iframeBlocks.remove();
|
698
|
+
delete this.iframeBlocks;
|
699
|
+
}
|
700
|
+
},
|
701
|
+
|
702
|
+
_allowInteraction: function( event ) {
|
703
|
+
if ( $( event.target ).closest(".ui-dialog").length ) {
|
704
|
+
return true;
|
705
|
+
}
|
706
|
+
|
707
|
+
// TODO: Remove hack when datepicker implements
|
708
|
+
// the .ui-front logic (#8989)
|
709
|
+
return !!$( event.target ).closest(".ui-datepicker").length;
|
710
|
+
},
|
711
|
+
|
712
|
+
_createOverlay: function() {
|
713
|
+
if ( !this.options.modal ) {
|
714
|
+
return;
|
715
|
+
}
|
716
|
+
|
717
|
+
var that = this,
|
718
|
+
widgetFullName = this.widgetFullName;
|
719
|
+
if ( !$.ui.dialog.overlayInstances ) {
|
720
|
+
// Prevent use of anchors and inputs.
|
721
|
+
// We use a delay in case the overlay is created from an
|
722
|
+
// event that we're going to be cancelling. (#2804)
|
723
|
+
this._delay(function() {
|
724
|
+
// Handle .dialog().dialog("close") (#4065)
|
725
|
+
if ( $.ui.dialog.overlayInstances ) {
|
726
|
+
this.document.bind( "focusin.dialog", function( event ) {
|
727
|
+
if ( !that._allowInteraction( event ) ) {
|
728
|
+
event.preventDefault();
|
729
|
+
$(".ui-dialog:visible:last .ui-dialog-content")
|
730
|
+
.data( widgetFullName )._focusTabbable();
|
731
|
+
}
|
732
|
+
});
|
733
|
+
}
|
734
|
+
});
|
735
|
+
}
|
736
|
+
|
737
|
+
this.overlay = $("<div>")
|
738
|
+
.addClass("ui-widget-overlay ui-front")
|
739
|
+
.appendTo( this._appendTo() );
|
740
|
+
this._on( this.overlay, {
|
741
|
+
mousedown: "_keepFocus"
|
742
|
+
});
|
743
|
+
$.ui.dialog.overlayInstances++;
|
744
|
+
},
|
745
|
+
|
746
|
+
_destroyOverlay: function() {
|
747
|
+
if ( !this.options.modal ) {
|
748
|
+
return;
|
749
|
+
}
|
750
|
+
|
751
|
+
if ( this.overlay ) {
|
752
|
+
$.ui.dialog.overlayInstances--;
|
753
|
+
|
754
|
+
if ( !$.ui.dialog.overlayInstances ) {
|
755
|
+
this.document.unbind( "focusin.dialog" );
|
756
|
+
}
|
757
|
+
this.overlay.remove();
|
758
|
+
this.overlay = null;
|
759
|
+
}
|
760
|
+
}
|
761
|
+
});
|
762
|
+
|
763
|
+
$.ui.dialog.overlayInstances = 0;
|
764
|
+
|
765
|
+
// DEPRECATED
|
766
|
+
if ( $.uiBackCompat !== false ) {
|
767
|
+
// position option with array notation
|
768
|
+
// just override with old implementation
|
769
|
+
$.widget( "ui.dialog", $.ui.dialog, {
|
770
|
+
_position: function() {
|
771
|
+
var position = this.options.position,
|
772
|
+
myAt = [],
|
773
|
+
offset = [ 0, 0 ],
|
774
|
+
isVisible;
|
775
|
+
|
776
|
+
if ( position ) {
|
777
|
+
if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
|
778
|
+
myAt = position.split ? position.split(" ") : [ position[0], position[1] ];
|
779
|
+
if ( myAt.length === 1 ) {
|
780
|
+
myAt[1] = myAt[0];
|
781
|
+
}
|
782
|
+
|
783
|
+
$.each( [ "left", "top" ], function( i, offsetPosition ) {
|
784
|
+
if ( +myAt[ i ] === myAt[ i ] ) {
|
785
|
+
offset[ i ] = myAt[ i ];
|
786
|
+
myAt[ i ] = offsetPosition;
|
787
|
+
}
|
788
|
+
});
|
789
|
+
|
790
|
+
position = {
|
791
|
+
my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
|
792
|
+
myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
|
793
|
+
at: myAt.join(" ")
|
794
|
+
};
|
795
|
+
}
|
796
|
+
|
797
|
+
position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
|
798
|
+
} else {
|
799
|
+
position = $.ui.dialog.prototype.options.position;
|
800
|
+
}
|
801
|
+
|
802
|
+
// need to show the dialog to get the actual offset in the position plugin
|
803
|
+
isVisible = this.uiDialog.is(":visible");
|
804
|
+
if ( !isVisible ) {
|
805
|
+
this.uiDialog.show();
|
806
|
+
}
|
807
|
+
this.uiDialog.position( position );
|
808
|
+
if ( !isVisible ) {
|
809
|
+
this.uiDialog.hide();
|
810
|
+
}
|
811
|
+
}
|
812
|
+
});
|
813
|
+
}
|
814
|
+
|
815
|
+
}( jQuery ) );
|