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