浏览代码

updates #212

* Make sure that the roster container has a fixed height, so that we can better
check whether the roster is overflowing.
* Call update after inserting the roster into the DOM
JC Brand 11 年之前
父节点
当前提交
aff91fc683
共有 4 个文件被更改,包括 15 次插入16 次删除
  1. 2 3
      converse.js
  2. 4 4
      css/converse.css
  3. 4 4
      less/converse.less
  4. 5 5
      src/jquery.fastLiveFilter.js

+ 2 - 3
converse.js

@@ -307,8 +307,7 @@
         // Module-level functions
         // Module-level functions
         // ----------------------
         // ----------------------
         this.giveFeedback = function (message, klass) {
         this.giveFeedback = function (message, klass) {
-            $('.conn-feedback').text(message);
-            $('.conn-feedback').attr('class', 'conn-feedback');
+            $('.conn-feedback').attr('class', 'conn-feedback').text(message);
             if (klass) {
             if (klass) {
                 $('.conn-feedback').addClass(klass);
                 $('.conn-feedback').addClass(klass);
             }
             }
@@ -1517,9 +1516,9 @@
                     });
                     });
                 }
                 }
                 this.$el.html(widgets);
                 this.$el.html(widgets);
-
                 this.$el.find('.search-xmpp ul').append(markup);
                 this.$el.find('.search-xmpp ul').append(markup);
                 this.$el.append(converse.rosterview.$el);
                 this.$el.append(converse.rosterview.$el);
+                converse.rosterview.update(); // Will render live filter if needed.
                 return this;
                 return this;
             },
             },
 
 

+ 4 - 4
css/converse.css

@@ -886,8 +886,8 @@ dl.add-converse-contact {
   width: 100%;
   width: 100%;
   position: relative;
   position: relative;
   margin: 0.5em 0 0 0;
   margin: 0.5em 0 0 0;
-  max-height: 194px;
-  max-height: calc(100% - 25px);
+  height: 194px;
+  height: calc(100% - 25px);
 }
 }
 #converse-roster .roster-filter {
 #converse-roster .roster-filter {
   margin: 0 0.5em;
   margin: 0 0.5em;
@@ -897,8 +897,8 @@ dl.add-converse-contact {
   margin: 0;
   margin: 0;
   overflow-y: auto;
   overflow-y: auto;
   overflow-x: hidden;
   overflow-x: hidden;
-  height: 195px;
-  height: calc(100% - 67px);
+  max-height: 195px;
+  max-height: calc(100% - 67px);
 }
 }
 #converse-roster .group-toggle {
 #converse-roster .group-toggle {
   color: #666;
   color: #666;

+ 4 - 4
less/converse.less

@@ -984,8 +984,8 @@ dl.add-converse-contact {
     width: 100%;
     width: 100%;
     position: relative;
     position: relative;
     margin: 0.5em 0 0 0;
     margin: 0.5em 0 0 0;
-    max-height: 194px;
-    max-height: ~"calc(100% - 25px)";
+    height: 194px;
+    height: ~"calc(100% - 25px)";
 }
 }
 
 
 #converse-roster .roster-filter {
 #converse-roster .roster-filter {
@@ -997,8 +997,8 @@ dl.add-converse-contact {
     margin: 0;
     margin: 0;
     overflow-y: auto;
     overflow-y: auto;
     overflow-x: hidden;
     overflow-x: hidden;
-    height: 195px;
-    height: ~"calc(100% - 67px)";
+    max-height: 195px;
+    max-height: ~"calc(100% - 67px)";
 }
 }
 
 
 #converse-roster .group-toggle {
 #converse-roster .group-toggle {

+ 5 - 5
src/jquery.fastLiveFilter.js

@@ -1,11 +1,11 @@
 jQuery.fn.hasScrollBar = function() {
 jQuery.fn.hasScrollBar = function() {
-    var el = this.get(0);
-    if(el.offsetHeight < el.scrollHeight) {
-        return true;
-    }
-    else{
+    if (!$.contains(document, this.get(0))) {
         return false;
         return false;
     }
     }
+    if(this.parent().height() < this.get(0).scrollHeight) {
+        return true;
+    }
+    return false;
 };
 };
 
 
 jQuery.fn.liveFilter = function(list, options) {
 jQuery.fn.liveFilter = function(list, options) {