jqueryui-requirejs-rails 0.1.0

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