Commit 190142a0 authored by JC Brand's avatar JC Brand

Call trimChats when the window is resized.

Also fixed 2 bugs.

1. Instead of checking whether minimized chats toggle is visible, check whether
there ae aleady minimized chats (visuals might be delayed).
2. Don't call restore from removeChat. Chat gets restored earlier.
parent 9c2b19c7
...@@ -521,12 +521,16 @@ ...@@ -521,12 +521,16 @@
this.resized_chatbox = null; this.resized_chatbox = null;
}, this)); }, this));
$(window).on("blur focus", $.proxy(function(e) { $(window).on("blur focus", $.proxy(function (ev) {
if ((this.windowState != e.type) && (e.type == 'focus')) { if ((this.windowState != ev.type) && (ev.type == 'focus')) {
converse.clearMsgCounter(); converse.clearMsgCounter();
} }
this.windowState = e.type; this.windowState = ev.type;
},this)); },this));
$(window).on("resize", _.debounce($.proxy(function (ev) {
this.chatboxviews.trimChats();
},this), 200));
}; };
this.onReconnected = function () { this.onReconnected = function () {
...@@ -2547,9 +2551,9 @@ ...@@ -2547,9 +2551,9 @@
} }
var controlbox_width = 0, var controlbox_width = 0,
$minimized = converse.minimized_chats.$el, $minimized = converse.minimized_chats.$el,
minimized_width = $minimized.is(':visible') ? $minimized.outerWidth(true) : 0, minimized_width = _.contains(this.model.pluck('minimized'), true) ? $minimized.outerWidth(true) : 0,
boxes_width = newchat ? newchat.$el.outerWidth(true) : 0, boxes_width = newchat ? newchat.$el.outerWidth(true) : 0,
new_id = newchat ? newchat.model.get('id') : 0, new_id = newchat ? newchat.model.get('id') : null,
controlbox = this.get('controlbox'); controlbox = this.get('controlbox');
if (!controlbox || !controlbox.$el.is(':visible')) { if (!controlbox || !controlbox.$el.is(':visible')) {
...@@ -2734,7 +2738,7 @@ ...@@ -2734,7 +2738,7 @@
}, },
removeChat: function (item) { removeChat: function (item) {
this.remove(item.get('id')).restore(); this.remove(item.get('id'));
this.chats_toggle.set({'num_minimized': this.keys().length}); this.chats_toggle.set({'num_minimized': this.keys().length});
this.render(); this.render();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment