author | Lennard de Rijk <ljvderijk@gmail.com> |
Thu, 13 Aug 2009 11:52:43 -0700 | |
changeset 2769 | 279d26439495 |
parent 2749 | 4e2789b8e86d |
permissions | -rw-r--r-- |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
1 |
/* |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
2 |
* jQuery UI Dialog 1.7.2 |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
3 |
* |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
4 |
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
5 |
* Dual licensed under the MIT (MIT-LICENSE.txt) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
6 |
* and GPL (GPL-LICENSE.txt) licenses. |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
7 |
* |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
8 |
* http://docs.jquery.com/UI/Dialog |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
9 |
* |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
10 |
* Depends: |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
11 |
* ui.core.js |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
12 |
* ui.draggable.js |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
13 |
* ui.resizable.js |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
14 |
*/ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
15 |
(function($) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
16 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
17 |
var setDataSwitch = { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
18 |
dragStart: "start.draggable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
19 |
drag: "drag.draggable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
20 |
dragStop: "stop.draggable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
21 |
maxHeight: "maxHeight.resizable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
22 |
minHeight: "minHeight.resizable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
23 |
maxWidth: "maxWidth.resizable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
24 |
minWidth: "minWidth.resizable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
25 |
resizeStart: "start.resizable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
26 |
resize: "drag.resizable", |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
27 |
resizeStop: "stop.resizable" |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
28 |
}, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
29 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
30 |
uiDialogClasses = |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
31 |
'ui-dialog ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
32 |
'ui-widget ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
33 |
'ui-widget-content ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
34 |
'ui-corner-all '; |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
35 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
36 |
$.widget("ui.dialog", { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
37 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
38 |
_init: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
39 |
this.originalTitle = this.element.attr('title'); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
40 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
41 |
var self = this, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
42 |
options = this.options, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
43 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
44 |
title = options.title || this.originalTitle || ' ', |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
45 |
titleId = $.ui.dialog.getTitleId(this.element), |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
46 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
47 |
uiDialog = (this.uiDialog = $('<div/>')) |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
48 |
.appendTo(document.body) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
49 |
.hide() |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
50 |
.addClass(uiDialogClasses + options.dialogClass) |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
51 |
.css({ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
52 |
position: 'absolute', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
53 |
overflow: 'hidden', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
54 |
zIndex: options.zIndex |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
55 |
}) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
56 |
// setting tabIndex makes the div focusable |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
57 |
// setting outline to 0 prevents a border on focus in Mozilla |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
58 |
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
59 |
(options.closeOnEscape && event.keyCode |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
60 |
&& event.keyCode == $.ui.keyCode.ESCAPE && self.close(event)); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
61 |
}) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
62 |
.attr({ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
63 |
role: 'dialog', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
64 |
'aria-labelledby': titleId |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
65 |
}) |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
66 |
.mousedown(function(event) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
67 |
self.moveToTop(false, event); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
68 |
}), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
69 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
70 |
uiDialogContent = this.element |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
71 |
.show() |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
72 |
.removeAttr('title') |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
73 |
.addClass( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
74 |
'ui-dialog-content ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
75 |
'ui-widget-content') |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
76 |
.appendTo(uiDialog), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
77 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
78 |
uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>')) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
79 |
.addClass( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
80 |
'ui-dialog-titlebar ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
81 |
'ui-widget-header ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
82 |
'ui-corner-all ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
83 |
'ui-helper-clearfix' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
84 |
) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
85 |
.prependTo(uiDialog), |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
86 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
87 |
uiDialogTitlebarClose = $('<a href="#"/>') |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
88 |
.addClass( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
89 |
'ui-dialog-titlebar-close ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
90 |
'ui-corner-all' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
91 |
) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
92 |
.attr('role', 'button') |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
93 |
.hover( |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
94 |
function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
95 |
uiDialogTitlebarClose.addClass('ui-state-hover'); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
96 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
97 |
function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
98 |
uiDialogTitlebarClose.removeClass('ui-state-hover'); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
99 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
100 |
) |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
101 |
.focus(function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
102 |
uiDialogTitlebarClose.addClass('ui-state-focus'); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
103 |
}) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
104 |
.blur(function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
105 |
uiDialogTitlebarClose.removeClass('ui-state-focus'); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
106 |
}) |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
107 |
.mousedown(function(ev) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
108 |
ev.stopPropagation(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
109 |
}) |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
110 |
.click(function(event) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
111 |
self.close(event); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
112 |
return false; |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
113 |
}) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
114 |
.appendTo(uiDialogTitlebar), |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
115 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
116 |
uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>')) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
117 |
.addClass( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
118 |
'ui-icon ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
119 |
'ui-icon-closethick' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
120 |
) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
121 |
.text(options.closeText) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
122 |
.appendTo(uiDialogTitlebarClose), |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
123 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
124 |
uiDialogTitle = $('<span/>') |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
125 |
.addClass('ui-dialog-title') |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
126 |
.attr('id', titleId) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
127 |
.html(title) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
128 |
.prependTo(uiDialogTitlebar); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
129 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
130 |
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
131 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
132 |
(options.draggable && $.fn.draggable && this._makeDraggable()); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
133 |
(options.resizable && $.fn.resizable && this._makeResizable()); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
134 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
135 |
this._createButtons(options.buttons); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
136 |
this._isOpen = false; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
137 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
138 |
(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
139 |
(options.autoOpen && this.open()); |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
140 |
|
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
141 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
142 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
143 |
destroy: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
144 |
(this.overlay && this.overlay.destroy()); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
145 |
this.uiDialog.hide(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
146 |
this.element |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
147 |
.unbind('.dialog') |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
148 |
.removeData('dialog') |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
149 |
.removeClass('ui-dialog-content ui-widget-content') |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
150 |
.hide().appendTo('body'); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
151 |
this.uiDialog.remove(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
152 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
153 |
(this.originalTitle && this.element.attr('title', this.originalTitle)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
154 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
155 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
156 |
close: function(event) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
157 |
var self = this; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
158 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
159 |
if (false === self._trigger('beforeclose', event)) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
160 |
return; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
161 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
162 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
163 |
(self.overlay && self.overlay.destroy()); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
164 |
self.uiDialog.unbind('keypress.ui-dialog'); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
165 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
166 |
(self.options.hide |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
167 |
? self.uiDialog.hide(self.options.hide, function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
168 |
self._trigger('close', event); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
169 |
}) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
170 |
: self.uiDialog.hide() && self._trigger('close', event)); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
171 |
|
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
172 |
$.ui.dialog.overlay.resize(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
173 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
174 |
self._isOpen = false; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
175 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
176 |
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
177 |
if (self.options.modal) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
178 |
var maxZ = 0; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
179 |
$('.ui-dialog').each(function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
180 |
if (this != self.uiDialog[0]) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
181 |
maxZ = Math.max(maxZ, $(this).css('z-index')); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
182 |
} |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
183 |
}); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
184 |
$.ui.dialog.maxZ = maxZ; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
185 |
} |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
186 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
187 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
188 |
isOpen: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
189 |
return this._isOpen; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
190 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
191 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
192 |
// the force parameter allows us to move modal dialogs to their correct |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
193 |
// position on open |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
194 |
moveToTop: function(force, event) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
195 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
196 |
if ((this.options.modal && !force) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
197 |
|| (!this.options.stack && !this.options.modal)) { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
198 |
return this._trigger('focus', event); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
199 |
} |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
200 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
201 |
if (this.options.zIndex > $.ui.dialog.maxZ) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
202 |
$.ui.dialog.maxZ = this.options.zIndex; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
203 |
} |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
204 |
(this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ)); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
205 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
206 |
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
207 |
// http://ui.jquery.com/bugs/ticket/3193 |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
208 |
var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
209 |
this.uiDialog.css('z-index', ++$.ui.dialog.maxZ); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
210 |
this.element.attr(saveScroll); |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
211 |
this._trigger('focus', event); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
212 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
213 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
214 |
open: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
215 |
if (this._isOpen) { return; } |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
216 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
217 |
var options = this.options, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
218 |
uiDialog = this.uiDialog; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
219 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
220 |
this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
221 |
(uiDialog.next().length && uiDialog.appendTo('body')); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
222 |
this._size(); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
223 |
this._position(options.position); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
224 |
uiDialog.show(options.show); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
225 |
this.moveToTop(true); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
226 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
227 |
// prevent tabbing out of modal dialogs |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
228 |
(options.modal && uiDialog.bind('keypress.ui-dialog', function(event) { |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
229 |
if (event.keyCode != $.ui.keyCode.TAB) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
230 |
return; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
231 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
232 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
233 |
var tabbables = $(':tabbable', this), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
234 |
first = tabbables.filter(':first')[0], |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
235 |
last = tabbables.filter(':last')[0]; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
236 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
237 |
if (event.target == last && !event.shiftKey) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
238 |
setTimeout(function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
239 |
first.focus(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
240 |
}, 1); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
241 |
} else if (event.target == first && event.shiftKey) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
242 |
setTimeout(function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
243 |
last.focus(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
244 |
}, 1); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
245 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
246 |
})); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
247 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
248 |
// set focus to the first tabbable element in the content area or the first button |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
249 |
// if there are no tabbable elements, set focus on the dialog itself |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
250 |
$([]) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
251 |
.add(uiDialog.find('.ui-dialog-content :tabbable:first')) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
252 |
.add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
253 |
.add(uiDialog) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
254 |
.filter(':first') |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
255 |
.focus(); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
256 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
257 |
this._trigger('open'); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
258 |
this._isOpen = true; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
259 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
260 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
261 |
_createButtons: function(buttons) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
262 |
var self = this, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
263 |
hasButtons = false, |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
264 |
uiDialogButtonPane = $('<div></div>') |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
265 |
.addClass( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
266 |
'ui-dialog-buttonpane ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
267 |
'ui-widget-content ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
268 |
'ui-helper-clearfix' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
269 |
); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
270 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
271 |
// if we already have a button pane, remove it |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
272 |
this.uiDialog.find('.ui-dialog-buttonpane').remove(); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
273 |
|
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
274 |
(typeof buttons == 'object' && buttons !== null && |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
275 |
$.each(buttons, function() { return !(hasButtons = true); })); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
276 |
if (hasButtons) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
277 |
$.each(buttons, function(name, fn) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
278 |
$('<button type="button"></button>') |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
279 |
.addClass( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
280 |
'ui-state-default ' + |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
281 |
'ui-corner-all' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
282 |
) |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
283 |
.text(name) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
284 |
.click(function() { fn.apply(self.element[0], arguments); }) |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
285 |
.hover( |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
286 |
function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
287 |
$(this).addClass('ui-state-hover'); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
288 |
}, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
289 |
function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
290 |
$(this).removeClass('ui-state-hover'); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
291 |
} |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
292 |
) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
293 |
.focus(function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
294 |
$(this).addClass('ui-state-focus'); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
295 |
}) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
296 |
.blur(function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
297 |
$(this).removeClass('ui-state-focus'); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
298 |
}) |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
299 |
.appendTo(uiDialogButtonPane); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
300 |
}); |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
301 |
uiDialogButtonPane.appendTo(this.uiDialog); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
302 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
303 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
304 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
305 |
_makeDraggable: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
306 |
var self = this, |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
307 |
options = this.options, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
308 |
heightBeforeDrag; |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
309 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
310 |
this.uiDialog.draggable({ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
311 |
cancel: '.ui-dialog-content', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
312 |
handle: '.ui-dialog-titlebar', |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
313 |
containment: 'document', |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
314 |
start: function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
315 |
heightBeforeDrag = options.height; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
316 |
$(this).height($(this).height()).addClass("ui-dialog-dragging"); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
317 |
(options.dragStart && options.dragStart.apply(self.element[0], arguments)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
318 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
319 |
drag: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
320 |
(options.drag && options.drag.apply(self.element[0], arguments)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
321 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
322 |
stop: function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
323 |
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
324 |
(options.dragStop && options.dragStop.apply(self.element[0], arguments)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
325 |
$.ui.dialog.overlay.resize(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
326 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
327 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
328 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
329 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
330 |
_makeResizable: function(handles) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
331 |
handles = (handles === undefined ? this.options.resizable : handles); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
332 |
var self = this, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
333 |
options = this.options, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
334 |
resizeHandles = typeof handles == 'string' |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
335 |
? handles |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
336 |
: 'n,e,s,w,se,sw,ne,nw'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
337 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
338 |
this.uiDialog.resizable({ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
339 |
cancel: '.ui-dialog-content', |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
340 |
alsoResize: this.element, |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
341 |
maxWidth: options.maxWidth, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
342 |
maxHeight: options.maxHeight, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
343 |
minWidth: options.minWidth, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
344 |
minHeight: options.minHeight, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
345 |
start: function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
346 |
$(this).addClass("ui-dialog-resizing"); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
347 |
(options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
348 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
349 |
resize: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
350 |
(options.resize && options.resize.apply(self.element[0], arguments)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
351 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
352 |
handles: resizeHandles, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
353 |
stop: function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
354 |
$(this).removeClass("ui-dialog-resizing"); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
355 |
options.height = $(this).height(); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
356 |
options.width = $(this).width(); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
357 |
(options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
358 |
$.ui.dialog.overlay.resize(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
359 |
} |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
360 |
}) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
361 |
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
362 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
363 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
364 |
_position: function(pos) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
365 |
var wnd = $(window), doc = $(document), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
366 |
pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
367 |
minTop = pTop; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
368 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
369 |
if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
370 |
pos = [ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
371 |
pos == 'right' || pos == 'left' ? pos : 'center', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
372 |
pos == 'top' || pos == 'bottom' ? pos : 'middle' |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
373 |
]; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
374 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
375 |
if (pos.constructor != Array) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
376 |
pos = ['center', 'middle']; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
377 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
378 |
if (pos[0].constructor == Number) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
379 |
pLeft += pos[0]; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
380 |
} else { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
381 |
switch (pos[0]) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
382 |
case 'left': |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
383 |
pLeft += 0; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
384 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
385 |
case 'right': |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
386 |
pLeft += wnd.width() - this.uiDialog.outerWidth(); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
387 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
388 |
default: |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
389 |
case 'center': |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
390 |
pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
391 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
392 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
393 |
if (pos[1].constructor == Number) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
394 |
pTop += pos[1]; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
395 |
} else { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
396 |
switch (pos[1]) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
397 |
case 'top': |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
398 |
pTop += 0; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
399 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
400 |
case 'bottom': |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
401 |
pTop += wnd.height() - this.uiDialog.outerHeight(); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
402 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
403 |
default: |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
404 |
case 'middle': |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
405 |
pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2; |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
406 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
407 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
408 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
409 |
// prevent the dialog from being too high (make sure the titlebar |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
410 |
// is accessible) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
411 |
pTop = Math.max(pTop, minTop); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
412 |
this.uiDialog.css({top: pTop, left: pLeft}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
413 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
414 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
415 |
_setData: function(key, value){ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
416 |
(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
417 |
switch (key) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
418 |
case "buttons": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
419 |
this._createButtons(value); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
420 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
421 |
case "closeText": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
422 |
this.uiDialogTitlebarCloseText.text(value); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
423 |
break; |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
424 |
case "dialogClass": |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
425 |
this.uiDialog |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
426 |
.removeClass(this.options.dialogClass) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
427 |
.addClass(uiDialogClasses + value); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
428 |
break; |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
429 |
case "draggable": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
430 |
(value |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
431 |
? this._makeDraggable() |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
432 |
: this.uiDialog.draggable('destroy')); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
433 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
434 |
case "height": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
435 |
this.uiDialog.height(value); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
436 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
437 |
case "position": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
438 |
this._position(value); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
439 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
440 |
case "resizable": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
441 |
var uiDialog = this.uiDialog, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
442 |
isResizable = this.uiDialog.is(':data(resizable)'); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
443 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
444 |
// currently resizable, becoming non-resizable |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
445 |
(isResizable && !value && uiDialog.resizable('destroy')); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
446 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
447 |
// currently resizable, changing handles |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
448 |
(isResizable && typeof value == 'string' && |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
449 |
uiDialog.resizable('option', 'handles', value)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
450 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
451 |
// currently non-resizable, becoming resizable |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
452 |
(isResizable || this._makeResizable(value)); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
453 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
454 |
case "title": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
455 |
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' '); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
456 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
457 |
case "width": |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
458 |
this.uiDialog.width(value); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
459 |
break; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
460 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
461 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
462 |
$.widget.prototype._setData.apply(this, arguments); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
463 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
464 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
465 |
_size: function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
466 |
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
467 |
* divs will both have width and height set, so we need to reset them |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
468 |
*/ |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
469 |
var options = this.options; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
470 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
471 |
// reset content sizing |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
472 |
this.element.css({ |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
473 |
height: 0, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
474 |
minHeight: 0, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
475 |
width: 'auto' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
476 |
}); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
477 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
478 |
// reset wrapper sizing |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
479 |
// determine the height of all the non-content elements |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
480 |
var nonContentHeight = this.uiDialog.css({ |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
481 |
height: 'auto', |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
482 |
width: options.width |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
483 |
}) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
484 |
.height(); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
485 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
486 |
this.element |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
487 |
.css({ |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
488 |
minHeight: Math.max(options.minHeight - nonContentHeight, 0), |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
489 |
height: options.height == 'auto' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
490 |
? 'auto' |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
491 |
: Math.max(options.height - nonContentHeight, 0) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
492 |
}); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
493 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
494 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
495 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
496 |
$.extend($.ui.dialog, { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
497 |
version: "1.7.2", |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
498 |
defaults: { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
499 |
autoOpen: true, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
500 |
bgiframe: false, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
501 |
buttons: {}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
502 |
closeOnEscape: true, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
503 |
closeText: 'close', |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
504 |
dialogClass: '', |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
505 |
draggable: true, |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
506 |
hide: null, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
507 |
height: 'auto', |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
508 |
maxHeight: false, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
509 |
maxWidth: false, |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
510 |
minHeight: 150, |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
511 |
minWidth: 150, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
512 |
modal: false, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
513 |
position: 'center', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
514 |
resizable: true, |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
515 |
show: null, |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
516 |
stack: true, |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
517 |
title: '', |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
518 |
width: 300, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
519 |
zIndex: 1000 |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
520 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
521 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
522 |
getter: 'isOpen', |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
523 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
524 |
uuid: 0, |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
525 |
maxZ: 0, |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
526 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
527 |
getTitleId: function($el) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
528 |
return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
529 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
530 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
531 |
overlay: function(dialog) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
532 |
this.$el = $.ui.dialog.overlay.create(dialog); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
533 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
534 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
535 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
536 |
$.extend($.ui.dialog.overlay, { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
537 |
instances: [], |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
538 |
maxZ: 0, |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
539 |
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
540 |
function(event) { return event + '.dialog-overlay'; }).join(' '), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
541 |
create: function(dialog) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
542 |
if (this.instances.length === 0) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
543 |
// prevent use of anchors and inputs |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
544 |
// we use a setTimeout in case the overlay is created from an |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
545 |
// event that we're going to be cancelling (see #2804) |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
546 |
setTimeout(function() { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
547 |
// handle $(el).dialog().dialog('close') (see #4065) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
548 |
if ($.ui.dialog.overlay.instances.length) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
549 |
$(document).bind($.ui.dialog.overlay.events, function(event) { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
550 |
var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
551 |
return (dialogZ > $.ui.dialog.overlay.maxZ); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
552 |
}); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
553 |
} |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
554 |
}, 1); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
555 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
556 |
// allow closing by pressing the escape key |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
557 |
$(document).bind('keydown.dialog-overlay', function(event) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
558 |
(dialog.options.closeOnEscape && event.keyCode |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
559 |
&& event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event)); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
560 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
561 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
562 |
// handle window resize |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
563 |
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
564 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
565 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
566 |
var $el = $('<div></div>').appendTo(document.body) |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
567 |
.addClass('ui-widget-overlay').css({ |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
568 |
width: this.width(), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
569 |
height: this.height() |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
570 |
}); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
571 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
572 |
(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
573 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
574 |
this.instances.push($el); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
575 |
return $el; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
576 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
577 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
578 |
destroy: function($el) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
579 |
this.instances.splice($.inArray(this.instances, $el), 1); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
580 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
581 |
if (this.instances.length === 0) { |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
582 |
$([document, window]).unbind('.dialog-overlay'); |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
583 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
584 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
585 |
$el.remove(); |
2749
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
586 |
|
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
587 |
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309) |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
588 |
var maxZ = 0; |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
589 |
$.each(this.instances, function() { |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
590 |
maxZ = Math.max(maxZ, this.css('z-index')); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
591 |
}); |
4e2789b8e86d
Upgrade jQuery UI to version 1.7.
Mario Ferraro <fadinlight@gmail.com>
parents:
2420
diff
changeset
|
592 |
this.maxZ = maxZ; |
2420
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
593 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
594 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
595 |
height: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
596 |
// handle IE 6 |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
597 |
if ($.browser.msie && $.browser.version < 7) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
598 |
var scrollHeight = Math.max( |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
599 |
document.documentElement.scrollHeight, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
600 |
document.body.scrollHeight |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
601 |
); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
602 |
var offsetHeight = Math.max( |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
603 |
document.documentElement.offsetHeight, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
604 |
document.body.offsetHeight |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
605 |
); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
606 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
607 |
if (scrollHeight < offsetHeight) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
608 |
return $(window).height() + 'px'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
609 |
} else { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
610 |
return scrollHeight + 'px'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
611 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
612 |
// handle "good" browsers |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
613 |
} else { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
614 |
return $(document).height() + 'px'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
615 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
616 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
617 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
618 |
width: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
619 |
// handle IE 6 |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
620 |
if ($.browser.msie && $.browser.version < 7) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
621 |
var scrollWidth = Math.max( |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
622 |
document.documentElement.scrollWidth, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
623 |
document.body.scrollWidth |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
624 |
); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
625 |
var offsetWidth = Math.max( |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
626 |
document.documentElement.offsetWidth, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
627 |
document.body.offsetWidth |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
628 |
); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
629 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
630 |
if (scrollWidth < offsetWidth) { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
631 |
return $(window).width() + 'px'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
632 |
} else { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
633 |
return scrollWidth + 'px'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
634 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
635 |
// handle "good" browsers |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
636 |
} else { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
637 |
return $(document).width() + 'px'; |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
638 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
639 |
}, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
640 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
641 |
resize: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
642 |
/* If the dialog is draggable and the user drags it past the |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
643 |
* right edge of the window, the document becomes wider so we |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
644 |
* need to stretch the overlay. If the user then drags the |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
645 |
* dialog back to the left, the document will become narrower, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
646 |
* so we need to shrink the overlay to the appropriate size. |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
647 |
* This is handled by shrinking the overlay before setting it |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
648 |
* to the full document size. |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
649 |
*/ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
650 |
var $overlays = $([]); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
651 |
$.each($.ui.dialog.overlay.instances, function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
652 |
$overlays = $overlays.add(this); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
653 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
654 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
655 |
$overlays.css({ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
656 |
width: 0, |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
657 |
height: 0 |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
658 |
}).css({ |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
659 |
width: $.ui.dialog.overlay.width(), |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
660 |
height: $.ui.dialog.overlay.height() |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
661 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
662 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
663 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
664 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
665 |
$.extend($.ui.dialog.overlay.prototype, { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
666 |
destroy: function() { |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
667 |
$.ui.dialog.overlay.destroy(this.$el); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
668 |
} |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
669 |
}); |
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
670 |
|
645f4de26f99
Patch that adds the JS and CSS files for surveys.
Daniel Diniz <ajaksu@gmail.com>
parents:
diff
changeset
|
671 |
})(jQuery); |