Changeset 5608
- Timestamp:
- 05/15/08 14:41:12 (7 months ago)
- Files:
-
- 1 modified
-
trunk/ui/ui.dialog.js (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.dialog.js
r5595 r5608 44 44 .wrap(document.createElement('div')); 45 45 var uiDialogContainer = uiDialogContent.parent().addClass('ui-dialog-container').css({position: 'relative'}); 46 var uiDialog = this.uiDialog = uiDialogContainer.parent().hide()46 var uiDialog = (this.uiDialog = uiDialogContainer.parent()).hide() 47 47 .addClass('ui-dialog') 48 48 .css({position: 'absolute', width: options.width, height: options.height, overflow: 'hidden'}); … … 52 52 // Add content classes to dialog, to inherit theme at top level of element 53 53 $.each(classNames, function(i, className) { 54 if(className != 'ui-dialog-content')55 uiDialog.addClass(className);54 ((className != 'ui-dialog-content') 55 && uiDialog.addClass(className)); 56 56 }); 57 57 … … 73 73 resize: options.resize, 74 74 stop: function(e, ui) { 75 options.resizeStop && options.resizeStop.apply(this, arguments);75 (options.resizeStop && options.resizeStop.apply(this, arguments)); 76 76 $.ui.dialog.overlay.resize(); 77 77 } 78 78 }); 79 if (!options.resizable) 80 uiDialog.resizable('disable'); 79 (!options.resizable && uiDialog.resizable('disable')); 81 80 } 82 81 … … 104 103 if (options.closeOnEscape) { 105 104 var ESC = 27; 106 ev.keyCode && ev.keyCode == ESC && self.close();105 (ev.keyCode && ev.keyCode == ESC && self.close()); 107 106 } 108 107 }); … … 116 115 $(document.createElement('button')) 117 116 .text(name) 118 .click(function() { fn.apply(self.element, arguments) })117 .click(function() { fn.apply(self.element, arguments); }) 119 118 .appendTo(uiDialogButtonPane); 120 119 }); … … 126 125 start: function(e, ui) { 127 126 self.activate(); 128 options.dragStart && options.dragStart.apply(this, arguments);127 (options.dragStart && options.dragStart.apply(this, arguments)); 129 128 }, 130 129 drag: options.drag, 131 130 stop: function(e, ui) { 132 options.dragStop && options.dragStop.apply(this, arguments);131 (options.dragStop && options.dragStop.apply(this, arguments)); 133 132 $.ui.dialog.overlay.resize(); 134 133 } 135 134 }); 136 if (!options.draggable) 137 uiDialog.draggable('disable') 135 (!options.draggable && uiDialog.draggable('disable')); 138 136 } 139 137 … … 145 143 }); 146 144 147 options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe(); 148 149 if (options.autoOpen) { 150 this.open(); 151 }; 145 (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); 146 147 (options.autoOpen && this.open()); 152 148 }, 153 149 154 150 setData: function(key, value){ 155 setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value);151 (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); 156 152 switch (key) { 157 153 case "draggable": … … 189 185 } 190 186 if (pos.constructor != Array) { 191 pos = = ['center', 'middle']187 pos = ['center', 'middle']; 192 188 } 193 189 if (pos[0].constructor == Number) { … … 201 197 pLeft += (wnd.width()) - (this.uiDialog.width()); 202 198 break; 199 default: 203 200 case 'center': 204 default:205 201 pLeft += (wnd.width() / 2) - (this.uiDialog.width() / 2); 206 202 } … … 216 212 pTop += (wnd.height()) - (this.uiDialog.height()); 217 213 break; 214 default: 218 215 case 'middle': 219 default:220 216 pTop += (wnd.height() / 2) - (this.uiDialog.height() / 2); 221 217 } … … 252 248 // would make any modeless dialogs that it spawned unusable until 253 249 // the modal dialog is closed. 254 !this.options.modal && this.moveToTop();250 (!this.options.modal && this.moveToTop()); 255 251 }, 256 252 … … 260 256 maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); 261 257 }); 262 this.overlay && this.overlay.$el.css('z-index', ++maxZ);258 (this.overlay && this.overlay.$el.css('z-index', ++maxZ)); 263 259 this.uiDialog.css('z-index', ++maxZ); 264 260 }, 265 261 266 262 close: function() { 267 this.overlay && this.overlay.destroy();263 (this.overlay && this.overlay.destroy()); 268 264 this.uiDialog.hide(); 269 265 … … 278 274 279 275 destroy: function() { 280 this.overlay && this.overlay.destroy();276 (this.overlay && this.overlay.destroy()); 281 277 this.uiDialog.hide(); 282 278 this.element … … 347 343 $(document).bind('keydown.dialog-overlay', function(e) { 348 344 var ESC = 27; 349 e.keyCode && e.keyCode == ESC && dialog.close();345 (e.keyCode && e.keyCode == ESC && dialog.close()); 350 346 }); 351 347 … … 362 358 }, dialog.options.overlay)); 363 359 364 dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe();360 (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); 365 361 366 362 this.instances.push($el);
