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 @@
}
};
converse.refresh = function () {
// TODO: only do this for webkit browsers
var conversejs = document.getElementById('conversejs');
conversejs.style.display = 'none';
conversejs.offsetHeight; // no need to store this anywhere, the reference is enough
conversejs.style.display = 'block';
converse.refreshWebkit = function () {
/* 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');
conversejs.style.display = 'none';
conversejs.offsetHeight; // no need to store this anywhere, the reference is enough
conversejs.style.display = 'block';
}
};
converse.initialize = function (settings, callback) {
......@@ -859,6 +863,7 @@
this.model.on('showReceivedOTRMessage', function (text) {
this.showOTRMessage(text, 'them');
}, this);
this.updateVCard();
this.$el.appendTo(converse.chatboxesview.$el);
this.render().show().model.messages.fetch({add: true});
......@@ -1390,12 +1395,9 @@
},
hide: function () {
var speed = converse.animate ? 'fast' : null;
if (this.$el.is(':visible') && this.$el.css('opacity') == "1") {
if (converse.animate) {
this.$el.hide('fast');
} else {
this.$el.hide();
}
this.$el.hide(speed, converse.refreshWebkit);
converse.emit('onChatBoxClosed', this);
}
},
......@@ -1788,11 +1790,9 @@
show: function () {
converse.controlboxtoggle.hide($.proxy(function () {
if (converse.animate) {
this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, function () {
converse.refresh();
});
this.$el.css({'opacity': 0, 'display': 'inline'}).animate({opacity: '1'}, 200, null, converse.refreshWebkit);
} else {
this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refresh();
this.$el.css({'opacity': 1, 'display': 'inline'}); converse.refreshWebkit();
}
if (converse.connection) {
// 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