jquery-ui-rails 0.4.0 → 0.4.1

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.

Files changed (137) hide show
  1. data/.gitignore +0 -1
  2. data/History.md +6 -0
  3. data/README.md +1 -0
  4. data/Rakefile +13 -2
  5. data/lib/jquery/ui/rails/version.rb +1 -1
  6. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  7. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  8. data/vendor/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  9. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  10. data/vendor/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  11. data/vendor/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  12. data/vendor/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  13. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  14. data/vendor/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  15. data/vendor/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  16. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  17. data/vendor/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  18. data/vendor/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  19. data/vendor/assets/javascripts/jquery.effects.all.js +14 -0
  20. data/vendor/assets/javascripts/jquery.effects.blind.js +51 -0
  21. data/vendor/assets/javascripts/jquery.effects.bounce.js +80 -0
  22. data/vendor/assets/javascripts/jquery.effects.clip.js +56 -0
  23. data/vendor/assets/javascripts/jquery.effects.core.js +763 -0
  24. data/vendor/assets/javascripts/jquery.effects.drop.js +52 -0
  25. data/vendor/assets/javascripts/jquery.effects.explode.js +81 -0
  26. data/vendor/assets/javascripts/jquery.effects.fade.js +34 -0
  27. data/vendor/assets/javascripts/jquery.effects.fold.js +58 -0
  28. data/vendor/assets/javascripts/jquery.effects.highlight.js +52 -0
  29. data/vendor/assets/javascripts/jquery.effects.pulsate.js +53 -0
  30. data/vendor/assets/javascripts/jquery.effects.scale.js +180 -0
  31. data/vendor/assets/javascripts/jquery.effects.shake.js +59 -0
  32. data/vendor/assets/javascripts/jquery.effects.slide.js +52 -0
  33. data/vendor/assets/javascripts/jquery.effects.transfer.js +47 -0
  34. data/vendor/assets/javascripts/jquery.ui.accordion.js +614 -0
  35. data/vendor/assets/javascripts/jquery.ui.all.js +31 -0
  36. data/vendor/assets/javascripts/jquery.ui.autocomplete.js +635 -0
  37. data/vendor/assets/javascripts/jquery.ui.button.js +417 -0
  38. data/vendor/assets/javascripts/jquery.ui.core.js +321 -0
  39. data/vendor/assets/javascripts/jquery.ui.datepicker-af.js +25 -0
  40. data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +25 -0
  41. data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +25 -0
  42. data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +25 -0
  43. data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +26 -0
  44. data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +25 -0
  45. data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +25 -0
  46. data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +25 -0
  47. data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +25 -0
  48. data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +25 -0
  49. data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +25 -0
  50. data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +25 -0
  51. data/vendor/assets/javascripts/jquery.ui.datepicker-en-AU.js +25 -0
  52. data/vendor/assets/javascripts/jquery.ui.datepicker-en-GB.js +25 -0
  53. data/vendor/assets/javascripts/jquery.ui.datepicker-en-NZ.js +25 -0
  54. data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +25 -0
  55. data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +25 -0
  56. data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +25 -0
  57. data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +25 -0
  58. data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +61 -0
  59. data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +25 -0
  60. data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +25 -0
  61. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +25 -0
  62. data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +27 -0
  63. data/vendor/assets/javascripts/jquery.ui.datepicker-ge.js +23 -0
  64. data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +25 -0
  65. data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +25 -0
  66. data/vendor/assets/javascripts/jquery.ui.datepicker-hi.js +25 -0
  67. data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +25 -0
  68. data/vendor/assets/javascripts/jquery.ui.datepicker-hu.js +25 -0
  69. data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +25 -0
  70. data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +25 -0
  71. data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +25 -0
  72. data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +25 -0
  73. data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +25 -0
  74. data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +25 -0
  75. data/vendor/assets/javascripts/jquery.ui.datepicker-km.js +25 -0
  76. data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +25 -0
  77. data/vendor/assets/javascripts/jquery.ui.datepicker-lb.js +25 -0
  78. data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +25 -0
  79. data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +25 -0
  80. data/vendor/assets/javascripts/jquery.ui.datepicker-mk.js +25 -0
  81. data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +25 -0
  82. data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +25 -0
  83. data/vendor/assets/javascripts/jquery.ui.datepicker-nl-BE.js +25 -0
  84. data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +25 -0
  85. data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +25 -0
  86. data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +25 -0
  87. data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +25 -0
  88. data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +24 -0
  89. data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +23 -0
  90. data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +28 -0
  91. data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +25 -0
  92. data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +25 -0
  93. data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +26 -0
  94. data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +25 -0
  95. data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +25 -0
  96. data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +25 -0
  97. data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +25 -0
  98. data/vendor/assets/javascripts/jquery.ui.datepicker-ta.js +25 -0
  99. data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +25 -0
  100. data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +25 -0
  101. data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +25 -0
  102. data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +26 -0
  103. data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +25 -0
  104. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +25 -0
  105. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +25 -0
  106. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +25 -0
  107. data/vendor/assets/javascripts/jquery.ui.datepicker.js +1826 -0
  108. data/vendor/assets/javascripts/jquery.ui.dialog.js +882 -0
  109. data/vendor/assets/javascripts/jquery.ui.draggable.js +835 -0
  110. data/vendor/assets/javascripts/jquery.ui.droppable.js +301 -0
  111. data/vendor/assets/javascripts/jquery.ui.mouse.js +168 -0
  112. data/vendor/assets/javascripts/jquery.ui.position.js +298 -0
  113. data/vendor/assets/javascripts/jquery.ui.progressbar.js +112 -0
  114. data/vendor/assets/javascripts/jquery.ui.resizable.js +811 -0
  115. data/vendor/assets/javascripts/jquery.ui.selectable.js +271 -0
  116. data/vendor/assets/javascripts/jquery.ui.slider.js +666 -0
  117. data/vendor/assets/javascripts/jquery.ui.sortable.js +1085 -0
  118. data/vendor/assets/javascripts/jquery.ui.tabs.js +760 -0
  119. data/vendor/assets/javascripts/jquery.ui.widget.js +272 -0
  120. data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +23 -0
  121. data/vendor/assets/stylesheets/jquery.ui.all.css.erb +13 -0
  122. data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +57 -0
  123. data/vendor/assets/stylesheets/jquery.ui.base.css.erb +23 -0
  124. data/vendor/assets/stylesheets/jquery.ui.button.css.erb +42 -0
  125. data/vendor/assets/stylesheets/jquery.ui.core.css.erb +38 -0
  126. data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +72 -0
  127. data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +25 -0
  128. data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +15 -0
  129. data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +24 -0
  130. data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +14 -0
  131. data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +28 -0
  132. data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +22 -0
  133. data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +250 -0
  134. metadata +111 -113
  135. data/jquery-ui/GPL-LICENSE.txt +0 -278
  136. data/jquery-ui/MIT-LICENSE.txt +0 -25
  137. data/jquery-ui/package.json +0 -36
