From 5a1b40421d4c4a10c71b4b12232f67dc92daf9ad Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 24 Feb 2012 17:05:26 +0100 Subject: [PATCH] Dialogs should now longer trigger multiple overlays --- wcfsetup/install/files/js/WCF.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) 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) { -- 2.20.1