Added support for static dialogs
authorAlexander Ebert <ebert@woltlab.com>
Tue, 14 Jul 2015 14:22:01 +0000 (16:22 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 14 Jul 2015 14:22:01 +0000 (16:22 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js

index c8892009f7745a81a51772b479edcabbbc99530e..db2821e5dba48d6ce997c7cf799d6cc806aa88b0 100644 (file)
@@ -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);
+                               }
+                               
+                       }
                },
                
                /**