From d8ccc25fe5119b4a21a848875f1f225bda023087 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 14 Jul 2015 16:22:01 +0200 Subject: [PATCH] Added support for static dialogs --- .../install/files/js/WoltLab/WCF/Ui/Dialog.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js index c8892009f7..db2821e5db 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js @@ -26,6 +26,7 @@ define( var _dialogObjects = new ObjectMap(); var _dialogFullHeight = false; var _keyupListener = null; + var _staticDialogs = elByClass('jsStaticDialog'); /** * @exports WoltLab/WCF/Ui/Dialog @@ -63,6 +64,26 @@ define( setup: function() { _dialogFullHeight = true; }, deferSetup: true }); + + this._initStaticDialogs(); + DomChangeListener.add('Ui/Dialog', this._initStaticDialogs.bind(this)); + }, + + _initStaticDialogs: function() { + var button, container, id; + while (_staticDialogs.length) { + button = _staticDialogs[0]; + button.classList.remove('jsStaticDialog'); + + id = elAttr(button, 'data-dialog-id'); + if (id && (container = elById(id))) { + ((function(button, container) { + container.classList.remove('jsStaticDialogContent'); + button.addEventListener('click', this.openStatic.bind(this, container.id, null, { title: elAttr(container, 'data-title') })); + }).bind(this))(button, container); + } + + } }, /** -- 2.20.1