From: Alexander Ebert Date: Fri, 24 Feb 2012 16:05:26 +0000 (+0100) Subject: Dialogs should now longer trigger multiple overlays X-Git-Tag: 2.0.0_Beta_1~1309^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5a1b40421d4c4a10c71b4b12232f67dc92daf9ad;p=GitHub%2FWoltLab%2FWCF.git Dialogs should now longer trigger multiple overlays --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 1cc41a6968..0668827eb1 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -421,6 +421,12 @@ $.fn.extend({ * WoltLab Community Framework core methods */ $.extend(WCF, { + /** + * count of active dialogs + * @var integer + */ + activeDialogs: 0, + /** * Counter for dynamic element id's * @@ -4418,8 +4424,11 @@ $.widget('ui.wcfDialog', { // create modal view if (this.options.modal) { - this._overlay = $('
').css({ height: '100%', zIndex: 900 }).appendTo(document.body); - + this._overlay = $('#jsWcfDialogOverlay'); + if (!this._overlay.length) { + this._overlay = $('
').css({ height: '100%', zIndex: 900 }).appendTo(document.body); + } + if (this.options.closable) { this._overlay.click($.proxy(this.close, this)); @@ -4494,7 +4503,11 @@ $.widget('ui.wcfDialog', { } if (this._overlay !== null) { - this._overlay.show(); + WCF.activeDialogs++; + + if (WCF.activeDialogs === 1) { + this._overlay.show(); + } } this.render(); @@ -4522,7 +4535,11 @@ $.widget('ui.wcfDialog', { this._container.wcfFadeOut(); if (this._overlay !== null) { - this._overlay.hide(); + WCF.activeDialogs--; + + if (WCF.activeDialogs === 0) { + this._overlay.hide(); + } } if (this.options.onClose !== null) {