Changeset 1023
- Timestamp:
- 08/23/08 10:41:55 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/new-dialogs/modules/Dialogs/XinhaDialog.js
r1020 r1023 61 61 this.closable = globalOptions.closable; 62 62 } 63 if (typeof(globalOptions.modal) != 'undefined') {64 this.modal = globalOptions.modal;65 }66 63 if (typeof(globalOptions.closeOnEscape) != 'undefined') { 67 64 this.closeOnEscape = globalOptions.closeOnEscape; 68 65 } 69 }70 71 /* NOTE: Support for modeless dialogs is incomplete and all current plugins72 /* use modal dialogs, so I'm deactivating modeless dialogs until these issues are fixed73 /* Outstanding issues with modeless dialogs:74 /* - it's possible new modeless dialogs will be opened behind other dialogs75 /* - there's no visual indication as to which modeless dialog is frontmost and has focus76 /* - closing one dialog does not cause the dialog behind it to gain focus77 /* - no active modeless dialog is set until one is clicked, i.e., none is set by just calling show()78 /* - you can type in a form field of a dialog even when it's not frontmost (and doing so doesn't activate it)79 /* See discussion on ticket #1264: http://xinha.webfactional.com/ticket/126480 */81 if (this.modal == false) {82 this.modal = true;83 alert("Support for modeless dialogs is currently incomplete and has been turned off. "84 + "See comments at: http://xinha.webfactional.com/ticket/1264");85 66 } 86 67 … … 192 173 rootElem.appendChild(this.buttons); 193 174 194 if (this.clos eOnEscape)175 if (this.closable && this.closeOnEscape) 195 176 { 196 177 Xinha._addEvent(document, 'keypress', function(ev) { 197 178 if (ev.keyCode == 27) // ESC key 198 179 { 199 if (Xinha.Dialog.activeModeless == dialog || dialog.modal)200 {201 dialog.hide();202 return true;203 }180 if (Xinha.Dialog.activeModeless == dialog || dialog.modal) 181 { 182 dialog.hide(); 183 return true; 184 } 204 185 } 205 186 }); … … 359 340 360 341 //rootElemStyle.display = ''; 361 Xinha.Dialog.fadeIn(this.rootElem); 342 Xinha.Dialog.fadeIn(this.rootElem, 100,function() { 343 //this is primarily to work around a bug in IE where absolutely positioned elements have a frame that renders above all #1268 344 //but could also be seen as a feature ;) 345 if (modal) 346 { 347 var input = dialog.rootElem.getElementsByTagName('input'); 348 for (var i=0;i<input.length;i++) 349 { 350 if (input[i].type == 'text') 351 { 352 input[i].focus(); 353 break; 354 } 355 } 356 } 357 }); 362 358 var dialogHeight = rootElem.offsetHeight; 363 359 var dialogWidth = rootElem.offsetWidth; … … 1097 1093 * @param {Number} step Fade this much per step (percent) 1098 1094 */ 1099 Xinha.Dialog.fadeIn = function(el,endOpacity, delay,step)1095 Xinha.Dialog.fadeIn = function(el,endOpacity,callback, delay,step) 1100 1096 { 1101 1097 delay = delay || 1; … … 1113 1109 el.op += step; 1114 1110 Xinha.Dialog.setOpacity(el,op); 1115 el.timeOut = setTimeout(function(){Xinha.Dialog.fadeIn(el, endOpacity,delay,step);},delay);1111 el.timeOut = setTimeout(function(){Xinha.Dialog.fadeIn(el, endOpacity, callback, delay, step);},delay); 1116 1112 } 1117 1113 else … … 1120 1116 el.op = endOpacity; 1121 1117 el.timeOut = null; 1118 if (typeof callback == 'function') callback.call(); 1122 1119 } 1123 1120 }
