From 7acc8bd4617df2d10a6dff05a71e40bb7d3f2970 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 23 Aug 2017 14:48:13 +0200 Subject: [PATCH] Added generic event for static dialogs --- .../files/js/WoltLabSuite/Core/Ui/Dialog.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js index 67f5a060f6..e34c7a782e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js @@ -10,12 +10,14 @@ define( [ 'enquire', 'Ajax', 'Core', 'Dictionary', 'Environment', 'Language', 'ObjectMap', 'Dom/ChangeListener', - 'Dom/Traverse', 'Dom/Util', 'Ui/Confirmation', 'Ui/Screen', 'Ui/SimpleDropdown' + 'Dom/Traverse', 'Dom/Util', 'Ui/Confirmation', 'Ui/Screen', 'Ui/SimpleDropdown', + 'EventHandler' ], function( enquire, Ajax, Core, Dictionary, Environment, Language, ObjectMap, DomChangeListener, - DomTraverse, DomUtil, UiConfirmation, UiScreen, UiSimpleDropdown + DomTraverse, DomUtil, UiConfirmation, UiScreen, UiSimpleDropdown, + EventHandler ) { "use strict"; @@ -97,6 +99,7 @@ define( if (id && (container = elById(id))) { ((function(button, container) { container.classList.remove('jsStaticDialogContent'); + elData(container, 'is-static-dialog', true); elHide(container); button.addEventListener(WCF_CLICK_EVENT, this.openStatic.bind(this, container.id, null, { title: elData(container, 'title') })); }).bind(this))(button, container); @@ -467,6 +470,13 @@ define( data.onShow(data.content); } + if (elDataBool(data.content, 'is-static-dialog')) { + EventHandler.fire('com.woltlab.wcf.dialog', 'openStatic', { + content: data.content, + id: id + }); + } + // close existing dropdowns UiSimpleDropdown.closeAll(); window.WCF.Dropdown.Interactive.Handler.closeAll(); -- 2.20.1