From: Alexander Ebert Date: Tue, 14 Jul 2015 14:22:01 +0000 (+0200) Subject: Added support for static dialogs X-Git-Tag: 3.0.0_Beta_1~2176 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d8ccc25fe5119b4a21a848875f1f225bda023087;p=GitHub%2FWoltLab%2FWCF.git Added support for static dialogs --- 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); + } + + } }, /**