Commit 8feeb733 authored by JC Brand's avatar JC Brand

Fix webkit bug that prevents boxes from reordering when one is closed

parent 0414fa02
...@@ -103,12 +103,16 @@ ...@@ -103,12 +103,16 @@
} }
}; };
converse.refresh = function () { converse.refreshWebkit = function () {
// TODO: only do this for webkit browsers /* This works around a webkit bug. Refresh the browser's viewport,
* otherwise chatboxes are not moved along when one is closed.
*/
if ($.browser.webkit) {
var conversejs = document.getElementById('conversejs'); var conversejs = document.getElementById('conversejs');
conversejs.style.display = 'none'; conversejs.style.display = 'none';
conversejs.offsetHeight; // no need to store this anywhere, the reference is enough conversejs.offsetHeight; // no need to store this anywhere, the reference is enough
conversejs.style.display = 'block'; conversejs.style.display = 'block';
}
}; };
converse.initialize = function (settings, callback) { converse.initialize = function (settings, callback) {
...@@ -859,6 +863,7 @@ ...@@ -859,6 +863,7 @@
this.model.on('showReceivedOTRMessage', function (text) { this.model.on('showReceivedOTRMessage', function (text) {
this.showOTRMessage(text, 'them'); this.showOTRMessage(text, 'them');
}, this); }, this);
this.updateVCard(); this.updateVCard();
this.$el.appendTo(converse.chatboxesview.$el); this.$el.appendTo(converse.chatboxesview.$el);
this.render().show().model.messages.fetch({add: true}); this.render().show().model.messages.fetch({add: true});
...@@ -1390,12 +1395,9 @@ ...@@ -1390,12 +1395,9 @@
}, },
hide: function () { hide: function () {
var speed = converse.animate ? 'fast' : null;
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") { if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
if (converse.animate) { this.$el.hide(speed, converse.refreshWebkit);
this.$el.hide('fast');
} else {
this.$el.hide();
}
converse.emit('onChatBoxClosed', this); converse.emit('onChatBoxClosed', this);
} }
}, },
...@@ -1788,11 +1790,9 @@ ...@@ -1788,11 +1790,9 @@
show: function () { show: function () {
converse.controlboxtoggle.hide($.proxy(function () { converse.controlboxtoggle.hide($.proxy(function () {
if (converse.animate) { if (converse.animate) {
this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, function () { this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, converse.refreshWebkit);
converse.refresh();
});
} else { } else {
this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refresh(); this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refreshWebkit();
} }
if (converse.connection) { if (converse.connection) {
// Without a connection, we haven't yet initialized // Without a connection, we haven't yet initialized
......
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