@@ -0,0 +1,882 @@
1
+ //= require jquery.ui.core
2
+ //= require jquery.ui.widget
3
+ //= require jquery.ui.position
4
+
5
+ /*!
6
+ * jQuery UI Dialog 1.8.20
7
+ *
8
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ * http://jquery.org/license
11
+ *
12
+ * http://docs.jquery.com/UI/Dialog
13
+ *
14
+ * Depends:
15
+ * jquery.ui.core.js
16
+ * jquery.ui.widget.js
17
+ * jquery.ui.button.js
18
+ * jquery.ui.draggable.js
19
+ * jquery.ui.mouse.js
20
+ * jquery.ui.position.js
21
+ * jquery.ui.resizable.js
22
+ */
23
+ (function( $, undefined ) {
24
+
25
+ var uiDialogClasses =
26
+ 'ui-dialog ' +
27
+ 'ui-widget ' +
28
+ 'ui-widget-content ' +
29
+ 'ui-corner-all ',
30
+ sizeRelatedOptions = {
31
+ buttons: true,
32
+ height: true,
33
+ maxHeight: true,
34
+ maxWidth: true,
35
+ minHeight: true,
36
+ minWidth: true,
37
+ width: true
38
+ },
39
+ resizableRelatedOptions = {
40
+ maxHeight: true,
41
+ maxWidth: true,
42
+ minHeight: true,
43
+ minWidth: true
44
+ },
45
+ // support for jQuery 1.3.2 - handle common attrFn methods for dialog
46
+ attrFn = $.attrFn || {
47
+ val: true,
48
+ css: true,
49
+ html: true,
50
+ text: true,
51
+ data: true,
52
+ width: true,
53
+ height: true,
54
+ offset: true,
55
+ click: true
56
+ };
57
+
58
+ $.widget("ui.dialog", {
59
+ options: {
60
+ autoOpen: true,
61
+ buttons: {},
62
+ closeOnEscape: true,
63
+ closeText: 'close',
64
+ dialogClass: '',
65
+ draggable: true,
66
+ hide: null,
67
+ height: 'auto',
68
+ maxHeight: false,
69
+ maxWidth: false,
70
+ minHeight: 150,
71
+ minWidth: 150,
72
+ modal: false,
73
+ position: {
74
+ my: 'center',
75
+ at: 'center',
76
+ collision: 'fit',
77
+ // ensure that the titlebar is never outside the document
78
+ using: function(pos) {
79
+ var topOffset = $(this).css(pos).offset().top;
80
+ if (topOffset < 0) {
81
+ $(this).css('top', pos.top - topOffset);
82
+ }
83
+ }
84
+ },
85
+ resizable: true,
86
+ show: null,
87
+ stack: true,
88
+ title: '',
89
+ width: 300,
90
+ zIndex: 1000
91
+ },
92
+
93
+ _create: function() {
94
+ this.originalTitle = this.element.attr('title');
95
+ // #5742 - .attr() might return a DOMElement
96
+ if ( typeof this.originalTitle !== "string" ) {
97
+ this.originalTitle = "";
98
+ }
99
+
100
+ this.options.title = this.options.title || this.originalTitle;
101
+ var self = this,
102
+ options = self.options,
103
+
104
+ title = options.title || '&#160;',
105
+ titleId = $.ui.dialog.getTitleId(self.element),
106
+
107
+ uiDialog = (self.uiDialog = $('<div></div>'))
108
+ .appendTo(document.body)
109
+ .hide()
110
+ .addClass(uiDialogClasses + options.dialogClass)
111
+ .css({
112
+ zIndex: options.zIndex
113
+ })
114
+ // setting tabIndex makes the div focusable
115
+ // setting outline to 0 prevents a border on focus in Mozilla
116
+ .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
117
+ if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
118
+ event.keyCode === $.ui.keyCode.ESCAPE) {
119
+
120
+ self.close(event);
121
+ event.preventDefault();
122
+ }
123
+ })
124
+ .attr({
125
+ role: 'dialog',
126
+ 'aria-labelledby': titleId
127
+ })
128
+ .mousedown(function(event) {
129
+ self.moveToTop(false, event);
130
+ }),
131
+
132
+ uiDialogContent = self.element
133
+ .show()
134
+ .removeAttr('title')
135
+ .addClass(
136
+ 'ui-dialog-content ' +
137
+ 'ui-widget-content')
138
+ .appendTo(uiDialog),
139
+
140
+ uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
141
+ .addClass(
142
+ 'ui-dialog-titlebar ' +
143
+ 'ui-widget-header ' +
144
+ 'ui-corner-all ' +
145
+ 'ui-helper-clearfix'
146
+ )
147
+ .prependTo(uiDialog),
148
+
149
+ uiDialogTitlebarClose = $('<a href="#"></a>')
150
+ .addClass(
151
+ 'ui-dialog-titlebar-close ' +
152
+ 'ui-corner-all'
153
+ )
154
+ .attr('role', 'button')
155
+ .hover(
156
+ function() {
157
+ uiDialogTitlebarClose.addClass('ui-state-hover');
158
+ },
159
+ function() {
160
+ uiDialogTitlebarClose.removeClass('ui-state-hover');
161
+ }
162
+ )
163
+ .focus(function() {
164
+ uiDialogTitlebarClose.addClass('ui-state-focus');
165
+ })
166
+ .blur(function() {
167
+ uiDialogTitlebarClose.removeClass('ui-state-focus');
168
+ })
169
+ .click(function(event) {
170
+ self.close(event);
171
+ return false;
172
+ })
173
+ .appendTo(uiDialogTitlebar),
174
+
175
+ uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
176
+ .addClass(
177
+ 'ui-icon ' +
178
+ 'ui-icon-closethick'
179
+ )
180
+ .text(options.closeText)
181
+ .appendTo(uiDialogTitlebarClose),
182
+
183
+ uiDialogTitle = $('<span></span>')
184
+ .addClass('ui-dialog-title')
185
+ .attr('id', titleId)
186
+ .html(title)
187
+ .prependTo(uiDialogTitlebar);
188
+
189
+ //handling of deprecated beforeclose (vs beforeClose) option
190
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
191
+ //TODO: remove in 1.9pre
192
+ if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
193
+ options.beforeClose = options.beforeclose;
194
+ }
195
+
196
+ uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
197
+
198
+ if (options.draggable && $.fn.draggable) {
199
+ self._makeDraggable();
200
+ }
201
+ if (options.resizable && $.fn.resizable) {
202
+ self._makeResizable();
203
+ }
204
+
205
+ self._createButtons(options.buttons);
206
+ self._isOpen = false;
207
+
208
+ if ($.fn.bgiframe) {
209
+ uiDialog.bgiframe();
210
+ }
211
+ },
212
+
213
+ _init: function() {
214
+ if ( this.options.autoOpen ) {
215
+ this.open();
216
+ }
217
+ },
218
+
219
+ destroy: function() {
220
+ var self = this;
221
+
222
+ if (self.overlay) {
223
+ self.overlay.destroy();
224
+ }
225
+ self.uiDialog.hide();
226
+ self.element
227
+ .unbind('.dialog')
228
+ .removeData('dialog')
229
+ .removeClass('ui-dialog-content ui-widget-content')
230
+ .hide().appendTo('body');
231
+ self.uiDialog.remove();
232
+
233
+ if (self.originalTitle) {
234
+ self.element.attr('title', self.originalTitle);
235
+ }
236
+
237
+ return self;
238
+ },
239
+
240
+ widget: function() {
241
+ return this.uiDialog;
242
+ },
243
+
244
+ close: function(event) {
245
+ var self = this,
246
+ maxZ, thisZ;
247
+
248
+ if (false === self._trigger('beforeClose', event)) {
249
+ return;
250
+ }
251
+
252
+ if (self.overlay) {
253
+ self.overlay.destroy();
254
+ }
255
+ self.uiDialog.unbind('keypress.ui-dialog');
256
+
257
+ self._isOpen = false;
258
+
259
+ if (self.options.hide) {
260
+ self.uiDialog.hide(self.options.hide, function() {
261
+ self._trigger('close', event);
262
+ });
263
+ } else {
264
+ self.uiDialog.hide();
265
+ self._trigger('close', event);
266
+ }
267
+
268
+ $.ui.dialog.overlay.resize();
269
+
270
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
271
+ if (self.options.modal) {
272
+ maxZ = 0;
273
+ $('.ui-dialog').each(function() {
274
+ if (this !== self.uiDialog[0]) {
275
+ thisZ = $(this).css('z-index');
276
+ if(!isNaN(thisZ)) {
277
+ maxZ = Math.max(maxZ, thisZ);
278
+ }
279
+ }
280
+ });
281
+ $.ui.dialog.maxZ = maxZ;
282
+ }
283
+
284
+ return self;
285
+ },
286
+
287
+ isOpen: function() {
288
+ return this._isOpen;
289
+ },
290
+
291
+ // the force parameter allows us to move modal dialogs to their correct
292
+ // position on open
293
+ moveToTop: function(force, event) {
294
+ var self = this,
295
+ options = self.options,
296
+ saveScroll;
297
+
298
+ if ((options.modal && !force) ||
299
+ (!options.stack && !options.modal)) {
300
+ return self._trigger('focus', event);
301
+ }
302
+
303
+ if (options.zIndex > $.ui.dialog.maxZ) {
304
+ $.ui.dialog.maxZ = options.zIndex;
305
+ }
306
+ if (self.overlay) {
307
+ $.ui.dialog.maxZ += 1;
308
+ self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
309
+ }
310
+
311
+ //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
312
+ // http://ui.jquery.com/bugs/ticket/3193
313
+ saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };
314
+ $.ui.dialog.maxZ += 1;
315
+ self.uiDialog.css('z-index', $.ui.dialog.maxZ);
316
+ self.element.attr(saveScroll);
317
+ self._trigger('focus', event);
318
+
319
+ return self;
320
+ },
321
+
322
+ open: function() {
323
+ if (this._isOpen) { return; }
324
+
325
+ var self = this,
326
+ options = self.options,
327
+ uiDialog = self.uiDialog;
328
+
329
+ self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
330
+ self._size();
331
+ self._position(options.position);
332
+ uiDialog.show(options.show);
333
+ self.moveToTop(true);
334
+
335
+ // prevent tabbing out of modal dialogs
336
+ if ( options.modal ) {
337
+ uiDialog.bind( "keydown.ui-dialog", function( event ) {
338
+ if ( event.keyCode !== $.ui.keyCode.TAB ) {
339
+ return;
340
+ }
341
+
342
+ var tabbables = $(':tabbable', this),
343
+ first = tabbables.filter(':first'),
344
+ last = tabbables.filter(':last');
345
+
346
+ if (event.target === last[0] && !event.shiftKey) {
347
+ first.focus(1);
348
+ return false;
349
+ } else if (event.target === first[0] && event.shiftKey) {
350
+ last.focus(1);
351
+ return false;
352
+ }
353
+ });
354
+ }
355
+
356
+ // set focus to the first tabbable element in the content area or the first button
357
+ // if there are no tabbable elements, set focus on the dialog itself
358
+ $(self.element.find(':tabbable').get().concat(
359
+ uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
360
+ uiDialog.get()))).eq(0).focus();
361
+
362
+ self._isOpen = true;
363
+ self._trigger('open');
364
+
365
+ return self;
366
+ },
367
+
368
+ _createButtons: function(buttons) {
369
+ var self = this,
370
+ hasButtons = false,
371
+ uiDialogButtonPane = $('<div></div>')
372
+ .addClass(
373
+ 'ui-dialog-buttonpane ' +
374
+ 'ui-widget-content ' +
375
+ 'ui-helper-clearfix'
376
+ ),
377
+ uiButtonSet = $( "<div></div>" )
378
+ .addClass( "ui-dialog-buttonset" )
379
+ .appendTo( uiDialogButtonPane );
380
+
381
+ // if we already have a button pane, remove it
382
+ self.uiDialog.find('.ui-dialog-buttonpane').remove();
383
+
384
+ if (typeof buttons === 'object' && buttons !== null) {
385
+ $.each(buttons, function() {
386
+ return !(hasButtons = true);
387
+ });
388
+ }
389
+ if (hasButtons) {
390
+ $.each(buttons, function(name, props) {
391
+ props = $.isFunction( props ) ?
392
+ { click: props, text: name } :
393
+ props;
394
+ var button = $('<button type="button"></button>')
395
+ .click(function() {
396
+ props.click.apply(self.element[0], arguments);
397
+ })
398
+ .appendTo(uiButtonSet);
399
+ // can't use .attr( props, true ) with jQuery 1.3.2.
400
+ $.each( props, function( key, value ) {
401
+ if ( key === "click" ) {
402
+ return;
403
+ }
404
+ if ( key in attrFn ) {
405
+ button[ key ]( value );
406
+ } else {
407
+ button.attr( key, value );
408
+ }
409
+ });
410
+ if ($.fn.button) {
411
+ button.button();
412
+ }
413
+ });
414
+ uiDialogButtonPane.appendTo(self.uiDialog);
415
+ }
416
+ },
417
+
418
+ _makeDraggable: function() {
419
+ var self = this,
420
+ options = self.options,
421
+ doc = $(document),
422
+ heightBeforeDrag;
423
+
424
+ function filteredUi(ui) {
425
+ return {
426
+ position: ui.position,
427
+ offset: ui.offset
428
+ };
429
+ }
430
+
431
+ self.uiDialog.draggable({
432
+ cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
433
+ handle: '.ui-dialog-titlebar',
434
+ containment: 'document',
435
+ start: function(event, ui) {
436
+ heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
437
+ $(this).height($(this).height()).addClass("ui-dialog-dragging");
438
+ self._trigger('dragStart', event, filteredUi(ui));
439
+ },
440
+ drag: function(event, ui) {
441
+ self._trigger('drag', event, filteredUi(ui));
442
+ },
443
+ stop: function(event, ui) {
444
+ options.position = [ui.position.left - doc.scrollLeft(),
445
+ ui.position.top - doc.scrollTop()];
446
+ $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
447
+ self._trigger('dragStop', event, filteredUi(ui));
448
+ $.ui.dialog.overlay.resize();
449
+ }
450
+ });
451
+ },
452
+
453
+ _makeResizable: function(handles) {
454
+ handles = (handles === undefined ? this.options.resizable : handles);
455
+ var self = this,
456
+ options = self.options,
457
+ // .ui-resizable has position: relative defined in the stylesheet
458
+ // but dialogs have to use absolute or fixed positioning
459
+ position = self.uiDialog.css('position'),
460
+ resizeHandles = (typeof handles === 'string' ?
461
+ handles :
462
+ 'n,e,s,w,se,sw,ne,nw'
463
+ );
464
+
465
+ function filteredUi(ui) {
466
+ return {
467
+ originalPosition: ui.originalPosition,
468
+ originalSize: ui.originalSize,
469
+ position: ui.position,
470
+ size: ui.size
471
+ };
472
+ }
473
+
474
+ self.uiDialog.resizable({
475
+ cancel: '.ui-dialog-content',
476
+ containment: 'document',
477
+ alsoResize: self.element,
478
+ maxWidth: options.maxWidth,
479
+ maxHeight: options.maxHeight,
480
+ minWidth: options.minWidth,
481
+ minHeight: self._minHeight(),
482
+ handles: resizeHandles,
483
+ start: function(event, ui) {
484
+ $(this).addClass("ui-dialog-resizing");
485
+ self._trigger('resizeStart', event, filteredUi(ui));
486
+ },
487
+ resize: function(event, ui) {
488
+ self._trigger('resize', event, filteredUi(ui));
489
+ },
490
+ stop: function(event, ui) {
491
+ $(this).removeClass("ui-dialog-resizing");
492
+ options.height = $(this).height();
493
+ options.width = $(this).width();
494
+ self._trigger('resizeStop', event, filteredUi(ui));
495
+ $.ui.dialog.overlay.resize();
496
+ }
497
+ })
498
+ .css('position', position)
499
+ .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
500
+ },
501
+
502
+ _minHeight: function() {
503
+ var options = this.options;
504
+
505
+ if (options.height === 'auto') {
506
+ return options.minHeight;
507
+ } else {
508
+ return Math.min(options.minHeight, options.height);
509
+ }
510
+ },
511
+
512
+ _position: function(position) {
513
+ var myAt = [],
514
+ offset = [0, 0],
515
+ isVisible;
516
+
517
+ if (position) {
518
+ // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
519
+ // if (typeof position == 'string' || $.isArray(position)) {
520
+ // myAt = $.isArray(position) ? position : position.split(' ');
521
+
522
+ if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
523
+ myAt = position.split ? position.split(' ') : [position[0], position[1]];
524
+ if (myAt.length === 1) {
525
+ myAt[1] = myAt[0];
526
+ }
527
+
528
+ $.each(['left', 'top'], function(i, offsetPosition) {
529
+ if (+myAt[i] === myAt[i]) {
530
+ offset[i] = myAt[i];
531
+ myAt[i] = offsetPosition;
532
+ }
533
+ });
534
+
535
+ position = {
536
+ my: myAt.join(" "),
537
+ at: myAt.join(" "),
538
+ offset: offset.join(" ")
539
+ };
540
+ }
541
+
542
+ position = $.extend({}, $.ui.dialog.prototype.options.position, position);
543
+ } else {
544
+ position = $.ui.dialog.prototype.options.position;
545
+ }
546
+
547
+ // need to show the dialog to get the actual offset in the position plugin
548
+ isVisible = this.uiDialog.is(':visible');
549
+ if (!isVisible) {
550
+ this.uiDialog.show();
551
+ }
552
+ this.uiDialog
553
+ // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
554
+ .css({ top: 0, left: 0 })
555
+ .position($.extend({ of: window }, position));
556
+ if (!isVisible) {
557
+ this.uiDialog.hide();
558
+ }
559
+ },
560
+
561
+ _setOptions: function( options ) {
562
+ var self = this,
563
+ resizableOptions = {},
564
+ resize = false;
565
+
566
+ $.each( options, function( key, value ) {
567
+ self._setOption( key, value );
568
+
569
+ if ( key in sizeRelatedOptions ) {
570
+ resize = true;
571
+ }
572
+ if ( key in resizableRelatedOptions ) {
573
+ resizableOptions[ key ] = value;
574
+ }
575
+ });
576
+
577
+ if ( resize ) {
578
+ this._size();
579
+ }
580
+ if ( this.uiDialog.is( ":data(resizable)" ) ) {
581
+ this.uiDialog.resizable( "option", resizableOptions );
582
+ }
583
+ },
584
+
585
+ _setOption: function(key, value){
586
+ var self = this,
587
+ uiDialog = self.uiDialog;
588
+
589
+ switch (key) {
590
+ //handling of deprecated beforeclose (vs beforeClose) option
591
+ //Ticket #4669 http://dev.jqueryui.com/ticket/4669
592
+ //TODO: remove in 1.9pre
593
+ case "beforeclose":
594
+ key = "beforeClose";
595
+ break;
596
+ case "buttons":
597
+ self._createButtons(value);
598
+ break;
599
+ case "closeText":
600
+ // ensure that we always pass a string
601
+ self.uiDialogTitlebarCloseText.text("" + value);
602
+ break;
603
+ case "dialogClass":
604
+ uiDialog
605
+ .removeClass(self.options.dialogClass)
606
+ .addClass(uiDialogClasses + value);
607
+ break;
608
+ case "disabled":
609
+ if (value) {
610
+ uiDialog.addClass('ui-dialog-disabled');
611
+ } else {
612
+ uiDialog.removeClass('ui-dialog-disabled');
613
+ }
614
+ break;
615
+ case "draggable":
616
+ var isDraggable = uiDialog.is( ":data(draggable)" );
617
+ if ( isDraggable && !value ) {
618
+ uiDialog.draggable( "destroy" );
619
+ }
620
+
621
+ if ( !isDraggable && value ) {
622
+ self._makeDraggable();
623
+ }
624
+ break;
625
+ case "position":
626
+ self._position(value);
627
+ break;
628
+ case "resizable":
629
+ // currently resizable, becoming non-resizable
630
+ var isResizable = uiDialog.is( ":data(resizable)" );
631
+ if (isResizable && !value) {
632
+ uiDialog.resizable('destroy');
633
+ }
634
+
635
+ // currently resizable, changing handles
636
+ if (isResizable && typeof value === 'string') {
637
+ uiDialog.resizable('option', 'handles', value);
638
+ }
639
+
640
+ // currently non-resizable, becoming resizable
641
+ if (!isResizable && value !== false) {
642
+ self._makeResizable(value);
643
+ }
644
+ break;
645
+ case "title":
646
+ // convert whatever was passed in o a string, for html() to not throw up
647
+ $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
648
+ break;
649
+ }
650
+
651
+ $.Widget.prototype._setOption.apply(self, arguments);
652
+ },
653
+
654
+ _size: function() {
655
+ /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
656
+ * divs will both have width and height set, so we need to reset them
657
+ */
658
+ var options = this.options,
659
+ nonContentHeight,
660
+ minContentHeight,
661
+ isVisible = this.uiDialog.is( ":visible" );
662
+
663
+ // reset content sizing
664
+ this.element.show().css({
665
+ width: 'auto',
666
+ minHeight: 0,
667
+ height: 0
668
+ });
669
+
670
+ if (options.minWidth > options.width) {
671
+ options.width = options.minWidth;
672
+ }
673
+
674
+ // reset wrapper sizing
675
+ // determine the height of all the non-content elements
676
+ nonContentHeight = this.uiDialog.css({
677
+ height: 'auto',
678
+ width: options.width
679
+ })
680
+ .height();
681
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
682
+
683
+ if ( options.height === "auto" ) {
684
+ // only needed for IE6 support
685
+ if ( $.support.minHeight ) {
686
+ this.element.css({
687
+ minHeight: minContentHeight,
688
+ height: "auto"
689
+ });
690
+ } else {
691
+ this.uiDialog.show();
692
+ var autoHeight = this.element.css( "height", "auto" ).height();
693
+ if ( !isVisible ) {
694
+ this.uiDialog.hide();
695
+ }
696
+ this.element.height( Math.max( autoHeight, minContentHeight ) );
697
+ }
698
+ } else {
699
+ this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
700
+ }
701
+
702
+ if (this.uiDialog.is(':data(resizable)')) {
703
+ this.uiDialog.resizable('option', 'minHeight', this._minHeight());
704
+ }
705
+ }
706
+ });
707
+
708
+ $.extend($.ui.dialog, {
709
+ version: "1.8.20",
710
+
711
+ uuid: 0,
712
+ maxZ: 0,
713
+
714
+ getTitleId: function($el) {
715
+ var id = $el.attr('id');
716
+ if (!id) {
717
+ this.uuid += 1;
718
+ id = this.uuid;
719
+ }
720
+ return 'ui-dialog-title-' + id;
721
+ },
722
+
723
+ overlay: function(dialog) {
724
+ this.$el = $.ui.dialog.overlay.create(dialog);
725
+ }
726
+ });
727
+
728
+ $.extend($.ui.dialog.overlay, {
729
+ instances: [],
730
+ // reuse old instances due to IE memory leak with alpha transparency (see #5185)
731
+ oldInstances: [],
732
+ maxZ: 0,
733
+ events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
734
+ function(event) { return event + '.dialog-overlay'; }).join(' '),
735
+ create: function(dialog) {
736
+ if (this.instances.length === 0) {
737
+ // prevent use of anchors and inputs
738
+ // we use a setTimeout in case the overlay is created from an
739
+ // event that we're going to be cancelling (see #2804)
740
+ setTimeout(function() {
741
+ // handle $(el).dialog().dialog('close') (see #4065)
742
+ if ($.ui.dialog.overlay.instances.length) {
743
+ $(document).bind($.ui.dialog.overlay.events, function(event) {
744
+ // stop events if the z-index of the target is < the z-index of the overlay
745
+ // we cannot return true when we don't want to cancel the event (#3523)
746
+ if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
747
+ return false;
748
+ }
749
+ });
750
+ }
751
+ }, 1);
752
+
753
+ // allow closing by pressing the escape key
754
+ $(document).bind('keydown.dialog-overlay', function(event) {
755
+ if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
756
+ event.keyCode === $.ui.keyCode.ESCAPE) {
757
+
758
+ dialog.close(event);
759
+ event.preventDefault();
760
+ }
761
+ });
762
+
763
+ // handle window resize
764
+ $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
765
+ }
766
+
767
+ var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
768
+ .appendTo(document.body)
769
+ .css({
770
+ width: this.width(),
771
+ height: this.height()
772
+ });
773
+
774
+ if ($.fn.bgiframe) {
775
+ $el.bgiframe();
776
+ }
777
+
778
+ this.instances.push($el);
779
+ return $el;
780
+ },
781
+
782
+ destroy: function($el) {
783
+ var indexOf = $.inArray($el, this.instances);
784
+ if (indexOf != -1){
785
+ this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
786
+ }
787
+
788
+ if (this.instances.length === 0) {
789
+ $([document, window]).unbind('.dialog-overlay');
790
+ }
791
+
792
+ $el.remove();
793
+
794
+ // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
795
+ var maxZ = 0;
796
+ $.each(this.instances, function() {
797
+ maxZ = Math.max(maxZ, this.css('z-index'));
798
+ });
799
+ this.maxZ = maxZ;
800
+ },
801
+
802
+ height: function() {
803
+ var scrollHeight,
804
+ offsetHeight;
805
+ // handle IE 6
806
+ if ($.browser.msie && $.browser.version < 7) {
807
+ scrollHeight = Math.max(
808
+ document.documentElement.scrollHeight,
809
+ document.body.scrollHeight
810
+ );
811
+ offsetHeight = Math.max(
812
+ document.documentElement.offsetHeight,
813
+ document.body.offsetHeight
814
+ );
815
+
816
+ if (scrollHeight < offsetHeight) {
817
+ return $(window).height() + 'px';
818
+ } else {
819
+ return scrollHeight + 'px';
820
+ }
821
+ // handle "good" browsers
822
+ } else {
823
+ return $(document).height() + 'px';
824
+ }
825
+ },
826
+
827
+ width: function() {
828
+ var scrollWidth,
829
+ offsetWidth;
830
+ // handle IE
831
+ if ( $.browser.msie ) {
832
+ scrollWidth = Math.max(
833
+ document.documentElement.scrollWidth,
834
+ document.body.scrollWidth
835
+ );
836
+ offsetWidth = Math.max(
837
+ document.documentElement.offsetWidth,
838
+ document.body.offsetWidth
839
+ );
840
+
841
+ if (scrollWidth < offsetWidth) {
842
+ return $(window).width() + 'px';
843
+ } else {
844
+ return scrollWidth + 'px';
845
+ }
846
+ // handle "good" browsers
847
+ } else {
848
+ return $(document).width() + 'px';
849
+ }
850
+ },
851
+
852
+ resize: function() {
853
+ /* If the dialog is draggable and the user drags it past the
854
+ * right edge of the window, the document becomes wider so we
855
+ * need to stretch the overlay. If the user then drags the
856
+ * dialog back to the left, the document will become narrower,
857
+ * so we need to shrink the overlay to the appropriate size.
858
+ * This is handled by shrinking the overlay before setting it
859
+ * to the full document size.
860
+ */
861
+ var $overlays = $([]);
862
+ $.each($.ui.dialog.overlay.instances, function() {
863
+ $overlays = $overlays.add(this);
864
+ });
865
+
866
+ $overlays.css({
867
+ width: 0,
868
+ height: 0
869
+ }).css({
870
+ width: $.ui.dialog.overlay.width(),
871
+ height: $.ui.dialog.overlay.height()
872
+ });
873
+ }
874
+ });
875
+
876
+ $.extend($.ui.dialog.overlay.prototype, {
877
+ destroy: function() {
878
+ $.ui.dialog.overlay.destroy(this.$el);
879
+ }
880
+ });
881
+
882
+ }(jQuery));