Fixed an issue w/ ACP mobile menu
authorAlexander Ebert <ebert@woltlab.com>
Sun, 31 Jul 2016 12:41:54 +0000 (14:41 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 31 Jul 2016 12:42:02 +0000 (14:42 +0200)
wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/Menu/Main.js

index eeba6ce80016a18ec541a9c1fdbffe80c873208c..64046563ff6b5f8c56f4c6ddd44e5fef9786c561 100644 (file)
@@ -9,11 +9,7 @@
 define(['Core', 'Dom/Traverse', './Abstract'], function(Core, DomTraverse, UiPageMenuAbstract) {
        "use strict";
        
-       var _container = elById('pageMainMenuMobilePageOptionsContainer');
-       var _hasItems = null;
-       var _list = DomTraverse.childByClass(_container, 'menuOverlayItemList');
-       var _navigationList = elBySel('.jsPageNavigationIcons');
-       var _spacer = _container.nextElementSibling;
+       var _container = null, _hasItems = null, _list = null, _navigationList = null, _spacer = null;
        
        /**
         * @constructor
@@ -31,8 +27,15 @@ define(['Core', 'Dom/Traverse', './Abstract'], function(Core, DomTraverse, UiPag
                                '#pageHeader .mainMenu'
                        );
                        
-                       // remove placeholder item
-                       elRemove(DomTraverse.childByClass(_list, 'jsMenuOverlayItemPlaceholder'));
+                       _container = elById('pageMainMenuMobilePageOptionsContainer');
+                       if (_container !== null) {
+                               _list = DomTraverse.childByClass(_container, 'menuOverlayItemList');
+                               _navigationList = elBySel('.jsPageNavigationIcons');
+                               _spacer = _container.nextElementSibling;
+                               
+                               // remove placeholder item
+                               elRemove(DomTraverse.childByClass(_list, 'jsMenuOverlayItemPlaceholder'));
+                       }
                },
                
                open: function (event) {
@@ -40,6 +43,10 @@ define(['Core', 'Dom/Traverse', './Abstract'], function(Core, DomTraverse, UiPag
                                return false;
                        }
                        
+                       if (_container === null) {
+                               return true;
+                       }
+                       
                        _hasItems = _navigationList.childElementCount > 0;
                        
                        if (_hasItems) {