Work-around for a glitch in Firefox and calculation issue in Chrome
authorAlexander Ebert <ebert@woltlab.com>
Mon, 9 Mar 2015 22:06:11 +0000 (23:06 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 9 Mar 2015 22:06:11 +0000 (23:06 +0100)
wcfsetup/install/files/js/WCF.js
wcfsetup/install/files/style/layout.less

index f0ac00885b55efc31682539ca8cf3323b08d73f9..cde4d8da72e655cdaf161c2d37ca2192ed822e10 100755 (executable)
@@ -12209,6 +12209,11 @@ WCF.Category.FlexibleCategoryList = Class.extend({
                
                this._buildStructure();
                
+               if (this._list.children('li').length < 2) {
+                       this._list.addClass('flexibleCategoryListDisabled');
+                       return;
+               }
+               
                if ($.browser.chrome) {
                        this._resize();
                        
@@ -12251,19 +12256,14 @@ WCF.Category.FlexibleCategoryList = Class.extend({
                var $items = this._list.children('li');
                
                $items.each(function(index, item) {
-                       if ($referenceOffset === -1) {
+                       if ($referenceOffset === -1 || index + 1 === $items.length || $items[index + 1].offsetLeft != $referenceOffset) {
+                               var $item = $(item);
+                               var $height = $item.outerHeight(true);
+                               var $offset = $item.position();
+                               
+                               $realBottom = Math.max($realBottom, $offset.top + $height);
                                $referenceOffset = item.offsetLeft;
                        }
-                       else {
-                               if (index + 1 === $items.length || $items[index + 1].offsetLeft != $referenceOffset) {
-                                       var $item = $(item);
-                                       var $height = $item.outerHeight(true);
-                                       var $offset = $item.position();
-                                       
-                                       $realBottom = Math.max($realBottom, $offset.top + $height);
-                                       $referenceOffset = item.offsetLeft;
-                               }
-                       }
                });
                
                this._list.css('max-height', $realBottom + 'px');
index 364d4e1eebcd4837c9b5403533b23773b4eb621e..59d900612e7b209ffdcd8f37b0dc52fc38a5ce12 100644 (file)
@@ -1177,7 +1177,7 @@ html[dir="rtl"] {
                }
        }
        
-       .flexibleCategoryList {
+       .flexibleCategoryList:not(.flexibleCategoryListDisabled) {
                /* WebKit */
                -webkit-column-count: 2;
                
@@ -1191,9 +1191,6 @@ html[dir="rtl"] {
                        /* WebKit */
                        -webkit-column-break-inside: avoid;
                        
-                       /* Firefox */
-                       page-break-inside: avoid;
-                       
                        /* CSS 3 / Internet Explorer */
                        break-inside: avoid;
                        
@@ -1206,6 +1203,14 @@ html[dir="rtl"] {
                        }
                }
        }
+       
+       /* Firefox */
+       @-moz-document url-prefix() {
+               .flexibleCategoryList:not(.flexibleCategoryListDisabled) > li {
+                       display: block;
+                       overflow: hidden;
+               }
+       }
 }
 
 .sidebarNestedCategoryList {