Added support for pre-collapsed containers
authorAlexander Ebert <ebert@woltlab.com>
Wed, 15 Nov 2017 23:47:10 +0000 (00:47 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 15 Nov 2017 23:47:10 +0000 (00:47 +0100)
wcfsetup/install/files/js/WCF.js

index 90b6c7796975bf2f9022c9ceb4b9518c530dced0..4ac8b65b56b16900854ac09de1a7a08ae733278c 100755 (executable)
@@ -3142,7 +3142,15 @@ WCF.Collapsible.Remote = Class.extend({
         * @param       jQuery          buttonContainer
         */
        _createButton: function(containerID, buttonContainer) {
-               var $button = $('<span class="collapsibleButton jsTooltip pointer icon icon16 fa-chevron-down" title="'+WCF.Language.get('wcf.global.button.collapsible')+'">').prependTo(buttonContainer);
+               var $button = elBySel('.jsStaticCollapsibleButton', buttonContainer[0]);
+               if ($button !== null && $button.parentNode === buttonContainer[0]) {
+                       $button.classList.remove('jsStaticCollapsibleButton');
+                       $button = $($button);
+               }
+               else {
+                       $button = $('<span class="collapsibleButton jsTooltip pointer icon icon16 fa-chevron-down" title="' + WCF.Language.get('wcf.global.button.collapsible') + '">').prependTo(buttonContainer);
+               }
+               
                $button.data('containerID', containerID).click($.proxy(this._toggleContainer, this));
                
                return $button;